Results 1 to 7 of 7

Thread: glTexImage3D is not declared in the scope.

  1. #1
    Join Date
    May 2011
    Posts
    15
    Qt products
    Qt4
    Platforms
    Windows

    Default glTexImage3D is not declared in the scope.

    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.

    Qt Code:
    1. 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.
    Qt Code:
    1. GLuint texture1D;
    2. glGenTextures(1, &texture1D);
    3. glBindTexture(GL_TEXTURE_1D, texture1D);
    4. glTexImage1D(GL_TEXTURE_1D, 0, 4, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, f);
    5. glActiveTexture(GL_TEXTURE0);
    6. glBindTexture(GL_TEXTURE0,texture1D);
    7. 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

  2. #2
    Join Date
    May 2011
    Posts
    15
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: glTexImage3D is not declared in the scope.

    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

    Qt Code:
    1. PFNGLTEXIMAGE3DPROC glTexImage3D;
    2. glTexImage3D = (PFNGLTEXIMAGE3DPROC) wglGetProcAddress("glTexImage3D");
    To copy to clipboard, switch view to plain text mode 

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

    Anybody help?

  3. #3
    Join Date
    May 2011
    Posts
    15
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: glTexImage3D is not declared in the scope.

    BTW, i use win7 and qtcreator

  4. #4
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: glTexImage3D is not declared in the scope.

    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.

  5. #5
    Join Date
    May 2011
    Posts
    15
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: glTexImage3D is not declared in the scope.

    After a lot of searching i think i am not linking glew right.

    I use qt creator:
    my pro file looks like this
    Qt Code:
    1. LIBS += -lglut32
    2. LIBS += -lglew32
    3. LIBS += -LC:\QtSDK\mingw\lib
    To copy to clipboard, switch view to plain text mode 
    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?

  6. #6
    Join Date
    May 2011
    Posts
    15
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: glTexImage3D is not declared in the scope.

    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

  7. #7
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: glTexImage3D is not declared in the scope.

    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.

Similar Threads

  1. ui not declared in scope
    By steve.bush in forum Newbie
    Replies: 5
    Last Post: 19th March 2011, 08:58
  2. GetFileSizeEx was not declared in this scope
    By Threepwood in forum Qt Programming
    Replies: 2
    Last Post: 8th February 2011, 12:03
  3. `lineEdit' was not declared in this scope?
    By i4ba1 in forum Qt Programming
    Replies: 2
    Last Post: 18th November 2009, 14:36
  4. QDomDocument was not declared in this scope
    By grantbj74 in forum Newbie
    Replies: 5
    Last Post: 25th August 2009, 09:43
  5. Replies: 2
    Last Post: 28th December 2007, 18:30

Tags for this Thread

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.