Skip to main content
gamedev.net
🔒 Locked

glActiveTextureARB crash

Started by juanmanuelsanchez Feb 18, 2007 at 4:26 PM 9 replies 4.4k views
Original Post
juanmanuelsanchez
juanmanuelsanchez
Hi all ! Im trying to get this working so I can do some bump maping, sadly I dont know why my program crashes when I load this line glActiveTextureARB(GL_TEXTURE0_ARB); This is what I do to initialize:

PFNGLMULTITEXCOORD2FARBPROC glMultiTexCoord2fARB = NULL;
PFNGLACTIVETEXTUREARBPROC glActiveTextureARB= NULL;
PFNGLACTIVETEXTUREARBPROC glClientActiveTextureARB= NULL;

glActiveTextureARB(GL_TEXTURE0_ARB);


Any ideas ? Btw Im using GLee for the extensions THanks!
cmf
cmf
hm, you're wondering why your programs crashes when you call a NULL-function? ;)
dunno about glee, but you usually have to get the proc address before you can call the function.

like that (when you're using windows):
PFNGLACTIVETEXTUREARBPROC glActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC)wglGetProcAddress((LPCSTR)"glActiveTextureARB");
juanmanuelsanchez
juanmanuelsanchez
yeah I was wondering the same thing but I change it because I saw a sample here at the forums.

Btw the way you said dosent work, still crashes :(
cmf
cmf
#include <GL/gl.h>#include <GL/glu.h>#include <GL/glext.h>#include <GL/wglext.h>

perhaps?
Zipster
Zipster
The GLee homepage says that all you have to do is include Glee.h and link with GLee.lib, and everything should work. No initialization required.
juanmanuelsanchez
juanmanuelsanchez
that was the first thing I tried, include the header, lib is linked, but still dosent work, I get glActiveTextureARB' : undeclared identifier if I dont initialize.
Eitsch
Eitsch
try it without the ARB postfix
ff8
ff8
Have u defined the type PFNGLACTIVETEXTUREARBPROC before using it?

like this :

typedef void (APIENTRY * PFNGLACTIVETEXTUREARBPROC) (GLenum target);

after that u need to define variable glActiveTextureARB like what u did :

PFNGLACTIVETEXTUREARBPROC glActiveTextureARB= NULL;

after that did u init the varible like what cmf said :

PFNGLACTIVETEXTUREARBPROC glActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC)wglGetProcAddress((LPCSTR)"glActiveTextureARB");

btw if u used this way u don't need to include any extension lib,
so u need to do this process for each function u need to use it.
juanmanuelsanchez
juanmanuelsanchez
Even If Im using Glee? that was the point of using it... not having to initialize everything everytime I use it.
ff8
ff8
no u can put all defintion in one header file and make ur one macros and then init
it once per program so it isn't big problem .

benjamin bunny
benjamin bunny
Quote:
Original post by juanmanuelsanchez
that was the first thing I tried, include the header, lib is linked, but still dosent work, I get glActiveTextureARB' : undeclared identifier if I dont initialize.


Don't declare any extension functions yourself. Just #include GLee.h and make sure you've got an OpenGL context before you call any GL functions or use any extension querying variables.

To be extra safe, you can GLeeInit() after you've got your GL context and check whether it returned GL_TRUE (success) or GL_FALSE (failure). If it returns GL_FALSE then you should check the error with GLeeGetErrorString()

Before using an extension function, you should check that your drivers support it by using the GLee querying variable for that extension (e.g. GLEE_ARB_MULTITEXTURE).

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.