Jump to content
  • Advertisement
Sign in to follow this  
dawidjoubert

OpenGL VBO help (SOLVED)

This topic is 4600 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 there, im trying to get VBOs to work in my project but so far i have had no luck. I am using GLEE plugin header for the management of OpenGL Extensions and at the moment the MULTITEXTURING & VSYNC extensions work wonderfully however it seems i cant get the VBOs to work. GLEE is suppose to support it and i dont think its glee thats broken i think its me thats broken. Here is how i check for the VBO extension VBOSupported =IsExtensionSupported( "GL_ARB_vertex_buffer_object" ); If i comment the VBO support line out then the program runs without using vbos and everything is fine. YES my machine does support VBO because the Nehe Tutorial along with some other progies use it. Here is the Create buffer source
[Source]
	if (VBOSupported)
	{
		UseVBO = true;
		while (glGetError() != GL_NO_ERROR);
		// Generate And Bind The Vertex Buffer
		glGenBuffersARB( 1, &VBOVertices );// Get A Valid Name
		glBindBufferARB( GL_ARRAY_BUFFER_ARB, VBOVertices );// Bind The Buffer
		// Load The Data
		glBufferDataARB( GL_ARRAY_BUFFER_ARB, lPoints*3*sizeof(float), lPoint, GL_STATIC_DRAW_ARB );

		// Our Copy Of The Data Is No Longer Necessary, It Is Safe In The Graphics Card
		//delete [] lPoint; lPoint = NULL;
		//delete [] lVertex; lVertex = NULL;

		return glGetError();
	}
[/Source]
[/source] And here is how i render the VBOs
[Source]
		glDisable(GL_TEXTURE_2D);
		glColor4f(1,1,1,1);
		glBindBufferARB( GL_ARRAY_BUFFER_ARB, VBOVertices);
		glVertexPointer(3, GL_FLOAT,0,(char *) NULL);
		//glTexCoordPointer( 2, GL_FLOAT, 0, (char *) NULL);
		glDrawArrays(GL_LINE_STRIP, 0, lPoints);

		// Disable Pointers
		glDisableClientState( GL_VERTEX_ARRAY );// Disable Vertex Arrays
		glDisableClientState( GL_TEXTURE_COORD_ARRAY );// Disable Texture Coord Arrays
[/Source]
[/source] As you can see im rendering lines but it doesnt matter, it doesnt work with triangles nor triangle strips or quad strips. And yes i have initialized glee as i said the multitexturing extension works [Edited by - dawidjoubert on December 17, 2005 3:24:01 PM]

Share this post


Link to post
Share on other sites
Advertisement
Well in that source you aren't enabling the vertex array client state, or the texture array, or binding anything to a texture array.

Share this post


Link to post
Share on other sites
Quote:
Original post by bluntman
Well in that source you aren't enabling the vertex array client state, or the texture array, or binding anything to a texture array.


Thanks alot, that was it.. i knew it was something simple.


Regards

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!