View Full Version : need help with glew
tinerin
04-14-2006, 02:50 AM
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?
ZbuffeR
04-14-2006, 09:37 AM
WHAT error ? compile ? link ? run ? ... ? with which message ?
tinerin
04-14-2006, 10:39 AM
When I try to run it, a message pops up saying that it encountered a problem and needs to close.
brtnrdr
04-14-2006, 07:43 PM
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.
tinerin
04-15-2006, 02:46 AM
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.
ZbuffeR
04-15-2006, 09:27 AM
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. (http://www.mozilla.com/firefox/)
Back to the topic, run your prog with a debugger, and post the exact message.
jtipton
04-18-2006, 07:13 AM
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.
jtipton
04-18-2006, 07:25 AM
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.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.