Original Post
Ok I dont fucking get it.
I have a global variable
Then after I have created my window and initialized opengl I call the function buildBoxPrim()
I have commented the function because I though they were making my program crash but no. It is glGenBuffersARB. I don't know why this happens. No other VBO functions are called.
This is my vertex class.
I used a function I found @ opengl's site to check if I supported VBO and I did .
Tried including glext.h didn't help. Then I went to nehe's site and added the following to my code
Still didn't work :S. What am I doing wrong here.
I have a global variable
unsigned int boxVBO;
//unsigned int boxVBO = 0; //still doesnt work
Then after I have created my window and initialized opengl I call the function buildBoxPrim()
SVertex *vertices = new SVertex[20];
vertices[0].Fill(-1.0f, -1.0f, -1.0f);
vertices[1].Fill( 1.0f, -1.0f, -1.0f);
vertices[2].Fill( 1.0f, -1.0f, 1.0f);
vertices[3].Fill(-1.0f, -1.0f, 1.0f);
vertices[4].Fill(-1.0f, -1.0f, 1.0f);
vertices[5].Fill( 1.0f, -1.0f, 1.0f);
vertices[6].Fill( 1.0f, 1.0f, 1.0f);
vertices[7].Fill(-1.0f, 1.0f, 1.0f);
vertices[8].Fill(-1.0f, -1.0f, -1.0f);
vertices[9].Fill(-1.0f, 1.0f, -1.0f);
vertices[10].Fill( 1.0f, 1.0f, -1.0f);
vertices[11].Fill( 1.0f, -1.0f, -1.0f);
vertices[12].Fill( 1.0f, -1.0f, -1.0f);
vertices[13].Fill( 1.0f, 1.0f, -1.0f);
vertices[14].Fill( 1.0f, 1.0f, 1.0f);
vertices[15].Fill( 1.0f, -1.0f, 1.0f);
vertices[16].Fill(-1.0f, -1.0f, -1.0f);
vertices[17].Fill(-1.0f, -1.0f, 1.0f);
vertices[18].Fill(-1.0f, 1.0f, 1.0f);
vertices[19].Fill(-1.0f, 1.0f, -1.0f);
glGenBuffersARB( 1, &boxVBO );//get VBO name
//glBindBufferARB( GL_ARRAY_BUFFER_ARB, boxVBO ); // Bind The Buffer
//glBufferDataARB( GL_ARRAY_BUFFER_ARB, 20*3*sizeof(float), vertices, GL_STATIC_DRAW_ARB );
delete []vertices;
vertices = NULL;
I have commented the function because I though they were making my program crash but no. It is glGenBuffersARB. I don't know why this happens. No other VBO functions are called.
This is my vertex class.
struct SVertex
{
GLfloat x, y, z;
void Fill(float _x, float _y, float _z){
x = _x;y = _y;z = _z;
}
};
I used a function I found @ opengl's site to check if I supported VBO and I did .
Tried including glext.h didn't help. Then I went to nehe's site and added the following to my code
#define GL_ARRAY_BUFFER_ARB 0x8892
#define GL_STATIC_DRAW_ARB 0x88E4
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);
// VBO Extension Function Pointers
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
Still didn't work :S. What am I doing wrong here.