EgtGraphics 1.5c1 :

- gestione colore da attributi.
This commit is contained in:
Dario Sassi
2014-03-06 08:17:57 +00:00
parent b7ebe4b6f5
commit 551bb713e4
3 changed files with 26 additions and 10 deletions
+20 -10
View File
@@ -485,15 +485,17 @@ Scene::Background( void)
if ( ! MakeCurrent())
return false ;
// imposto il colore dello sfondo
glClearColor( m_BackTop.GetRed(), m_BackTop.GetGreen(), m_BackTop.GetBlue(), m_BackTop.GetAlpha()) ;
// cancello lo Zbuffer
glClearDepth( 1) ;
glClear( GL_DEPTH_BUFFER_BIT) ;
// cancello
glClear( GL_COLOR_BUFFER_BIT) ;
// se lo sfondo ha un colore uniforme, ho finito
if ( m_BackTop == m_BackBottom)
// se lo sfondo ha un colore uniforme
if ( m_BackTop == m_BackBottom) {
// imposto il colore dello sfondo e lo cancello
glClearColor( m_BackTop.GetRed(), m_BackTop.GetGreen(), m_BackTop.GetBlue(), m_BackTop.GetAlpha()) ;
glClear( GL_COLOR_BUFFER_BIT) ;
return true ;
}
// rendo neutre matrici di proiezione e di modello/vista
glMatrixMode( GL_PROJECTION) ;
@@ -501,6 +503,9 @@ Scene::Background( void)
glMatrixMode( GL_MODELVIEW) ;
glLoadIdentity() ;
// disabilito lo Zdepth
glDisable( GL_DEPTH_TEST) ;
// disegno lo sfondo con due colori
if ( ! m_bNewWay) {
glBegin( GL_TRIANGLE_STRIP) ;
@@ -599,21 +604,26 @@ Scene::Prepare( void)
bool
Scene::Draw( void)
{
// sistemo lo sfondo
// sistemo lo sfondo e lo Zbuffer
if ( ! Background())
return false ;
// imposto
// imposto la camera
if ( ! Prepare())
return false ;
// imposto l'utilizzo dello Zbuffer
glDepthFunc( GL_LESS) ;
glEnable( GL_DEPTH_TEST) ;
// colore di default
glColor4f( 1, 1, 1, 1) ;
// disegno le geometrie del DB
DrawGroup( GDB_ID_ROOT) ;
// aggiungo disegni diretti
// aggiungo disegni diretti (senza test Zbuffer)
glDisable( GL_DEPTH_TEST) ;
DrawWinRect() ;
// aggiorno