Hi everyone!
How are you doing?
Right now, I am struggling having a serious problem with VBO… any help will be greatly appreciated
All my engine is Display-List based and I am now implemmenting my Terrain to be drawn apart with VBO’s (VBO’s alone, not inside a display list).
The VBO code has been tested on a stand alone app and it works perfectly using Glee for defining VBO’s.
However, I have now embeeded that code into my own engine, without using Glee and defining my own virtual functions as I do for the rest of the extensions, and my app crashes.
The weird part is where where it crashes. After debugging I found out that the function that triggers the crash is where I am building the FBO: buildBufferObjectVertexArrays.
However, the crash appears not in that function, but in a function that has nothing to do with FBO’s nor my Terrain: that is the function I use to render my other objects with Display List’s:
glCallList(this->DisplayListID);
//I get an access violation trigerred on this line , on a memory address that does not correspond to "this" object (I wasn't able to track where this memory address is from). The 'this' object is perfectly fine, as has all correct values at the debugging moment.
The mistery is that if I comment the buildBufferObjectVertexArrays function out, everything works perfectly fine.
Therefore I suspect:
- VBO’s and Display List cannot be used together in the same app?!!?
- More probably, I defined the virtual functions badly?! Could that cause a problem of this scope?!
What do you guys think!? GL_CHECK_ERROR returns nothing.
Special Note: Some functions in the original code where for example “glGenBuffers” (without ‘ARB’). However, as I found in the internet the definition for glGenBuffersARB, I replaced all glGenBuffers for glGenBuffersARB. I suspect this generates no problem, does it? I am using both ARB and no-ARB for VBO functions.
Thanks so much in advance,
Any tip, or hint, will be appreciated
Rod
This is my extensions code:
//HEADER .h:
typedef void (APIENTRY * PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer);
typedef void (APIENTRY * PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers);
typedef void (APIENTRY * PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers);
typedef void (APIENTRY * PFNGLBUFFERDATAARBPROC) (GLenum target, int size, const GLvoid *data, GLenum usage);
extern PFNGLGENBUFFERSARBPROC glGenBuffersARB ; // VBO Name Generation Procedure
extern PFNGLBINDBUFFERARBPROC glBindBufferARB ; // VBO Bind Procedure
extern PFNGLBUFFERDATAARBPROC glBufferDataARB ; // VBO Data Loading Procedure
extern PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARB ; // VBO Deletion Procedure
typedef GLvoid* (APIENTRY* PFNGLMAPBUFFERPROC) (GLenum target, GLenum access);
typedef GLboolean (APIENTRY* PFNGLUNMAPBUFFERPROC) (GLenum target);
extern PFNGLMAPBUFFERPROC glMapBuffer ;
extern PFNGLUNMAPBUFFERPROC glUnmapBuffer ;
//SOURCE .cpp
PFNGLGENBUFFERSARBPROC glGenBuffersARB = NULL; // VBO Name Generation Procedure
PFNGLBINDBUFFERARBPROC glBindBufferARB = NULL; // VBO Bind Procedure
PFNGLBUFFERDATAARBPROC glBufferDataARB = NULL; // VBO Data Loading Procedure
PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARB = NULL; // VBO Deletion Procedure#endif
PFNGLMAPBUFFERPROC glMapBuffer =NULL;
PFNGLUNMAPBUFFERPROC glUnmapBuffer =NULL;
void InitVBO
{
glGenBuffersARB = (PFNGLGENBUFFERSARBPROC) extgl_GetProcAddress("glGenBuffersARB");
glBindBufferARB = (PFNGLBINDBUFFERARBPROC) extgl_GetProcAddress("glBindBufferARB");
glBufferDataARB = (PFNGLBUFFERDATAARBPROC) extgl_GetProcAddress("glBufferDataARB");
glDeleteBuffersARB = (PFNGLDELETEBUFFERSARBPROC) extgl_GetProcAddress("glDeleteBuffersARB");
glMapBuffer = (PFNGLMAPBUFFERPROC) extgl_GetProcAddress("glMapBuffer");
glUnmapBuffer = (PFNGLUNMAPBUFFERPROC) extgl_GetProcAddress("glUnmapBuffer");
}