Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 8 of 8

Thread: need help with glew

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2006
    Location
    berkeley, ca
    Posts
    6

    need help with glew

    I'm trying to use glew so that I can write to framebuffers. Even though I include glew.h, trying to use glew functions causes an error.
    important parts of code:

    #include <GL\glew.h>
    #include <GL\glut.h>
    #include <Cg\cgGL.h>

    #pragma comment(lib, "glew32.lib")
    #pragma comment(lib, "cg.lib")
    #pragma comment(lib, "cggl.lib")

    int err = glewInit(); // works fine
    if (GLEW_OK != err) exit(-1);

    GLuint fb;
    glGenFramebuffersEXT(1, &fb); // causes error

    can anyone help me?

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,655

    Re: need help with glew

    WHAT error ? compile ? link ? run ? ... ? with which message ?

  3. #3
    Junior Member Newbie
    Join Date
    Apr 2006
    Location
    berkeley, ca
    Posts
    6

    Re: need help with glew

    When I try to run it, a message pops up saying that it encountered a problem and needs to close.

  4. #4
    Intern Newbie
    Join Date
    Jan 2005
    Posts
    35

    Re: need help with glew

    What happens exactly? Could be drivers, could be the version of glew you're using.

    You should also probably link to opengl32.lib glut32.lib and possible glu32.lib for good practice.

  5. #5
    Junior Member Newbie
    Join Date
    Apr 2006
    Location
    berkeley, ca
    Posts
    6

    Re: need help with glew

    I using the latest version of glew available on the website...
    What happens is a window pops up saying there was an error (the same window that appears with Internet Explorer sometimes)

    also when i do this:

    glTexImage3D = (PFNGLTEXIMAGE3DPROC) wglGetProcAddress("glTexImage3D");
    glGenFramebuffersEXT = (PFNGLGENFRAMEBUFFERSEXTPROC) wglGetProcAddress("glGenFramebuffersEXT");

    the top function will work fine but the bottom function still gets the same error.

  6. #6
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,655

    Re: need help with glew

    What happens is a window pops up saying there was an error (the same window that appears with Internet Explorer sometimes)
    Sorry but you really made me laugh, try using a real browser instead.

    Back to the topic, run your prog with a debugger, and post the exact message.

  7. #7
    Intern Contributor
    Join Date
    Apr 2005
    Posts
    98

    Re: need help with glew

    GLEW has been know to leave some functions uninitialized. Check that the function pointer for glGenFramebuffersEXT is actually being initialized and that the extension is present. If the call to get the proc address is giving you NULL, then the extension isn't present. You can also check the extension string yourself, or use the GLEW macros to check for the extension.

  8. #8
    Intern Contributor
    Join Date
    Apr 2005
    Posts
    98

    Re: need help with glew

    One other thing to consider is that windows returns a function pointer that is specific to the context that was current at the time of the call. If you are calling this method from another context, it could cause problems. Function entry points for windows cannot be assumed to work across contexts.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •