Home > C++, GLSL, Opengl > Settingup Texture to read the Frame Buffer

Settingup Texture to read the Frame Buffer

<good link http://www.mathematik.tu-dortmund.de/~goeddeke/gpgpu/saxpy_glsl.cpp>

These are basic steps to take

For each texture do the following things

1) Generate the texture 

glGenTextures(1, texId);

2) Then Bind the texture to what target you want 

glBindTexture( GL_TEXTURE_RECTANGLE_ARB, tex);

3) Setup the properties to avoid the wraping on edges, min-mapping,

glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
//clamp so that it does not excede where you do want to write
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP);

4) Use the  glTexImage2D to setup the properties like for format, type, height and width of the texture

 

Advertisements
Categories: C++, GLSL, Opengl Tags: , ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: