i am trying to send sphere data to my fragment shader in order to test my glsl raycaster. A sphere consists of four float values for x,y,z and r. I created a texture and set the internal format to GL_RGBA32F to say OpenGL i want four floats per texture coordinate.
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, 1, 3, 0, GL_RGBA, GL_FLOAT, texData);
and in the fragment shader i do this to read the x value for every sphere:
for (int i = 0; i < 3; i++) {
Sphere s = {vec4(texture2D(sphereData,vec2(0,i)).r, 0.0, -3.3, 1.0), 0.1, scolor};}
for testing i only read the x coordinate of every sphere. Unfortunately it did not work. It draws one or two spheres depending on the settings of glTexImage2D, but the values are not right. If i hardcode the coordinates like
Sphere s = {vec4(0.5, 0.0, -3.3, 1.0),
then it draws the spheres correctly. So i assume theres something wrong with the format of the texture.
I tested every combination of internal formats for glTexImage2D.