PDA

View Full Version : problem with glGenBuffersARB



Max Steel
05-05-2011, 11:22 AM
i use VS 2010 and when i execute the program, console window stops working. so i executed in debug mode and the break is hit at this line


glGenBuffersARB(1, &pbo);

here is the code snippet


GLuint pbo;
glGenBuffersARB(1, &pbo);
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, pbo);
glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, width*height*sizeof(GLubyte)*4, myimage, GL_STREAM_DRAW_ARB);
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0);

i have put glew version 1.5, copied the dll, header, lib files in the right places. i have no compilation errors at all.

i just dont understand whats wrong. PLEASE HELP...

carsten neumann
05-05-2011, 11:43 AM
Do you correctly initialize glew (and does the init succeed)?
Do you (successfully) create an OpenGL context before the posted snippet and is the context active at that point in the code?
Does the context support the extension you are trying to use (e.g. ARB_vertex_buffer_object)?

Max Steel
05-05-2011, 12:21 PM
ok i didnt know about glewinit, i googled it and added this code to my code



GLenum err = glewInit();
if (GLEW_OK != err)
{
fprintf(stderr, "your error is : %s\n", glewGetErrorString(err));
}
fprintf(stdout, "Status: Using GLEW %s\n", glewGetString(GLEW_VERSION));



and in the output i am getting


your error is: missing GL version
status: using GLEW 1.5.7

and in the watch tab the error given is

glGenBuffersARB CXX0017: Error: symbol "glGenBuffersARB" not found


Do you (successfully) create an OpenGL context before the posted snippet and is the context active at that point in the code?

no i havent created any context. and what should i do know.

DarkGKnight
05-05-2011, 02:21 PM
no i havent created any context. and what should i do know.

You should read any tutorial on creating an OpenGL rendering context. glewInit() is called once the context is created, not before. The OpenGL wiki has an example (http://opengl.org/wiki/Tutorial1:_Creating_a_Cross_Platform_OpenGL_3.2_Co ntext_in_SDL_(C_/_SDL)) of how to create a context with SDL.