Hi, i am doing a volume shader and i am having some troubles with creating a 3D Texture and binding the textures to the shader.
glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA8, v->res_X , v->res_Y , v->res_Z , 0,GL_RGBA, GL_UNSIGNED_BYTE, v->data);
glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA8, v->res_X , v->res_Y , v->res_Z , 0,GL_RGBA, GL_UNSIGNED_BYTE, v->data);
To copy to clipboard, switch view to plain text mode
This is the comand to create the 3D texture out of the input data. I include "<GL/glext.h>" but it keeps saying glTexImage3D is not declared in this scope, even thou the function is declared there. Looking around i found that someone solved it putting "#define GL_GLEXT_PROTOTYPES" on top of all includes. Doesn't work for me, i get this nasty "collect2:Id returned 1exit status".
Then i found that they use glextensions.h in the qt boxes demo, so i downloaded the file i put it into my project. It compiled nice but it throws a segmentation fault on this line.
And here i ran out of options. There must be an easy solution for it, but i dont find it.
Then I think it is related to the first. This is the way i use to upload a texture, in this case the transferfunktion to the shader.
GLuint texture1D;
glGenTextures(1, &texture1D);
glBindTexture(GL_TEXTURE_1D, texture1D);
glTexImage1D(GL_TEXTURE_1D, 0, 4, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, f);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE0,texture1D);
visualisationProgram->setUniformValue("TransferFunktion",GLint(0));
GLuint texture1D;
glGenTextures(1, &texture1D);
glBindTexture(GL_TEXTURE_1D, texture1D);
glTexImage1D(GL_TEXTURE_1D, 0, 4, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, f);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE0,texture1D);
visualisationProgram->setUniformValue("TransferFunktion",GLint(0));
To copy to clipboard, switch view to plain text mode
It gives a segmentation fault on the comand glActivateTexture(..) and i notice that it happens the same as with the glTexImage3D command. But i dont really know if thats the way it is suposed to be, and i didnt find a clear example of it with qglshaderprogram.
Any Help?
Thanks,
Elbe
Bookmarks