Sign in to follow this  

help understanding VBO

This topic is 3728 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everyone, I'm trying to get to grips with VBO's but am having no luck. First let me say I'm using Linux and a Nvdia 6600 card, so hope these are OK for VBOs? I've read every tutorial I can find (not many) and tried every peice of example code, none work! What I've done in my own code is set up from some code I cut and pasted all the
/* VBO Extension Definitions, From glext.h*/
#define GL_ARRAY_BUFFER_ARB 0x8892
#define GL_STATIC_DRAW_ARB 0x88E4

typedef void (APIENTRY * PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer);
 etc

I've set up a basic triangle with
GLfloat Vertices[] = {0.0, 1.0, -10.0, -1.0, -1.0, -10.0, 1.0, -1.0, -10.0};
GLuint id = 0;
I then think I produce a buffer on starting my code with
glEnable(GL_VERTEX_ARRAY);
glGenBuffersARB(1,&id);
glBindBufferARB(GL_ARRAY_BUFFER_ARB,id);
glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(GLfloat)*9, Vertices, GL_STATIC_DRAW_ARB);
Then in my draw loop I thought I as drwaing the object with
glBindBufferARB(GL_ARRAY_BUFFER_ARB, id);

glEnableClientState(GL_VERTEX_ARRAY);                
glVertexPointer(3, GL_FLOAT, 0, 0);                  
glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_BYTE, 0);
glDisableClientState(GL_VERTEX_ARRAY);        

glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
I'm having real problems with these, every example seems to be diffrent even the Nehe tutorial crashes my PC. Can anyone help me out please. Thanks in advance. I should add the code compiles but I get segmentation faults pretty much from the start so even glGenBuffersARB(1,&id); creates a segmentation fault :s

Share this post


Link to post
Share on other sites
thanks that's one of the ones I tried, infact if you look at my VBO's they look (?) identicle to the VBO example.

What I can't understand is why even glGenBuffersARB crashes my system? Do I need to install some package in Linux (debian) or do I need some new lib in my makefile?

I cut and pasted all the arb extentions from the nehe example perhaps the values have changed. Sorry I'm clutching at straws a bit here.

Share this post


Link to post
Share on other sites
It looks like you haven't initialized the extension properly, so you're calling an invalid pointer to function, resulting in a program crash.

For example if you're using glew you should call glewInit() before accessing any extension, and check for desired extension using GLEW_EXT_... ( http://glew.sourceforge.net/basic.html)

Share this post


Link to post
Share on other sites

This topic is 3728 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this