Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


A few questions on binding VBOs...


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Ahl   Members   -  Reputation: 168

Like
0Likes
Like

Posted 24 December 2012 - 10:11 PM

Hey all,

 

The question isn't so much how to do it, I've figured that out, it's how you unbind a VBO and why having a bound VBO seems to block the usage of Vertex Arrays?

 

I have the following code in my rendering function:

 

if (VBO_Support)
				{
					glVertexPointer(	3,	GL_FLOAT,	sizeof(MyVertex),	(GLvoid*) (*RenderListIT)->RenderMesh->VBO_Offset					);
					glNormalPointer(		GL_FLOAT,	sizeof(MyVertex),	(GLvoid*)((*RenderListIT)->RenderMesh->VBO_Offset+sizeof(float)*3)	);
					glTexCoordPointer(	2,	GL_FLOAT,	sizeof(MyVertex),	(GLvoid*)((*RenderListIT)->RenderMesh->VBO_Offset+sizeof(float)*6)	);
					glColorPointer(		3,	GL_FLOAT,	sizeof(MyVertex),	(GLvoid*)((*RenderListIT)->RenderMesh->VBO_Offset+sizeof(float)*8)	);
				}
				else
				{
					glVertexPointer(	3,	GL_FLOAT,	sizeof(MyVertex),	&(*RenderListIT)->RenderMesh->VertexData->x		);
					glNormalPointer(		GL_FLOAT,	sizeof(MyVertex),	&(*RenderListIT)->RenderMesh->VertexData->nx	);
					glTexCoordPointer(	2,	GL_FLOAT,	sizeof(MyVertex),	&(*RenderListIT)->RenderMesh->VertexData->u		);
					glColorPointer(		3,	GL_FLOAT,	sizeof(MyVertex),	&(*RenderListIT)->RenderMesh->VertexData->a		);
				}

And I have a toggle that changes VBO_Support back and forth.  When I have a VBO bound (glBindBufferARB()) and VBO_Support = true everything runs fine but none of my objects display.  Why is that?

 

Thanks in advance.



Sponsor:

#2 Brother Bob   Moderators   -  Reputation: 8616

Like
0Likes
Like

Posted 25 December 2012 - 09:45 AM

If you have a vertex buffer object bound, then the pointer passed to the vertex array functions is an offset into the bound vertex buffer object. If you don't have a vertex buffer object bound, then the pointer is a direct pointer to system memory.

 

In other words, you cannot mix buffer object bindings and system memory pointers. If you switch to vertex arrays stored in system memory, then you also have to unbind the buffer object by binding object ID 0.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS