Commit 99577069 authored by Jan Möbius's avatar Jan Möbius

Update to use global glstate class

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@12352 383ad7c9-94d9-4d36-a494-682f7c89f535
parent f7fad6c9
......@@ -108,12 +108,12 @@ void CursorPainter::initializeGL()
// setup cursor texture
glGenTextures (1, &texture_);
glBindTexture (GL_TEXTURE_2D, texture_);
ACG::GLState::bindTexture (GL_TEXTURE_2D, texture_);
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
glBindTexture (GL_TEXTURE_2D, 0);
ACG::GLState::bindTexture (GL_TEXTURE_2D, 0);
cursorToTexture ();
......@@ -161,15 +161,15 @@ void CursorPainter::paintCursor (ACG::GLState *_state)
glPushAttrib (GL_ALL_ATTRIB_BITS);
glDisable (GL_DEPTH_TEST);
glDisable(GL_LIGHTING);
glEnable(GL_BLEND);
ACG::GLState::disable(GL_DEPTH_TEST);
ACG::GLState::disable(GL_LIGHTING);
ACG::GLState::enable(GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
ACG::GLState::blendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// bind texture
glEnable (GL_TEXTURE_2D);
glBindTexture (GL_TEXTURE_2D, texture_);
ACG::GLState::bindTexture (GL_TEXTURE_2D, texture_);
glColor4f (1.0, 1.0, 1.0, 1.0);
......@@ -301,11 +301,11 @@ void CursorPainter::cursorToTexture()
}
glEnable (GL_TEXTURE_2D);
glBindTexture (GL_TEXTURE_2D, texture_);
ACG::GLState::bindTexture (GL_TEXTURE_2D, texture_);
glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0,
GL_RGBA, GL_UNSIGNED_BYTE, buf);
glBindTexture (GL_TEXTURE_2D, 0);
glDisable (GL_TEXTURE_2D);
ACG::GLState::bindTexture (GL_TEXTURE_2D, 0);
ACG::GLState::disable(GL_TEXTURE_2D);
hasCursor_ = true;
}
......
......@@ -510,7 +510,7 @@ void glViewer::normalsMode(NormalsMode _mode)
break;
case NORMALIZE_NORMALS:
glEnable(GL_NORMALIZE);
ACG::GLState::enable(GL_NORMALIZE);
break;
}
......@@ -663,7 +663,7 @@ void glViewer::drawScene_mono()
glPushAttrib(GL_ALL_ATTRIB_BITS);
glEnable(GL_BLEND);
ACG::GLState::enable(GL_BLEND);
glDisable(GL_DEPTH_TEST);
glDisable(GL_LIGHTING);
glDisable(GL_DITHER);
......@@ -702,7 +702,7 @@ void glViewer::drawScene_mono()
glStencilFunc (GL_EQUAL, ref, mask);
glBlendFunc (sfactor, dfactor);
ACG::GLState::blendFunc (sfactor, dfactor);
glColor4f (color[0], color [1], color [2], color[3]);
glBegin (GL_QUADS);
......@@ -850,10 +850,10 @@ void glViewer::initializeGL()
glstate_->initialize();
// OpenGL state
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHTING);
ACG::GLState::enable(GL_DEPTH_TEST);
ACG::GLState::enable(GL_LIGHTING);
glDisable(GL_DITHER);
glShadeModel( GL_FLAT );
ACG::GLState::shadeModel( GL_FLAT );
projectionMode( projectionMode_ );
......@@ -912,10 +912,10 @@ void glViewer::paintGL()
glPushAttrib (GL_ALL_ATTRIB_BITS);
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHTING);
ACG::GLState::enable(GL_DEPTH_TEST);
ACG::GLState::enable(GL_LIGHTING);
glDisable(GL_DITHER);
glShadeModel( GL_FLAT );
ACG::GLState::shadeModel( GL_FLAT );
glMatrixMode(GL_PROJECTION);
glPushMatrix();
......@@ -1895,7 +1895,7 @@ void glViewer::applyProperties() {
glFrontFace( GL_CW );
if ( properties_.backFaceCulling() )
glEnable( GL_CULL_FACE );
ACG::GLState::enable(GL_CULL_FACE );
else
glDisable( GL_CULL_FACE );
......
......@@ -95,7 +95,7 @@ glViewer::setStereoMode(bool _b)
if (!stereo_) {
makeCurrent();
glDrawBuffer(GL_BACK);
ACG::GLState::drawBuffer(GL_BACK);
}
updateProjectionMatrix ();
......@@ -136,7 +136,7 @@ glViewer::drawScene_glStereo()
glFrustum(l+offset2, r+offset2, b, t, properties_.nearPlane(), properties_.farPlane());
glTranslatef(+offset, 0.0, 0.0);
glMatrixMode(GL_MODELVIEW);
glDrawBuffer(GL_BACK_LEFT);
ACG::GLState::drawBuffer(GL_BACK_LEFT);
glstate_->clearBuffers ();
glClear(GL_DEPTH_BUFFER_BIT);
drawScene_mono();
......@@ -148,11 +148,11 @@ glViewer::drawScene_glStereo()
glFrustum(l-offset2, r-offset2, b, t, properties_.nearPlane(), properties_.farPlane());
glTranslatef(-offset, 0.0, 0.0);
glMatrixMode(GL_MODELVIEW);
glDrawBuffer(GL_BACK_RIGHT);
ACG::GLState::drawBuffer(GL_BACK_RIGHT);
glstate_->clearBuffers ();
glClear(GL_DEPTH_BUFFER_BIT);
drawScene_mono();
glDrawBuffer(GL_BACK);
ACG::GLState::drawBuffer(GL_BACK);
}
......@@ -263,13 +263,13 @@ glViewer::updateCustomAnaglyphStereo()
if (glstate_->viewport_width () != agTexWidth_ ||
glstate_->viewport_height () != agTexHeight_)
{
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, agTexture_[0]);
ACG::GLState::bindTexture (GL_TEXTURE_RECTANGLE_ARB, agTexture_[0]);
glTexImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGB, glstate_->viewport_width (),
glstate_->viewport_height (), 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, agTexture_[1]);
ACG::GLState::bindTexture (GL_TEXTURE_RECTANGLE_ARB, agTexture_[1]);
glTexImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGB, glstate_->viewport_width (),
glstate_->viewport_height (), 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, 0);
ACG::GLState::bindTexture (GL_TEXTURE_RECTANGLE_ARB, 0);
agTexWidth_ = glstate_->viewport_width ();
agTexHeight_ = glstate_->viewport_height ();
......@@ -338,9 +338,9 @@ glViewer::drawScene_customAnaglyphStereo()
glClear(GL_DEPTH_BUFFER_BIT);
drawScene_mono();
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, agTexture_[0]);
ACG::GLState::bindTexture (GL_TEXTURE_RECTANGLE_ARB, agTexture_[0]);
glCopyTexSubImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, 0, 0, vp_l, vp_b, vp_w, vp_h);
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, 0);
ACG::GLState::bindTexture (GL_TEXTURE_RECTANGLE_ARB, 0);
// right eye
glMatrixMode(GL_PROJECTION);
......@@ -352,16 +352,16 @@ glViewer::drawScene_customAnaglyphStereo()
glClear(GL_DEPTH_BUFFER_BIT);
drawScene_mono();
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, agTexture_[1]);
ACG::GLState::bindTexture (GL_TEXTURE_RECTANGLE_ARB, agTexture_[1]);
glCopyTexSubImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, 0, 0, vp_l, vp_b, vp_w, vp_h);
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, 0);
ACG::GLState::bindTexture (GL_TEXTURE_RECTANGLE_ARB, 0);
glActiveTexture (GL_TEXTURE0);
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, agTexture_[0]);
ACG::GLState::bindTexture (GL_TEXTURE_RECTANGLE_ARB, agTexture_[0]);
glEnable (GL_TEXTURE_RECTANGLE_ARB);
glActiveTexture (GL_TEXTURE1);
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, agTexture_[1]);
ACG::GLState::bindTexture (GL_TEXTURE_RECTANGLE_ARB, agTexture_[1]);
glEnable (GL_TEXTURE_RECTANGLE_ARB);
glEnable (GL_FRAGMENT_PROGRAM_ARB);
......@@ -381,7 +381,7 @@ glViewer::drawScene_customAnaglyphStereo()
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glDisable (GL_DEPTH_TEST);
ACG::GLState::disable(GL_DEPTH_TEST);
glBegin (GL_QUADS);
glMultiTexCoord2f (GL_TEXTURE0, 0, vp_h);
......@@ -401,15 +401,15 @@ glViewer::drawScene_customAnaglyphStereo()
glEnable (GL_DEPTH_TEST);
glBindProgramARB (GL_FRAGMENT_PROGRAM_ARB, 0);
glDisable (GL_FRAGMENT_PROGRAM_ARB);
ACG::GLState::disable(GL_FRAGMENT_PROGRAM_ARB);
glActiveTexture (GL_TEXTURE1);
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, 0);
glDisable (GL_TEXTURE_RECTANGLE_ARB);
ACG::GLState::bindTexture (GL_TEXTURE_RECTANGLE_ARB, 0);
ACG::GLState::disable(GL_TEXTURE_RECTANGLE_ARB);
glActiveTexture (GL_TEXTURE0);
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, 0);
glDisable (GL_TEXTURE_RECTANGLE_ARB);
ACG::GLState::bindTexture (GL_TEXTURE_RECTANGLE_ARB, 0);
ACG::GLState::disable(GL_TEXTURE_RECTANGLE_ARB);
}
......
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