Sign in to follow this  
ray_intellect

OpenGL render to vertex buffer question

Recommended Posts

Hi, I have heard about this technique in a shader program but have not got a clue about how it is done using a GPU. My only guess is that it would be a heightmap stored as a greyscale texture and a rectangular array of vertices ... am I correct? Is it possible to render anything to a VB? If so, how can it be done with either DirectX or OpenGL?

Share this post


Link to post
Share on other sites
Quote:
Original post by ray_intellect
If so, how can it be done with either DirectX or OpenGL?

You cannot render to a VB in DirectX (yet).

In OpenGL apparently you can. I've heard this refered to as "uber-buffers" which gives you something to search for. I'm not sure if it's part of the standard, part of the standard ARB extensions, or vendor specific.

Others here can answer you in more detail, but knowing it's OpenGL only and a search term will hopefully get you started in the right direction.

edit: Clicky

Share this post


Link to post
Share on other sites
With shader model 3 and D3D9, it is possible to sample a texture within a vertex shader - this texture could be a render target, effectively enabling "render to vertex shader" functionality. However, the results cannot (AFAIK) read back to a VB. Depending on your needs, this may of course be sufficient.

Share this post


Link to post
Share on other sites
You can change texel indices to texture coordinates by dividing with the texture dimensions (reciprocals of which can be fed to the shader via constants for maximum performance).

Share this post


Link to post
Share on other sites
seems like there s another thing nvidia has to add to sm3.1 integer texture lookups in the vertex shader

you could store 1/texdimension since multiplications are faster than divisions for another speedup but this is kind of stupid indexing the pixels should be supported those guys at nvidia know this certainly

Share this post


Link to post
Share on other sites

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