Using Frame Buffer Objects (FBO) in Borland C++ Builder 6

旧时模样 提交于 2019-12-24 03:03:27

问题


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:


  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
  2. do not forget to init glew first

    glewInit();
    
    • of course your OpenGL must be initialized prior to this !!!
  3. check if you have FBO support

    if (glGenFramebuffersEXT==NULL) error ...
    
  4. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!