Commit f9e41611 authored by Martin Flöser's avatar Martin Flöser
Browse files

Cube uses new high-level push/pop/multiply for caps.

For OpenGL 1.x cube caps are now rendered using the capMatrix
instead of using glTranslate/glRotate et al. One source base to
rule all GL versions.
parent 866b1564
...@@ -917,25 +917,17 @@ void CubeEffect::paintCap(bool frontFirst, float zOffset) ...@@ -917,25 +917,17 @@ void CubeEffect::paintCap(bool frontFirst, float zOffset)
capTexture->bind(); capTexture->bind();
} }
} else { } else {
#ifndef KWIN_HAVE_OPENGLES pushMatrix(m_rotationMatrix*capMatrix);
// TODO: required transformations - should use the capMatrix and rotationMatrix
glPushMatrix();
glCallList( glList );
glTranslatef( rect.width()/2, 0.0, zOffset );
glRotatef( (1-frontDesktop)*360.0f / effects->numberOfDesktops(), 0.0, 1.0, 0.0 );
glTranslatef( 0.0, rect.height(), 0.0 );
if( mode == Sphere )
{
glPushMatrix();
glScalef( 1.0, -1.0, 1.0 );
}
// TODO: mirroring should depend on the current rendering mode #ifndef KWIN_HAVE_OPENGLES
glMatrixMode( GL_TEXTURE ); glMatrixMode( GL_TEXTURE );
glPushMatrix(); #endif
glLoadIdentity(); QMatrix4x4 textureMirrorMatrix;
glScalef( 1.0f, -1.0f, 1.0f ); textureMirrorMatrix.scale(1.0, -1.0, 1.0);
glTranslatef( 0.0f, -1.0f, 0.0f ); textureMirrorMatrix.translate(0.0, -1.0, 0.0);
pushMatrix();
loadMatrix(textureMirrorMatrix);
#ifndef KWIN_HAVE_OPENGLES
glMatrixMode( GL_MODELVIEW ); glMatrixMode( GL_MODELVIEW );
glColor4f( capColor.redF(), capColor.greenF(), capColor.blueF(), cubeOpacity ); glColor4f( capColor.redF(), capColor.greenF(), capColor.blueF(), cubeOpacity );
...@@ -980,13 +972,11 @@ void CubeEffect::paintCap(bool frontFirst, float zOffset) ...@@ -980,13 +972,11 @@ void CubeEffect::paintCap(bool frontFirst, float zOffset)
} else { } else {
#ifndef KWIN_HAVE_OPENGLES #ifndef KWIN_HAVE_OPENGLES
glMatrixMode( GL_TEXTURE ); glMatrixMode( GL_TEXTURE );
glPopMatrix(); popMatrix();
glMatrixMode( GL_MODELVIEW ); glMatrixMode( GL_MODELVIEW );
if( mode == Sphere )
glPopMatrix();
glTranslatef( 0.0, -rect.height(), 0.0 );
#endif #endif
popMatrix();
pushMatrix(m_rotationMatrix*capMatrix);
} }
glCullFace(secondCull); glCullFace(secondCull);
m_cubeCapBuffer->render(GL_TRIANGLES); m_cubeCapBuffer->render(GL_TRIANGLES);
...@@ -998,18 +988,18 @@ void CubeEffect::paintCap(bool frontFirst, float zOffset) ...@@ -998,18 +988,18 @@ void CubeEffect::paintCap(bool frontFirst, float zOffset)
capTexture->unbind(); capTexture->unbind();
} }
} else { } else {
#ifndef KWIN_HAVE_OPENGLES popMatrix();
glPopMatrix();
if( texturedCaps && effects->numberOfDesktops() > 3 && capTexture ) if( texturedCaps && effects->numberOfDesktops() > 3 && capTexture )
{ {
#ifndef KWIN_HAVE_OPENGLES
glActiveTexture( GL_TEXTURE1 ); glActiveTexture( GL_TEXTURE1 );
glDisable( capTexture->target() ); glDisable( capTexture->target() );
glActiveTexture( GL_TEXTURE0 ); glActiveTexture( GL_TEXTURE0 );
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE ); glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
glColor4f( 0.0f, 0.0f, 0.0f, 0.0f ); glColor4f( 0.0f, 0.0f, 0.0f, 0.0f );
capTexture->unbind(); capTexture->unbind();
}
#endif #endif
}
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment