Archive

Posts Tagged ‘Texture’

GLSL Texture

Coordinates of the gl_TexCoord[0]

gl_TexCoord[0].t —— rows

gl_TexCoord[0].s ——cols

vec4 x = texture2D(textureX, vec2(Columns, rows));

gl_FragColor = x;

Categories: C++, GLSL, Opengl Tags: ,

Assignment 3; Textures Very Imp Links

April 27, 2008 Leave a comment

Use glEnable(GL_TEXTURE_2D);

GPU Programming Course http://www.evl.uic.edu/aej/594/

For the Multi Texturing refer to 

http://www.clockworkcoders.com/oglsl/tutorial8.htm

glActiveTextureARB(GL_TEXTURE0_ARB);
glBindTexture(GL_TEXTURE_2D, texture1);
glEnable(GL_TEXTURE_2D);
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_REPLACE);

glActiveTextureARB(GL_TEXTURE1_ARB);
glBindTexture(GL_TEXTURE_2D, texture2);
glEnable(GL_TEXTURE_2D);
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_INCR);
http://www.evl.uic.edu/aej/594/lecture04.html
http://www.research.rutgers.edu/~sueda/428Fall2005/proj3.html

Texture Rectangle
http://www.opengl.org/registry/specs/ARB/texture_rectangle.txt

The Dominick Page
http://www.mathematik.uni-dortmund.de/~goeddeke/gpgpu/tutorial.html
http://www.mathematik.uni-dortmund.de/~goeddeke/gpgpu/saxpy_glsl2.cpp
http://code.google.com/p/matpix/source/browse/trunk/src/helloGPGPU.cpp
Categories: C++, GLSL, Opengl Tags: ,

Settingup Texture to read the Frame Buffer

April 26, 2008 Leave a comment

<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

 

Categories: C++, GLSL, Opengl Tags: , ,