int size = 3*3*2;
float* test = new float[size];
for(int i=0; i<size; i++)
test = 1.0f;
glGenTextures(1, &g_texture3DID);
glBindTexture(GL_TEXTURE_3D, g_texture3DID);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 3, 3, 2, 0, GL_RGBA, GL_FLOAT, &test[0]);
texture 3d basics
hihi!
jus wondering if anyone can enlighten me on this matter:
i am trying to feed in some data into a texture 3d and test its usage using a pixelshader.
i tried using a single float value and it works fine.
but if values are in a vector or explict array, the results dun show.
//this is the code which cannot work
anyone?
thx!
RC
1)The dimensions of the texture are not powers of 2.
2)The GL_FLOAT enum you use, means that each component of a texel is a float. Since you're using RGBA textures, each texel has 4 components. So, you need 4 floats to store a texel.
2)The GL_FLOAT enum you use, means that each component of a texel is a float. Since you're using RGBA textures, each texel has 4 components. So, you need 4 floats to store a texel.
Quote:Original post by RenderCache
ok thx!
power of 2 is the answer
What I said in (2) is also important. If you don't fix it, you'll have also problems, and it might cause the program to crash.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement