Call ogl ext functions but return null?

I called an ogl ext function(that func can be supported in opengl1.2) in a win32 console application program(,but I was notified that pointer(glTexImage3D) to the function returns null, why?
I call the funcproc in this way…
#include “windows.h”
#include “gl.h”
#include “glu.h”

#ifdef _WIN32
typedef void(APIENTRY* PFNGLTEXIMAGE3DEXTPROC)(GLenum target, Glint level,…);

#ifdef _WIN32

can someone help me? thanks…

wglGetProcAddress wants a string as argument.
You are passing the pointer you want to get filled, which initially, at best, is NULL.
So this should do it:


sorry, i made a mistake…
I do have used wglGetProcAddress(“glTexImage3D”);
I am puzzled…

Did you set up your OpenGL context before trying to get the extension function pointer?
There must be a valid active OpenGL context. Otherwise wglGetProcAddress fails.
A very common mistake…

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.