Jump to content
  • Advertisement
Sign in to follow this  
mlt

glGenFramebuffersEXT crash

This topic is 3584 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

In some code where I create a Frame Buffer object I have:
class FBO {
...
      static GLuint create()
      {
        GLuint id = 0;
        glGenFramebuffersEXT(1, &id);
        return id;
      }
...
};


But when the line: glGenFramebuffersEXT(1, &id); gets executed the application crashes (found this with the debugger). Another post on the forum deals with the same problem: http://www.gamedev.net/community/forums/topic.asp?topic_id=386881 but cannot see how I can used the proposed solution. Why does the above line result in a crash? EDIT: I have found another post on the forum: http://www.gamedev.net/community/forums/topic.asp?topic_id=417657 I have now tried:
class FBO {
...
      static GLuint create()
      {
        GLuint id = 0;
        glGenFramebuffersEXT = (PFNGLGENFRAMEBUFFERSEXTPROC)wglGetProcAddress("glGenFramebuffersEXT");
        glGenFramebuffersEXT(1, &id);
        return id;
      }
...
};

but I still get the same error. Any hints are still appreciated!

Share this post


Link to post
Share on other sites
Advertisement
Maybe it's called before you have a proper OpenGL Render Context set up, things tend to crash if you don't have one.
And did you check that your symbol ("glGenFramebuffersEXT") isn't NULL?

Share this post


Link to post
Share on other sites
Could you be more specific? I create an instance of FBO in an application class as a field:


class App {

protected:
...
...
FBO fbo;
...
...



the fbo object never gets created because of the crash when

glGenFramebuffersEXT(1, &id)

is called.

Share this post


Link to post
Share on other sites
Quote:
Original post by V-man
http://www.opengl.org/wiki/index.php/Common_Mistakes#The_Object_Oriented_Language_Problem

also ready the basics
http://www.opengl.org/wiki/index.php/Getting_started


I have tried to call:

glewInit();

But I still get the same crash.

EDIT:
Ok the glewInit() call actually returns an error, but I don't know how to fix it. The problems seems to be that the FBO object fbo cannot be field in the class App. If I move the creation of fbo to a function inside App it works. But then I can only use fbo inside that function!

[Edited by - mlt on December 28, 2008 1:50:05 PM]

Share this post


Link to post
Share on other sites
Like the link says, if there is no GL context, then it won't work.
wglGetProcAddress won't work and will just return NULL.
glewInit won't work because it also uses wglGetProcAddress to get all the addresses for all the GL functions.

wglGetCurrentContext() will however work and tell you what the GL context is. Most likely there is none and it returns NULL.

Share this post


Link to post
Share on other sites
If I create the field as a pointer to a FBO object it works. So the solution is to create a pointer (and then use new when I need to use the FBO) instead of a non-pointer field.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!