Results 1 to 12 of 12

Thread: How to sue glMapBuffers/glUnmapBuffer with QGLWidget?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2010
    Posts
    76
    Thanks
    13
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Angry How to sue glMapBuffers/glUnmapBuffer with QGLWidget?

    I am trying to follow the OpenGL Superbible (4th Edition) example (ThunderbirdGL) and they have a function glMapBuffers() in a VBOMesh.cpp file and I can't get that function to be recognized by any header that is included with GL. Am I missing something simple?

    Qt Code:
    1. ///////////////////////////////////////////////////////////////////////////
    2.  
    3. // Scale of the vertices. The only way to do this is to map the VBO back
    4.  
    5. // into client memory, then back again
    6.  
    7. void CVBOMesh::Scale(GLfloat fScaleValue)
    8.  
    9. {
    10.  
    11. glFuncs.glBindBuffer(GL_ARRAY_BUFFER, bufferObjects[VERTEX_DATA]);
    12.  
    13. M3DVector3f *pVertexData = (M3DVector3f *)glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE);
    14.  
    15.  
    16.  
    17. if(pVertexData != NULL)
    18.  
    19. {
    20.  
    21. for(unsigned int i = 0; i < nNumVerts; i++)
    22.  
    23. m3dScaleVector3(pVertexData[i], fScaleValue);
    24.  
    25.  
    26.  
    27. glUnmapBuffer(GL_ARRAY_BUFFER);
    28.  
    29. }
    30.  
    31. }
    To copy to clipboard, switch view to plain text mode 

    The error I see from the compiler is:
    ../shared/VBOMesh.cpp:204: error: 'glMapBuffer' was not declared in this scope
    ../shared/VBOMesh.cpp:211: error: 'glUnmapBuffer' was not declared in this scope

    where shared is the folder that VBOMesh is in.

    http://www.opengl.org/sdk/docs/man/x...lMapBuffer.xml reference for glMapBuffer
    http://www.opengl.org/sdk/docs/man4/...lMapBuffer.xml reference for glUnmapBuffer

    Any help would be awesome! 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: How to sue glMapBuffers/glUnmapBuffer with QGLWidget?

    Did you include GL.h?
    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. The following user says thank you to wysota for this useful post:

    jshafferman (25th October 2013)

  4. #3
    Join Date
    Dec 2010
    Posts
    76
    Thanks
    13
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to sue glMapBuffers/glUnmapBuffer with QGLWidget?

    Yup I still get the same error after I use this include
    #include <GL/gl.h>

    VBOMesh.h has #include <QtOpenGL> passed into it from a different header in case your curious.

    Just an FYI, I am trying to use mostly Qt related stuff because I am doing all my opengl stuff in QGLWidget. Also I am using Qt 4.8.4 because that is the same version we use at my office and eventually we will be doing Opengl stuff in our widget. Finally the reason I am using Opengl Superbible 4th edition is because that is the superbible edition that matches our products opengl capability set (2.0, 2.1, and ES 2.0)
    Last edited by jshafferman; 25th October 2013 at 13:13.

  5. #4
    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: How to sue glMapBuffers/glUnmapBuffer with QGLWidget?

    I never used glMapBuffer so I might be wrong but don't you have to query for this function using dlsym/getprocaddress first?
    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.


  6. The following user says thank you to wysota for this useful post:

    jshafferman (25th October 2013)

  7. #5
    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: How to sue glMapBuffers/glUnmapBuffer with QGLWidget?

    Yes, this function needs to be loaded. I have always used GLEW (The OpenGL Extension Wrangler Library) to load additional functions, simply include glew before gl.h:
    Qt Code:
    1. #include <GL/glew.h>
    2. #include <GL/gl.h>
    3. ...
    To copy to clipboard, switch view to plain text mode 
    and link with -lGLEW.
    More info here : GLEW

  8. The following user says thank you to stampede for this useful post:

    jshafferman (25th October 2013)

Similar Threads

  1. One QGLWidget that manage QGLWidget childs
    By polch in forum Qt Programming
    Replies: 4
    Last Post: 12th December 2012, 11:26
  2. QGLWidget and VBO
    By kaszewczyk in forum Newbie
    Replies: 1
    Last Post: 6th May 2010, 10:04
  3. QGLWidget
    By manmohan in forum Newbie
    Replies: 2
    Last Post: 5th June 2009, 12:54
  4. Can not use QGLWidget.
    By Teuniz in forum Installation and Deployment
    Replies: 3
    Last Post: 25th September 2007, 00:27
  5. QGLWidget bug
    By Wizard in forum Qt Programming
    Replies: 11
    Last Post: 31st August 2007, 11:23

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.