Results 1 to 4 of 4

Thread: 'GLint' does not name a type

  1. #1
    Join Date
    Jan 2011
    Posts
    212
    Thanks
    24
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default 'GLint' does not name a type

    Hello forum,

    I am trying to make a simple modern opegl application with qt5. I have defined the
    Qt Code:
    1. QT += opengl
    To copy to clipboard, switch view to plain text mode 
    inside the .pro file.

    Then inside the class declaration i am declaring a variable as follows:

    Qt Code:
    1. class scene : pulic abstractscene
    2. {
    3. Q_OBJECT
    4.  
    5. public:
    6. .......................
    7. .......................
    8. private:
    9.  
    10. GLint vertices;
    11. }
    To copy to clipboard, switch view to plain text mode 

    I am getting the error at "GLint vertices" with the message mentioned in the title.

    Any clue ?


    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: 'GLint' does not name a type

    You are missing
    Qt Code:
    1. #include <GL.h>
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jan 2011
    Posts
    212
    Thanks
    24
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: 'GLint' does not name a type

    Thanks

    There is another class and i am declaring a variable of type GLuint and the compiler is not complaining at all.

    Any explanation that this particular class needs this inclusion. Details of the class definition are provided in the following:

    Qt Code:
    1. #ifndef TESSELLATIONSCENE_H
    2. #define TESSELLATIONSCENE_H
    3.  
    4. #include <GL/gl.h>
    5. #include "defines.h"
    6. #include "AbstractScene.h"
    7.  
    8. class QOpenGLFunctions_4_3_Core;
    9.  
    10. class GLSLShader;
    11.  
    12. class TeapotVboPatch;
    13.  
    14. class TessellationScene : public AbstractScene
    15. {
    16. Q_OBJECT
    17.  
    18. public:
    19.  
    20. TessellationScene(QObject *parent = 0);
    21.  
    22. ~TessellationScene();
    23.  
    24. //scene related functions
    25. virtual void initialise();
    26. virtual void update(float t);
    27. virtual void render();
    28. virtual void resize(int w, int h);
    29.  
    30. private:
    31.  
    32. void loadShaders();
    33.  
    34. QOpenGLFunctions_4_3_Core *mFuncs;
    35.  
    36. GLSLShader *mTessellationShader;
    37.  
    38. TeapotVboPatch *mTeapotPatch;
    39.  
    40. //hold the maximum number of vertices
    41. //inside a patch
    42. GLint mMaxPatchVertices;
    43. };
    44.  
    45. #endif // TESSELLATIONSCENE_H
    To copy to clipboard, switch view to plain text mode 

    As you can see above that the class definition contains the inclusion of GL/gl.h after your suggestion and now please check the following class structure:

    Qt Code:
    1. #ifndef TEAPOTVBOPATCH_H
    2. #define TEAPOTVBOPATCH_H
    3.  
    4. #include "defines.h"
    5. #include "teapotdata.h"
    6.  
    7. class QOpenGLFunctions_4_3_Core;
    8. class GLSLShader;
    9.  
    10. class TeapotVboPatch
    11. {
    12. private:
    13. GLuint mTeapotVAOID;
    14. GLuint mTeapotBufferID;
    15.  
    16. QOpenGLFunctions_4_3_Core *mTeapotRenderFunc;
    17.  
    18. void generatePatches(float *v);
    19. void buildPatchReflect(int patchNum,
    20. float *v,
    21. int &index,
    22. bool reflectX,
    23. bool reflectY);
    24.  
    25. void buildPatch(glm::vec3 patch[][4],
    26. float *v,
    27. int &index,
    28. glm::mat3 reflect);
    29.  
    30. void getPatch(int patchNum,glm::vec3 patch[][4],bool reverseV);
    31.  
    32. public:
    33.  
    34. TeapotVboPatch(GLSLShader *);
    35. ~TeapotVboPatch();
    36.  
    37. void render(GLSLShader *shader);
    38.  
    39. };
    40.  
    41. #endif // TEAPOTVBOPATCH_H
    To copy to clipboard, switch view to plain text mode 

    The compiler did not complain at all for the TeapotVboPatch class even though i have declaration of GLuint type without the inclusion of GL/gl.h.

    Why is that so ?

    Thanks

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: 'GLint' does not name a type

    The declaration of the GLuint type could come from one of the other includes or the TeapotVboPatch header is always included after includes that bring in the type.

    Cheers,
    _

Similar Threads

  1. Replies: 2
    Last Post: 27th November 2013, 01:56
  2. Replies: 7
    Last Post: 19th April 2011, 13:20
  3. Replies: 2
    Last Post: 22nd December 2009, 21:52
  4. what is type?
    By gfunk in forum Qt Programming
    Replies: 4
    Last Post: 12th August 2006, 18:40
  5. Type and User Type
    By campana in forum Qt Programming
    Replies: 1
    Last Post: 28th February 2006, 00:22

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.