PDA

View Full Version : "wglGetProcAddress" won't work



spong3bob
09-09-2010, 02:30 PM
title says everything..
I'm linking the Gl32.lib and GlU32.lib
here's my code:

The .h file


#define GL_GLEXT_PROTOTYPES
#include <Windows.h>
#include <gl/GL.h>
#include <gl/glext.h>
#include <gl/wglext.h>
#include <stdio.h>

extern PFNGLGENFRAMEBUFFERSEXTPROC pglGenFramebuffersEXT; // FBO name generation procedure
extern PFNGLDELETEFRAMEBUFFERSEXTPROC pglDeleteFramebuffersEXT; // FBO deletion procedure
extern PFNGLBINDFRAMEBUFFEREXTPROC pglBindFramebufferEXT; // FBO bind procedure
extern PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC pglCheckFramebufferStatusEXT; // FBO completeness test procedure
extern PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC pglGetFramebufferAttachmentParameterivEXT; // return various FBO parameters
extern PFNGLGENERATEMIPMAPEXTPROC pglGenerateMipmapEXT; // FBO automatic mipmap generation procedure
extern PFNGLFRAMEBUFFERTEXTURE2DEXTPROC pglFramebufferTexture2DEXT; // FBO texdture attachement procedure
extern PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC pglFramebufferRenderbufferEXT; // FBO renderbuffer attachement procedure
// Renderbuffer object
extern PFNGLGENRENDERBUFFERSEXTPROC pglGenRenderbuffersEXT; // renderbuffer generation procedure
extern PFNGLDELETERENDERBUFFERSEXTPROC pglDeleteRenderbuffersEXT; // renderbuffer deletion procedure
extern PFNGLBINDRENDERBUFFEREXTPROC pglBindRenderbufferEXT; // renderbuffer bind procedure
extern PFNGLRENDERBUFFERSTORAGEEXTPROC pglRenderbufferStorageEXT; // renderbuffer memory allocation procedure
extern PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC pglGetRenderbufferParameterivEXT; // return various renderbuffer parameters
extern PFNGLISRENDERBUFFEREXTPROC pglIsRenderbufferEXT; // determine renderbuffer object type

#define glGenFramebuffersEXT pglGenFramebuffersEXT
#define glDeleteFramebuffersEXT pglDeleteFramebuffersEXT
#define glBindFramebufferEXT pglBindFramebufferEXT
#define glCheckFramebufferStatusEXT pglCheckFramebufferStatusEXT
#define glGetFramebufferAttachmentParameterivEXT pglGetFramebufferAttachmentParameterivEXT
#define glGenerateMipmapEXT pglGenerateMipmapEXT
#define glFramebufferTexture2DEXT pglFramebufferTexture2DEXT
#define glFramebufferRenderbufferEXT pglFramebufferRenderbufferEXT

#define glGenRenderbuffersEXT pglGenRenderbuffersEXT
#define glDeleteRenderbuffersEXT pglDeleteRenderbuffersEXT
#define glBindRenderbufferEXT pglBindRenderbufferEXT
#define glRenderbufferStorageEXT pglRenderbufferStorageEXT
#define glGetRenderbufferParameterivEXT pglGetRenderbufferParameterivEXT
#define glIsRenderbufferEXT pglIsRenderbufferEXT

extern void InitFBO();


And the .cpp file:


PFNGLGENFRAMEBUFFERSEXTPROC pglGenFramebuffersEXT = 0; // FBO name generation procedure
PFNGLDELETEFRAMEBUFFERSEXTPROC pglDeleteFramebuffersEXT = 0; // FBO deletion procedure
PFNGLBINDFRAMEBUFFEREXTPROC pglBindFramebufferEXT = 0; // FBO bind procedure
PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC pglCheckFramebufferStatusEXT = 0; // FBO completeness test procedure
PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC pglGetFramebufferAttachmentParameterivEXT = 0; // return various FBO parameters
PFNGLGENERATEMIPMAPEXTPROC pglGenerateMipmapEXT = 0; // FBO automatic mipmap generation procedure
PFNGLFRAMEBUFFERTEXTURE2DEXTPROC pglFramebufferTexture2DEXT = 0; // FBO texdture attachement procedure
PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC pglFramebufferRenderbufferEXT = 0; // FBO renderbuffer attachement procedure
// Renderbuffer object
PFNGLGENRENDERBUFFERSEXTPROC pglGenRenderbuffersEXT = 0; // renderbuffer generation procedure
PFNGLDELETERENDERBUFFERSEXTPROC pglDeleteRenderbuffersEXT = 0; // renderbuffer deletion procedure
PFNGLBINDRENDERBUFFEREXTPROC pglBindRenderbufferEXT = 0; // renderbuffer bind procedure
PFNGLRENDERBUFFERSTORAGEEXTPROC pglRenderbufferStorageEXT = 0; // renderbuffer memory allocation procedure
PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC pglGetRenderbufferParameterivEXT = 0; // return various renderbuffer parameters
PFNGLISRENDERBUFFEREXTPROC pglIsRenderbufferEXT = 0; // determine renderbuffer object type

void InitFBO()
{
glGenFramebuffersEXT = (PFNGLGENFRAMEBUFFERSEXTPROC)wglGetProcAddress("glGenFramebuffersEXT");
glDeleteFramebuffersEXT = (PFNGLDELETEFRAMEBUFFERSEXTPROC)wglGetProcAddress("glDeleteFramebuffersEXT");
glBindFramebufferEXT = (PFNGLBINDFRAMEBUFFEREXTPROC)wglGetProcAddress("glBindFramebufferEXT");
glCheckFramebufferStatusEXT = (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC)wglGetProcAddr ess("glCheckFramebufferStatusEXT");
glGetFramebufferAttachmentParameterivEXT = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC)w glGetProcAddress("glGetFramebufferAttachmentParameterivEXT");
glGenerateMipmapEXT = (PFNGLGENERATEMIPMAPEXTPROC)wglGetProcAddress("glGenerateMipmapEXT");
glFramebufferTexture2DEXT = (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC)wglGetProcAddres s("glFramebufferTexture2DEXT");
glFramebufferRenderbufferEXT = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC)wglGetProcAdd ress("glFramebufferRenderbufferEXT");
glGenRenderbuffersEXT = (PFNGLGENRENDERBUFFERSEXTPROC)wglGetProcAddress("glGenRenderbuffersEXT");
glDeleteRenderbuffersEXT = (PFNGLDELETERENDERBUFFERSEXTPROC)wglGetProcAddress ("glDeleteRenderbuffersEXT");
glBindRenderbufferEXT = (PFNGLBINDRENDERBUFFEREXTPROC)wglGetProcAddress("glBindRenderbufferEXT");
glRenderbufferStorageEXT = (PFNGLRENDERBUFFERSTORAGEEXTPROC)wglGetProcAddress ("glRenderbufferStorageEXT");
glGetRenderbufferParameterivEXT = (PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC)wglGetProc Address("glGetRenderbufferParameterivEXT");
glIsRenderbufferEXT = (PFNGLISRENDERBUFFEREXTPROC)wglGetProcAddress("glIsRenderbufferEXT");
if(glGenFramebuffersEXT)
{
printf("FPO supported");
}else
printf("FPO not supported");
}


always get: "FPO not supported"..

ZbuffeR
09-09-2010, 02:58 PM
Try with glGenRenderbuffersARB