• Advertisement
Sign in to follow this  

[GPGPU] Reading a floating point buffer in a vertex shader...

This topic is 3380 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 have a 2-d buffer of single floating point values. I would like to read this buffer from a GLSL vertex shader. Should I be using vbo's or fbo's? If fbos, which combination of texture formats am I supposed to use to get the behavior I want?

Share this post


Link to post
Share on other sites
Advertisement
You don't have to use VBOs or FBOs. You can use a standard texture if you want as it is shown here
http://www.opengl.org/wiki/Vertex_Texture_Fetch


uint vertex_texture;
glGenTextures(1, &vertex_texture);
glBindTexture(GL_TEXTURE_2D, vertex_texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
//Linear filter might cause a fallback to software rendering so we are using GL_NEAREST
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
//Linear filter might cause a fallback to software rendering so we are using GL_NEAREST_MIPMAP_NEAREST
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
//Make sure your GPU support mipmaps with floating point textures
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAPS, GL_TRUE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE32F_ARB, width, height, 0, GL_LUMINANCE, GL_FLOAT, data);

Share this post


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

  • Advertisement