PDA

View Full Version : Reflection / glTexGeni Question (with Image)



DerTherion
01-18-2009, 03:33 PM
hello @all,

i work with java/jogl(OpenGL extension)
and i got a little Problem working with Texture Generate.

I use the init of Cubemapping without Enable it
to produce an reflection from the FBO
(see Code below)

the FBO mirror Texture is rendered,but something is wrong.
The Side is in the middle and the Middle of the FBO
is show at the sides..



what can i do to correct it?

thanks for any help :)


Water Reflect Code:

//fbo texture contains a mirror of the scene
gl.glBindTexture(GL.GL_TEXTURE_2D, fbo_texture.get(0));

gl.glTexGeni(GL.GL_S, GL.GL_TEXTURE_GEN_MODE, GL.GL_REFLECTION_MAP);
gl.glTexGeni(GL.GL_T, GL.GL_TEXTURE_GEN_MODE, GL.GL_REFLECTION_MAP);
gl.glTexGeni(GL.GL_R, GL.GL_TEXTURE_GEN_MODE, GL.GL_REFLECTION_MAP);

// i tested GL.GL_REPEAT /CLamp /Clamp to Edge
gl.glTexParameteri(GL.GL_TEXTURE_CUBE_MAP, GL.GL_TEXTURE_WRAP_S, GL.GL_REPEAT);
gl.glTexParameteri(GL.GL_TEXTURE_CUBE_MAP, GL.GL_TEXTURE_WRAP_T, GL.GL_REPEAT);
gl.glTexParameteri(GL.GL_TEXTURE_CUBE_MAP, GL.GL_TEXTURE_WRAP_R, GL.GL_REPEAT);

gl.glEnable(GL.GL_TEXTURE_GEN_S);
gl.glEnable(GL.GL_TEXTURE_GEN_T);
gl.glEnable(GL.GL_TEXTURE_GEN_R);


this is how the quad strips are made
...
->loops

gl.glColor4f(1.0f,1.0f,1.0f,0.8f);
gl.glNormal3f(0,-1,0); //for test all normals to the sky
gl.glVertex3f( t,3.0f,tt+si );
...

p.s.: the screenshot comes from an older Notebook with shared memory GPU (so do not look at the fps ;)


http://www.unterhaltungsuniversum.de/img/problem.jpg