Results 1 to 4 of 4

Thread: Why do I get a memory exception when trying to create an FBO? Please help!

  1. #1
    Junior Member Newbie
    Join Date
    May 2007
    Posts
    3

    Why do I get a memory exception when trying to create an FBO? Please help!

    I'm very new to OpenGL (and I don't know anything about glew or glut), but I'm trying to follow some examples on how to create a framebuffer object (for rendering to a texture).

    I'm using BlitzMax which is a wrapper around OpenGL but everything else works except when I try to use a framebuffer object.

    Do I have to somehow enable the framebuffer extension somehow? I thought the very first call to initialize an FBO was glGenFramebuffersEXT(). Am I wrong?

    Here is my code:
    Code :
    Import Pub.Glew
     
    'SetGraphicsDriver(GLGraphicsDriver())
    GLGraphics(320, 200)
     
    GlewInit()
     
    ' Laptop = OpenGL v1.5
    ' Laptop = ARB_multitexture present!
     
    Enable2D()
     
    glEnable(GL_LINE_SMOOTH)
    glEnable(GL_POLYGON_SMOOTH)
    glEnable(GL_ALPHA_TEST)
    glEnable(GL_BLEND)
     
    glHint(GL_LINE_SMOOTH_HINT, GL_NICEST)
    glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST)
    glHint(GL_POINT_SMOOTH_HINT, GL_NICEST)
     
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
     
    ' *************************
     
    Local fbo : Int Ptr; 
    glGenFramebuffersEXT(1, fbo); 
     
    ' *************************
     
    glClearColor(0.0, 0.0, 0.0, 0.0)
     
    While Not KeyHit(KEY_ESCAPE)
    	glClear(GL_COLOR_BUFFER_BIT| GL_DEPTH_BUFFER_BIT);
     
    	glBegin(GL_LINES)
    		glVertex2i(0 , 0)
    		glVertex2i(320, 200)
    	glEnd()
     
      Flip()
    Wend
     
    Function Enable2D()
    	Local vPort : Int[4]
      glGetIntegerv(GL_VIEWPORT, vPort);
     
      glMatrixMode(GL_PROJECTION) ; 
      glLoadIdentity();
    	glOrtho(0, vPort[2], vPort[3], 0, -1, 1) ; 
     
    	glMatrixMode(GL_MODELVIEW) ;
    	glLoadIdentity();		
    End Function
    The memory exception is occuring on the glGenFramebufferEXT() line.

    Supposedly the way to check for the FBO extension support is this:
    Code :
    If glGenFramebuffersEXT=Null Notify "Your computer doesn't support FBOs"
    This code works so it looks like my video card DOES support FBOs so I must be doing something wrong.

    Please help :\

  2. #2
    Senior Member OpenGL Pro
    Join Date
    May 2000
    Location
    Naarn, Austria
    Posts
    1,102

    Re: Why do I get a memory exception when trying to create an FBO? Please help!

    Code :
    Local fbo : Int Ptr; 
    glGenFramebuffersEXT(1, fbo);
    Your variable "fbo" propably contains a null pointer here.

    I'm not really fluent in basic, but I think it should rather be:
    Code :
    Local fbo : Int;
    glGenFramebuffersEXT(1, VarPtr(fbo));
    I'm not sure about that VarPtr part, substitute whatever is used to get the address of a variable in your language...

  3. #3
    Junior Member Newbie
    Join Date
    May 2007
    Posts
    3

    Re: Why do I get a memory exception when trying to create an FBO? Please help!

    I've tried what you suggested above but that doesn't work either

    Maybe my video card doesn't have support for the framebuffer extension?

  4. #4
    Senior Member OpenGL Pro
    Join Date
    May 2000
    Location
    Naarn, Austria
    Posts
    1,102

    Re: Why do I get a memory exception when trying to create an FBO? Please help!

    1) What's the content of your extension string?
    2) What's your video card?

    If glGenFramebuffersEXT=Null Notify "Your computer doesn't support FBOs"
    You cannot reliably test extension support that way. You have to look at the extension string. Glew does this for you, you just have to check the GLEW_EXT_framebuffer_object flag.

Similar Threads

  1. glMapBufferRange causes out of memory exception
    By mlop3s in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 01-29-2016, 05:39 AM
  2. glTexImage3D Memory Access Exception
    By Live_MusIc in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 10-18-2014, 12:27 PM
  3. Replies: 7
    Last Post: 09-10-2013, 05:23 AM
  4. Replies: 3
    Last Post: 02-13-2013, 08:25 AM
  5. Replies: 7
    Last Post: 11-21-2012, 11:22 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean