Jump to content
  • Advertisement
Sign in to follow this  
knobby67

help understanding VBO

This topic is 4034 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
Advertisement
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
Thanks for the advise so if my understanding is right I just in initialize GLEW and it sets up all the OpenGL extentions for me? At least all the ones your card can do?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!