在Borland C ++ Builder 6中使用帧缓冲区对象(FBO) [英] Using Frame Buffer Objects (FBO) in Borland C++ Builder 6
问题描述
我在帧缓冲区对象(FBO)的命令glGenFramebuffersEXT上遇到访问冲突:
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
建立了一个有关FBO的帮助线程,我检查了glext.h的初始化没问题,并且可以在预处理器行中以这种方式重复:
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.
另一个帮助线程促使我下载NVIDIA OpenGL SDK,因为我有一张GT9800 Nvidia卡:它没有消除访问冲突。
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".
我尝试使用GLee和Borland Builder 6中的Glew:
I tried using GLee and Glew in Borland Builder 6 :
-
要在Borland中包括Glew,首先需要将Visual Studio coff lib转换为coff到borland生成器 omf库,
to include Glew in Borland it is first needed to convert Visual Studio "coff" lib from coff to borland builder "omf" lib,
,但是使用borland命令脚本 coff2omf.exe,我得到此错误标签:无效的计算机类型-并使用 objconv.exe出现此错误:导入库无法转换为静态库。
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".
= >有人知道我如何成功将Glew coff lib转换为Borland Builder格式 omf吗?
=> 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" ?
推荐答案
-
下载并使用GLEW .h,。 c源代码
#define GLEW_STATIC
#include "gl\glew.c" // ~900KB file !!!
- 我在borland源中使用了很多年,没有任何问题
- 如果包含路径有问题,则只需使用相对路径
不要忘记先初始化错误
glewInit();
- 当然,您的OpenGL必须在此之前初始化! / li>
- of course your OpenGL must be initialized prior to this !!!
检查是否有FBO支持
if (glGenFramebuffersEXT==NULL) error ...
-
FBO使用率
FBO usage
- 如果一切正常
- 那么您仍然会遇到访问冲突!!!
- 如果FBO使用不当...
- 但这还不是您的情况...
- if all is OK
- then you still can have access violations !!!
- if FBO not used properly ...
- but this is not your case yet ...
这篇关于在Borland C ++ Builder 6中使用帧缓冲区对象(FBO)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!