I'm currently working on a particle system for my game. I want to handle basic collision with static and simple geometry. To do that, I generate an array of vector4 describing a segment (two points with XY coordinates). Then in my vertex shader I use it to make my intersection test.
The issue is that it works when I run the game on my NVidia GPU but not on my Intel Chipset. So I guess something is wrong with my implementation since NVidia drivers are very flexible.
OpenGL calls
// COLLIDER_BLOCK_INDEX = 0
// glGenBuffers - glBufferData
// Bind UBO to shader
GLuint block_index = glGetUniformBlockIndex(program, "collider_data");
glUniformBlockBinding(program, block_index, COLLIDER_BLOCK_INDEX);
glBindBufferRange(GL_UNIFORM_BUFFER, COLLIDER_BLOCK_INDEX,
_uboCollider, 0, 64 * sizeof(GLfloat) * 4);
// Send data on GPU
glBufferSubData(GL_UNIFORM_BUFFER, 0, 64 * sizeof(GLfloat) * 4, _collider);
// Bind UBO before using it
glBindBufferBase(GL_UNIFORM_BUFFER, COLLIDER_BLOCK_INDEX, _uboCollider);
My data declaration
glm::vec4 _collider[64];
The vertex shader (simplified)
#version 330
layout(std140) uniform collider_data {
vec4 collider[64];
};
I read data as:
vec2(collider[i][0], collider[i][1]) // A point
vec2(collider[i][2], collider[i][3]) // B point
The issue
So as I said, everything works fine on NVidia GPU, but not on the Intel chipset. Do someone see something wrong on this code ? I'm pretty sure my issue comes from this UBO because when I totally remove it, everything works fine with both drivers.
Also, I don't have any OpenGL errors (glGetError()).
Intel chipset specs
OpenGL version [4.2.0 - Build 10.18.10.3574]
Shader version [4.20 - Build 10.18.10.3574]
GL_MAX_FRAGMENT_UNIFORM_BLOCKS [14]
GL_MAX_UNIFORM_BLOCK_SIZE [16384]
GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT [16]