Jump to content
  • Advertisement
Sign in to follow this  
ray_intellect

OpenGL render to vertex buffer question

This topic is 5037 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, 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
Advertisement
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
is there a way to access the texture pixel inside the vertex shader with indices or with floating point coords only?

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
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!