Results 1 to 5 of 5

Thread: problems with Opengl

  1. #1
    Join Date
    Feb 2006
    Posts
    3
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default problems with Opengl

    Hi.

    I have some problems with compiling code using 3D textures. My compiler complains exactly on function glTexImage3D. I iclude all necessary headers:
    Qt Code:
    1. #include <GL/gl.h>
    2. #include <GL/glu.h>
    3. #include <GL/glext.h>
    To copy to clipboard, switch view to plain text mode 

    and i get theese errors:
    Qt Code:
    1. GlClass.cpp: In member function `virtual void GlClass::initializeGL()':
    2. GlClass.cpp:35: error: `glTexImage3D' was not declared in this scope
    3. GlClass.cpp:35: warning: unused variable 'glTexImage3D'
    To copy to clipboard, switch view to plain text mode 

    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.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: problems with Opengl

    Could you show us line 35 from GlClass.cpp?

  3. #3
    Join Date
    Feb 2006
    Posts
    3
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: problems with Opengl

    This is my opengl initialisation:

    Qt Code:
    1. void GlClass::initializeGL()
    2. {
    3. glEnable(GL_TEXTURE_3D);
    4. glShadeModel(GL_SMOOTH);
    5. glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
    6. glClearDepth(1.0f);
    7. glEnable(GL_DEPTH_TEST);
    8. glDepthFunc(GL_LEQUAL);
    9. glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
    10.  
    11. glGenTextures(1, &texture[0]);
    12. glBindTexture(GL_TEXTURE_3D, texture[0]);
    13.  
    14. /* Line 35 */
    15. glTexImage3D(GL_TEXTURE_3D, 0, GL_LUMINANCE, 32, 32, 32, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, tekstura);
    16.  
    17. glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    18. glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    19.  
    20. }
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: problems with Opengl

    It appears that the problem is in OpenGL itself.

    Try this:
    Qt Code:
    1. #define GL_GLEXT_PROTOTYPES
    2. #include <GL/gl.h>
    3. #include <GL/glu.h>
    4. #include <GL/glext.h>
    To copy to clipboard, switch view to plain text mode 

  5. #5
    Join Date
    Feb 2006
    Posts
    3
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: problems with Opengl

    It works!!
    Thanks.

Similar Threads

  1. OpenGL and Qt Question
    By ToddAtWSU in forum Qt Programming
    Replies: 2
    Last Post: 18th April 2009, 18:04
  2. Qt Embedded + OpenGL problem
    By EeroS in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 7th October 2008, 14:32
  3. QT + OpenGL + Thread => aaaahhhhh !
    By anthibug in forum Qt Programming
    Replies: 7
    Last Post: 26th July 2008, 13:36
  4. Qtopia Core & OpenGL ES?
    By zelko in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 28th May 2007, 07:21
  5. OpenGL ES, Qt/11 - Qtopia Core?
    By zelko in forum Qt Programming
    Replies: 0
    Last Post: 3rd May 2007, 10:56

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.