Browse files

More fiddling around, still doesn't work, but at least we know the te…

…xcoords are good..
  • Loading branch information...
1 parent 1d300aa commit 4732123c51618c12d048dc75c8546a9b0fe38402 Amos Wenger committed Dec 1, 2011
Showing with 29 additions and 27 deletions.
  1. +2 −1 data/main.fs
  2. +2 −1 data/testShaderReflection.fs
  3. +1 −1 src/exercises/EnvMap/EnvMap.cpp
  4. +24 −24 src/gl/CubeMap.cpp
View
3 data/main.fs
@@ -9,9 +9,10 @@ varying vec3 TextureCoordinate;
void main()
{
gl_FragColor = textureCube(Texture, TextureCoordinate);
+ // gl_FragColor.xyz = TextureCoordinate;
// need this line so OpenGL doesn't optimize out the variables -- remove in your solution
// {
- Normal; Color;
+ Normal; Color; Texture;
// }
}
View
3 data/testShaderReflection.fs
@@ -7,5 +7,6 @@ uniform samplerCube EnvironmentMap;
void main()
{
- gl_FragColor = clamp(textureCube(EnvironmentMap, ReflectedRay),0.0,1.0);
+ // gl_FragColor = clamp(textureCube(EnvironmentMap, ReflectedRay),0.0,1.0);
+ gl_FragColor = vec4(1.0, 0.0, 0.0, 0.0);
}
View
2 src/exercises/EnvMap/EnvMap.cpp
@@ -47,7 +47,7 @@ init()
m_reflectionShader.create("testShaderReflection.vs", "testShaderReflection.fs");
// load cube map
- m_cubeMap = new CubeMap("deadmeat_skymorning", 1.5f, &m_mainShader);
+ m_cubeMap = new CubeMap("deadmeat_skymorning", 15.0f, &m_mainShader);
}
View
48 src/gl/CubeMap.cpp
@@ -33,40 +33,40 @@ void CubeMap::draw()
glBegin(GL_QUADS);
// Render the front quad
- glTexCoord3f( 1.0f, -m_size, -m_size ); glVertex3f( m_size, -m_size, -m_size );
- glTexCoord3f( -m_size, -m_size, -m_size ); glVertex3f( -m_size, -m_size, -m_size );
- glTexCoord3f( -m_size, m_size, -m_size ); glVertex3f( -m_size, m_size, -m_size );
- glTexCoord3f( m_size, m_size, -m_size ); glVertex3f( m_size, m_size, -m_size );
+ glTexCoord3f( 1.0f, -1.0f, -1.0f ); glVertex3f( m_size, -m_size, -m_size );
+ glTexCoord3f( -1.0f, -1.0f, -1.0f ); glVertex3f( -m_size, -m_size, -m_size );
+ glTexCoord3f( -1.0f, 1.0f, -1.0f ); glVertex3f( -m_size, m_size, -m_size );
+ glTexCoord3f( 1.0f, 1.0f, -1.0f ); glVertex3f( m_size, m_size, -m_size );
// Render the left quad
- glTexCoord3f( m_size, -m_size, m_size ); glVertex3f( m_size, -m_size, m_size );
- glTexCoord3f( m_size, -m_size, -m_size ); glVertex3f( m_size, -m_size, -m_size );
- glTexCoord3f( m_size, m_size, -m_size ); glVertex3f( m_size, m_size, -m_size );
- glTexCoord3f( m_size, m_size, m_size ); glVertex3f( m_size, m_size, m_size );
+ glTexCoord3f( 1.0f, -1.0f, 1.0f ); glVertex3f( m_size, -m_size, m_size );
+ glTexCoord3f( 1.0f, -1.0f, -1.0f ); glVertex3f( m_size, -m_size, -m_size );
+ glTexCoord3f( 1.0f, 1.0f, -1.0f ); glVertex3f( m_size, m_size, -m_size );
+ glTexCoord3f( 1.0f, 1.0f, 1.0f ); glVertex3f( m_size, m_size, m_size );
// Render the back quad
- glTexCoord3f( -m_size, -m_size, m_size ); glVertex3f( -m_size, -m_size, m_size );
- glTexCoord3f( m_size, -m_size, m_size ); glVertex3f( m_size, -m_size, m_size );
- glTexCoord3f( m_size, m_size, m_size ); glVertex3f( m_size, m_size, m_size );
- glTexCoord3f( -m_size, m_size, m_size ); glVertex3f( -m_size, m_size, m_size );
+ glTexCoord3f( -1.0f, -1.0f, 1.0f ); glVertex3f( -m_size, -m_size, m_size );
+ glTexCoord3f( 1.0f, -1.0f, 1.0f ); glVertex3f( m_size, -m_size, m_size );
+ glTexCoord3f( 1.0f, 1.0f, 1.0f ); glVertex3f( m_size, m_size, m_size );
+ glTexCoord3f( -1.0f, 1.0f, 1.0f ); glVertex3f( -m_size, m_size, m_size );
// Render the right quad
- glTexCoord3f( -m_size, -m_size, -m_size ); glVertex3f( -m_size, -m_size, -m_size );
- glTexCoord3f( -m_size, -m_size, m_size ); glVertex3f( -m_size, -m_size, m_size );
- glTexCoord3f( -m_size, m_size, m_size ); glVertex3f( -m_size, m_size, m_size );
- glTexCoord3f( -m_size, m_size, -m_size ); glVertex3f( -m_size, m_size, -m_size );
+ glTexCoord3f( -1.0f, -1.0f, -1.0f ); glVertex3f( -m_size, -m_size, -m_size );
+ glTexCoord3f( -1.0f, -1.0f, 1.0f ); glVertex3f( -m_size, -m_size, m_size );
+ glTexCoord3f( -1.0f, 1.0f, 1.0f ); glVertex3f( -m_size, m_size, m_size );
+ glTexCoord3f( -1.0f, 1.0f, -1.0f ); glVertex3f( -m_size, m_size, -m_size );
// Render the top quad
- glTexCoord3f( -m_size, m_size, -m_size ); glVertex3f( -m_size, m_size, -m_size );
- glTexCoord3f( -m_size, m_size, m_size ); glVertex3f( -m_size, m_size, m_size );
- glTexCoord3f( m_size, m_size, m_size ); glVertex3f( m_size, m_size, m_size );
- glTexCoord3f( m_size, m_size, -m_size ); glVertex3f( m_size, m_size, -m_size );
+ glTexCoord3f( -1.0f, 1.0f, -1.0f ); glVertex3f( -m_size, m_size, -m_size );
+ glTexCoord3f( -1.0f, 1.0f, 1.0f ); glVertex3f( -m_size, m_size, m_size );
+ glTexCoord3f( 1.0f, 1.0f, 1.0f ); glVertex3f( m_size, m_size, m_size );
+ glTexCoord3f( 1.0f, 1.0f, -1.0f ); glVertex3f( m_size, m_size, -m_size );
// Render the bottom quad
- glTexCoord3f( -m_size, -m_size, -m_size ); glVertex3f( -m_size, -m_size, -m_size );
- glTexCoord3f( -m_size, -m_size, m_size ); glVertex3f( -m_size, -m_size, m_size );
- glTexCoord3f( m_size, -m_size, m_size ); glVertex3f( m_size, -m_size, m_size );
- glTexCoord3f( m_size, -m_size, -m_size ); glVertex3f( m_size, -m_size, -m_size );
+ glTexCoord3f( -1.0f, -1.0f, -1.0f ); glVertex3f( -m_size, -m_size, -m_size );
+ glTexCoord3f( -1.0f, -1.0f, 1.0f ); glVertex3f( -m_size, -m_size, m_size );
+ glTexCoord3f( 1.0f, -1.0f, 1.0f ); glVertex3f( m_size, -m_size, m_size );
+ glTexCoord3f( 1.0f, -1.0f, -1.0f ); glVertex3f( m_size, -m_size, -m_size );
glEnd();
}

0 comments on commit 4732123

Please sign in to comment.