Here is my frag and vertex code. It is straight from ozone3D.net. I am supplying my ModelWorld4x4 with this app code to an object at 0,0,0:

float mat16[16] = {1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1};

glUniformMatrix4fv(getUniLoc(cubeMapProgShader, āModelWorld4x4ā), 15, false, mat16);

My CameraPos uniform var is supplied eye coordinates, the same values from the first three arguements in gluLookAt.

Vert Code:

uniform mat4 ModelWorld4x4;

uniform vec3 CameraPos;

mat3 GetLinearPart( mat4 m )

{

mat3 result;

```
result[0][0] = m[0][0];
result[0][1] = m[0][1];
result[0][2] = m[0][2];
result[1][0] = m[1][0];
result[1][1] = m[1][1];
result[1][2] = m[1][2];
result[2][0] = m[2][0];
result[2][1] = m[2][1];
result[2][2] = m[2][2];
return result;
```

}

void main()

{

gl_Position = ftransform();

```
// Color map texture coordinates.
// Increase a little bit the tiling by 2.
gl_TexCoord[0] = gl_MultiTexCoord0 * 2.0;
mat3 ModelWorld3x3 = GetLinearPart( ModelWorld4x4 );
// find world space position.
vec4 WorldPos = ModelWorld4x4 * gl_Vertex;
// find world space normal.
vec3 N = normalize( ModelWorld3x3 * gl_Normal );
// find world space eye vector.
vec3 E = normalize( WorldPos.xyz - CameraPos.xyz );
// calculate the reflection vector in world space.
gl_TexCoord[1].xyz = reflect( E, N );
```

}

Frag Code:

uniform samplerCube cubeMap;

uniform sampler2D colorMap;

const float reflect_factor = 0.9;

void main (void)

{

vec4 output_color;

```
// Perform a simple 2D texture look up.
vec3 base_color = texture2D(colorMap, gl_TexCoord[0].xy).rgb;
// Perform a cube map look up.
vec3 cube_color = textureCube(cubeMap, gl_TexCoord[1].xyz).rgb;
// Write the final pixel.
gl_FragColor = vec4( mix(base_color, cube_color, reflect_factor), 1.0);
```

}