Sign in to follow this  

VBOs and Vertex programs with static meshes

This topic is 4836 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

1. What I would like to know is do vertex programs change the values of the vertices it acts upon? So if my coordinates are 0,10,0 and in the vertex program I do something and the new value is now 0,5,0 is this value stored back into my mesh structure or not? 2. If it alters the values while using a vertex program with VBOs do you need to use a dynamic flags with VBO buffers? 3. And if these vertices are changed, and aren't stored back into your structure how can you determine the new values of the verticies to determine collision detection? 4. I see there are no trig functions for Vertex Programs... So what can one do to use sin, cos funtions.... I haven't done much with vertex programs and just trying to get an overview of how they work and what I can do with them?

Share this post


Link to post
Share on other sites
Quote:
Original post by _the_phantom_
The values in the buffers are not changed.
Vertex programs are just a replacement for the fixed function pipeline, does that change vertex buffers? No.


So if my verticies are not changed and it acts on the original verticies the VP gets its data from the original vertex and only increments a value to the absolute vertex values... Is this correct...

Also with the DYNAMIC_DRAW_ARB VBO flag, this would be needed if you wanted to change the vertices due to the vertex program you are saying will not...

Share this post


Link to post
Share on other sites
Quote:
Original post by MARS_999
So if my verticies are not changed and it acts on the original verticies the VP gets its data from the original vertex and only increments a value to the absolute vertex values... Is this correct...


The vertex program is receiving the same vertices that would be sent down the fixed function pipeline. That is, I'm confused as to what you're asking/saying.

Quote:
Also with the DYNAMIC_DRAW_ARB VBO flag, this would be needed if you wanted to change the vertices due to the vertex program you are saying will not...


The GL_DYNAMIC_DRAW flag is merely a hint to the driver that you will be changing data in that VBO repeatedly. You would use this flag if you were planning on respecifying data in the VBO regardless of whether you are using a vertex program or not.

Share this post


Link to post
Share on other sites
My point is water, each vertex needs to be updated each frame to show animation of water. e.g. waves....

Now with VP's you are doing T&L right?

So if I use a VP to do Tranformations how can I know what the last value was to update the next frame to show movement???? if the values aren't changed inside the VP. So what you are saying is I will have to update the verticies outside of the VP to make water have waves???

[Edited by - MARS_999 on September 15, 2004 6:28:26 PM]

Share this post


Link to post
Share on other sites
if you want to change the vertex data then, yes, you will have to change the data in the buffers your self.

However, you could get away with having aload of static data and feeding a per vertex stream of offsets into the vertex program to be used to animate the vertices. This data would have to be generated on the CPU ofcourse.

Share this post


Link to post
Share on other sites
To clarify:

Vertex programs can never modify the buffer.


What vertex programs do is take the data in the buffer, process it as you see fit, and then output it to the next stage of the pipeline (whatever that is...somebody?). So any changes they make to the data are strictly for the output in that vertex, in that frame.

Share this post


Link to post
Share on other sites
If you want to simulate a wave, and have different timesteps in the wave (i.e. progression along the wave over time) you can do this w/out modifying your vertex data.

Vertex programs allow you to pass in arguements which every vertex then has access too. For simulating a wave, you can pass in a different timestep as an arguement each frame. Then your displacements can be based on the vertex position and the time. Of course you'll probably want to update your vertices eventually (say a new drop of water hits the surface, ect), but you can get a pretty good performance increase if you don't have to update your vertex data EVERY frame.

I hope you understand what I'm saying and that this helps!

Share this post


Link to post
Share on other sites

This topic is 4836 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