Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

…xcoords are good..
  • Loading branch information...
commit 4732123c51618c12d048dc75c8546a9b0fe38402 1 parent 1d300aa
@nddrylliog authored
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();
}
Please sign in to comment.
Something went wrong with that request. Please try again.