PDA

View Full Version : problems with Opengl



SlawQ
12th February 2006, 22:49
Hi.

I have some problems with compiling code using 3D textures. My compiler complains exactly on function glTexImage3D. I iclude all necessary headers:


#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glext.h>


and i get theese errors:


GlClass.cpp: In member function `virtual void GlClass::initializeGL()':
GlClass.cpp:35: error: `glTexImage3D' was not declared in this scope
GlClass.cpp:35: warning: unused variable 'glTexImage3D'


I know that I have my system configured properly because I can compile simple programs without qt that use 3D textures. I wonder if it's some qt's opengl limitation because 2D textures work fine. I use qt 4.

Thanks for help.

jacek
12th February 2006, 23:03
Could you show us line 35 from GlClass.cpp?

SlawQ
12th February 2006, 23:23
This is my opengl initialisation:



void GlClass::initializeGL()
{
glEnable(GL_TEXTURE_3D);
glShadeModel(GL_SMOOTH);
glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);

glGenTextures(1, &texture[0]);
glBindTexture(GL_TEXTURE_3D, texture[0]);

/* Line 35 */
glTexImage3D(GL_TEXTURE_3D, 0, GL_LUMINANCE, 32, 32, 32, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, tekstura);

glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

}

jacek
12th February 2006, 23:36
It appears that the problem is in OpenGL itself.

Try this:
#define GL_GLEXT_PROTOTYPES
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glext.h>

SlawQ
12th February 2006, 23:49
It works!!
Thanks.