问题
I have an "access violation" on the Frame Buffer Object (FBO)'s command glGenFramebuffersEXT :
void TGLForm::DrawScene()
{
wglMakeCurrent(ghDC, ghRC);
glEnable(GL_TEXTURE_2D);
GLuint framebuffer, texturefbo;
GLenum status;
glGenFramebuffersEXT(1, &framebuffer); // access violation here
Founding a help thread concerning the FBOs, I checked that the glext.h initialization were okay and repeated amidst the preprocessor lines this way :
#include "glext.h"
#include "wglext.h"
extern PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT = (PFNGLGENFRAMEBUFFERSEXTPROC)wglGetProcAddress("glGenFramebuffersEXT");
extern PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXT = (PFNGLBINDFRAMEBUFFEREXTPROC)wglGetProcAddress("glBindFramebufferEXT");
extern PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT = (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC)wglGetProcAddress("glFramebufferTexture2DEXT");
extern PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT = (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC)wglGetProcAddress("glCheckFramebufferStatusEXT");
extern PFNGLGENRENDERBUFFERSEXTPROC glGenRenderbuffersEXT = (PFNGLGENRENDERBUFFERSEXTPROC)wglGetProcAddress("glGenRenderbuffersEXT");
extern PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT = (PFNGLBINDRENDERBUFFEREXTPROC)wglGetProcAddress("glBindRenderbufferEXT");
extern PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXT = (PFNGLRENDERBUFFERSTORAGEEXTPROC)wglGetProcAddress("glRenderbufferStorageEXT");
extern PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC)wglGetProcAddress("glFramebufferRenderbufferEXT");
=> The access violation remains.
Another help thread induced me to download the NVIDIA OpenGL SDK's because I have a GT9800 Nvidia card : it didn't remove the "access violation".
I tried using GLee and Glew in Borland Builder 6 :
to include Glew in Borland it is first needed to convert Visual Studio "coff" lib from coff to borland builder "omf" lib,
but with the borland command script "coff2omf.exe" I get this error label : "invalid machine type" - and with "objconv.exe" I get this error : "import library cannot convert to static library".
=> does someone know how I may manage to convert the Glew "coff" lib to the Borland Builder format "omf" successfully ?
=> how can we convert an "import library" to a "static library" ?
回答1:
download and use GLEW .h,.c source code
#define GLEW_STATIC #include "gl\glew.c" // ~900KB file !!!
- I am using it for many years inside borland source without any problems
- if you have problems with include path then just use relative paths
do not forget to init glew first
glewInit();
- of course your OpenGL must be initialized prior to this !!!
check if you have FBO support
if (glGenFramebuffersEXT==NULL) error ...
FBO usage
- if all is OK
- then you still can have access violations !!!
- if FBO not used properly ...
- but this is not your case yet ...
来源:https://stackoverflow.com/questions/5714247/using-frame-buffer-objects-fbo-in-borland-c-builder-6