Problem with Cube Mapping in GLSL

hello people!
I have the classical problem that all people have when implementing for fist time cube mapping.
the problem is that any rotation over the y axis i may do I always the from reflection is the z

positive! This Problem can easyly fixed using texture matrix and then rotating. Right?
But my problem is I am making the Dynamic Cube mapping with OGLSL Pixel and Vertex shaders.
what I must do in the vertex shader to correct this problem?

my vertex/pixel shader source is this:

///////////////////////VERTEX SHADER:

varying vec3 N;
varying vec3 V;
varying vec3 clr;

void main (void)
{
V = (gl_ModelViewMatrix * gl_Vertex).xyz;
gl_Position = ftransform().xyzw;

N = gl_NormalMatrix * gl_Normal;
clr = gl_Color.rgb;

}

////////////////////////PIXEL SHADER:

varying vec3 N;
varying vec3 V;
varying vec3 clr;

uniform samplerCube skyCube;

void main (void)
{
vec3 normal = normalize(N);

vec3 refl = vec3(1,1,1) * textureCube(skyCube, reflect(V, normal)).rgb;

gl_FragColor = vec4(refl, 0.5);

}

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.