PDA

View Full Version : glTexImage3D is not declared in the scope.



Elberion
21st June 2011, 15:39
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);
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));


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

Elberion
21st June 2011, 19:43
Big help needed, i just cant find what i have to include or do so that glActiveTexture and glTexImage3D work properly. I tried glew.h library too and putting



PFNGLTEXIMAGE3DPROC glTexImage3D;
glTexImage3D = (PFNGLTEXIMAGE3DPROC) wglGetProcAddress("glTexImage3D");


before i call the funktion but then it just gives a segmentation faoult on a ati dll in windows and all crushes

Anybody help?

Elberion
22nd June 2011, 21:17
BTW, i use win7 and qtcreator

stampede
22nd June 2011, 22:34
It gives a segmentation fault on the comand glActivateTexture(..)

It compiled nice but it throws a segmentation fault on this line.
Have you tried running the app with attached debugger ? Are you sure that its not your code fault ?
If it crashes in ati dll (or something similar), maybe try updating graphics card drivers.

Elberion
25th June 2011, 19:18
After a lot of searching i think i am not linking glew right.

I use qt creator:
my pro file looks like this

LIBS += -lglut32
LIBS += -lglew32
LIBS += -LC:\QtSDK\mingw\lib

i have the glew.h in mingw\include\GL\glew.h

and the lib file in C:\QtSDK\mingw\lib.

Am i doing here something wrong?
I cant use funktions like glActivateTexture, glcreateProgramObject etc etc.
What do i have to include?

Elberion
25th June 2011, 23:16
Btw i tested it with atached debugger, as i said, segmentation fault at the command.
i tried it on my laptop too, same thing. So somewhere or somehow i am not including right, or linking right

ChrisW67
26th June 2011, 07:15
The program is probably faulting because at run time the GLU/GLEW dynamic libraries are not being found. The DLLs must be in the PATH that the program sees when run.

Ultimately this thread has nothing to do with Qt.