• Advertisement
Sign in to follow this  

Cg and VBO

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

I know this is probably an absurd question and can't be done but is it possible to use a Cg shader that modifies the input information aswell as the output information. For example if you are storing a bunch of vertices in a VBO can you pass it to a vertex shader so that the shader can modify the VBO?

Share this post


Link to post
Share on other sites
Advertisement
The answer now is no. The answer when DirectX 10 is released is sortof. You won't be able to modify the data in the vertex shader, but a geometry shader will be introduced that can either add or remove geometry on the fly.

Share this post


Link to post
Share on other sites
You can get around this problem by using rendering to texture (preferably floating point one). Vertex shaders 3.0 can read data from textures like pixel shaders, so they can fetch RGB from texture and treat it as XYZ position or anything you want. Still, until Shader Model 4.0 comes in there is no way to modify index buffers.

Share this post


Link to post
Share on other sites
Quote:
Original post by Krzysiek K
You can get around this problem by using rendering to texture (preferably floating point one). Vertex shaders 3.0 can read data from textures like pixel shaders, so they can fetch RGB from texture and treat it as XYZ position or anything you want. Still, until Shader Model 4.0 comes in there is no way to modify index buffers.


Well, if you mean that you can change the xyz position of the vertex, then of course you can do that, even without read from texture. However, I thought he meant either adding or removing geometry, which until dx10 comes out, you simply can't do.

Share this post


Link to post
Share on other sites
So I will be using GL_FLOAT32 for my texture and then glNearest for the lookup.

I will be able to manipulate the texture.

What i want to do is make a water sampler that runs of the texture, so here is what i will do.

I will make 2 textures, input (old values) and output (new values).
(These two will keep swapping like the screen buffers)

Then I will do the sampling per vertex (or per texture pixel, probably have a 512x512 texture)

Is that a good idea?

And then ofcourse in the fragment program i can make it look nice with normal lookups and stuff

Share this post


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

  • Advertisement