Commit c4f29546 authored by Jan Möbius's avatar Jan Möbius
Browse files

Update to use global glstate class

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@12357 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 8e0e86b8
...@@ -110,8 +110,8 @@ public: ...@@ -110,8 +110,8 @@ public:
/** Per reference number blending values /** Per reference number blending values
@param _reference stencil reference for blending @param _reference stencil reference for blending
@param _src sfactor parameter for glBlendFunc function @param _src sfactor parameter for ACG::GLState::blendFunc function
@param _dst dfactor parameter for glBlendFunc function @param _dst dfactor parameter for ACG::GLState::blendFunc function
@param _color color used for blending @param _color color used for blending
@return should blending be berformed for this reference @return should blending be berformed for this reference
*/ */
...@@ -119,8 +119,8 @@ public: ...@@ -119,8 +119,8 @@ public:
/** Per reference bit blending values /** Per reference bit blending values
@param _refbit stencil reference bit for blending @param _refbit stencil reference bit for blending
@param _src sfactor parameter for glBlendFunc function @param _src sfactor parameter for ACG::GLState::blendFunc function
@param _dst dfactor parameter for glBlendFunc function @param _dst dfactor parameter for ACG::GLState::blendFunc function
@param _color color used for blending @param _color color used for blending
@return should blending be berformed for this reference @return should blending be berformed for this reference
*/ */
......
...@@ -161,14 +161,14 @@ void CursorPainter::paintCursor (ACG::GLState *_state) ...@@ -161,14 +161,14 @@ void CursorPainter::paintCursor (ACG::GLState *_state)
glPushAttrib (GL_ALL_ATTRIB_BITS); glPushAttrib (GL_ALL_ATTRIB_BITS);
ACG::GLState::disable(GL_DEPTH_TEST); ACG::GLState::disable (GL_DEPTH_TEST);
ACG::GLState::disable(GL_LIGHTING); ACG::GLState::disable(GL_LIGHTING);
ACG::GLState::enable(GL_BLEND); ACG::GLState::enable(GL_BLEND);
ACG::GLState::blendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); ACG::GLState::blendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// bind texture // bind texture
glEnable (GL_TEXTURE_2D); ACG::GLState::enable (GL_TEXTURE_2D);
ACG::GLState::bindTexture (GL_TEXTURE_2D, texture_); ACG::GLState::bindTexture (GL_TEXTURE_2D, texture_);
glColor4f (1.0, 1.0, 1.0, 1.0); glColor4f (1.0, 1.0, 1.0, 1.0);
...@@ -300,12 +300,12 @@ void CursorPainter::cursorToTexture() ...@@ -300,12 +300,12 @@ void CursorPainter::cursorToTexture()
index += 4; index += 4;
} }
glEnable (GL_TEXTURE_2D); ACG::GLState::enable (GL_TEXTURE_2D);
ACG::GLState::bindTexture (GL_TEXTURE_2D, texture_); ACG::GLState::bindTexture (GL_TEXTURE_2D, texture_);
glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0, glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0,
GL_RGBA, GL_UNSIGNED_BYTE, buf); GL_RGBA, GL_UNSIGNED_BYTE, buf);
ACG::GLState::bindTexture (GL_TEXTURE_2D, 0); ACG::GLState::bindTexture (GL_TEXTURE_2D, 0);
ACG::GLState::disable(GL_TEXTURE_2D); ACG::GLState::disable (GL_TEXTURE_2D);
hasCursor_ = true; hasCursor_ = true;
} }
......
...@@ -506,7 +506,7 @@ void glViewer::normalsMode(NormalsMode _mode) ...@@ -506,7 +506,7 @@ void glViewer::normalsMode(NormalsMode _mode)
switch(normalsMode_ = _mode) switch(normalsMode_ = _mode)
{ {
case DONT_TOUCH_NORMALS: case DONT_TOUCH_NORMALS:
glDisable(GL_NORMALIZE); ACG::GLState::disable(GL_NORMALIZE);
break; break;
case NORMALIZE_NORMALS: case NORMALIZE_NORMALS:
...@@ -618,7 +618,7 @@ void glViewer::drawScene_mono() ...@@ -618,7 +618,7 @@ void glViewer::drawScene_mono()
if (oM) if (oM)
{ {
glClear (GL_STENCIL_BUFFER_BIT); glClear (GL_STENCIL_BUFFER_BIT);
glEnable (GL_STENCIL_TEST); ACG::GLState::enable (GL_STENCIL_TEST);
glStencilOp (GL_KEEP, GL_KEEP, GL_ZERO); glStencilOp (GL_KEEP, GL_KEEP, GL_ZERO);
glStencilFunc (GL_ALWAYS, 0, ~0); glStencilFunc (GL_ALWAYS, 0, ~0);
...@@ -664,9 +664,9 @@ void glViewer::drawScene_mono() ...@@ -664,9 +664,9 @@ void glViewer::drawScene_mono()
glPushAttrib(GL_ALL_ATTRIB_BITS); glPushAttrib(GL_ALL_ATTRIB_BITS);
ACG::GLState::enable(GL_BLEND); ACG::GLState::enable(GL_BLEND);
glDisable(GL_DEPTH_TEST); ACG::GLState::disable(GL_DEPTH_TEST);
glDisable(GL_LIGHTING); ACG::GLState::disable(GL_LIGHTING);
glDisable(GL_DITHER); ACG::GLState::disable(GL_DITHER);
int vp_l, vp_b, vp_w, vp_h; int vp_l, vp_b, vp_w, vp_h;
glstate_->get_viewport (vp_l, vp_b, vp_w, vp_h); glstate_->get_viewport (vp_l, vp_b, vp_w, vp_h);
...@@ -720,7 +720,7 @@ void glViewer::drawScene_mono() ...@@ -720,7 +720,7 @@ void glViewer::drawScene_mono()
glPopMatrix (); glPopMatrix ();
glPopAttrib (); glPopAttrib ();
glDisable (GL_STENCIL_TEST); ACG::GLState::disable (GL_STENCIL_TEST);
} }
...@@ -852,7 +852,7 @@ void glViewer::initializeGL() ...@@ -852,7 +852,7 @@ void glViewer::initializeGL()
// OpenGL state // OpenGL state
ACG::GLState::enable(GL_DEPTH_TEST); ACG::GLState::enable(GL_DEPTH_TEST);
ACG::GLState::enable(GL_LIGHTING); ACG::GLState::enable(GL_LIGHTING);
glDisable(GL_DITHER); ACG::GLState::disable(GL_DITHER);
ACG::GLState::shadeModel( GL_FLAT ); ACG::GLState::shadeModel( GL_FLAT );
...@@ -914,7 +914,7 @@ void glViewer::paintGL() ...@@ -914,7 +914,7 @@ void glViewer::paintGL()
ACG::GLState::enable(GL_DEPTH_TEST); ACG::GLState::enable(GL_DEPTH_TEST);
ACG::GLState::enable(GL_LIGHTING); ACG::GLState::enable(GL_LIGHTING);
glDisable(GL_DITHER); ACG::GLState::disable(GL_DITHER);
ACG::GLState::shadeModel( GL_FLAT ); ACG::GLState::shadeModel( GL_FLAT );
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
...@@ -1895,9 +1895,9 @@ void glViewer::applyProperties() { ...@@ -1895,9 +1895,9 @@ void glViewer::applyProperties() {
glFrontFace( GL_CW ); glFrontFace( GL_CW );
if ( properties_.backFaceCulling() ) if ( properties_.backFaceCulling() )
ACG::GLState::enable(GL_CULL_FACE ); ACG::GLState::enable( GL_CULL_FACE );
else else
glDisable( GL_CULL_FACE ); ACG::GLState::disable( GL_CULL_FACE );
} }
......
...@@ -176,9 +176,9 @@ int glViewer::pickColor( ACG::SceneGraph::PickTarget _pickTarget, ...@@ -176,9 +176,9 @@ int glViewer::pickColor( ACG::SceneGraph::PickTarget _pickTarget,
glMultMatrixd(projection.get_raw_data()); glMultMatrixd(projection.get_raw_data());
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glLoadMatrixd(modelview.get_raw_data()); glLoadMatrixd(modelview.get_raw_data());
glDisable(GL_LIGHTING); ACG::GLState::disable(GL_LIGHTING);
glDisable(GL_BLEND); ACG::GLState::disable(GL_BLEND);
glEnable(GL_DEPTH_TEST); ACG::GLState::enable(GL_DEPTH_TEST);
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
properties_.glState().pick_init (true); properties_.glState().pick_init (true);
...@@ -191,7 +191,7 @@ int glViewer::pickColor( ACG::SceneGraph::PickTarget _pickTarget, ...@@ -191,7 +191,7 @@ int glViewer::pickColor( ACG::SceneGraph::PickTarget _pickTarget,
glLoadMatrixd(projection.get_raw_data()); glLoadMatrixd(projection.get_raw_data());
glMatrixMode( GL_MODELVIEW ); glMatrixMode( GL_MODELVIEW );
glLoadMatrixd(modelview.get_raw_data()); glLoadMatrixd(modelview.get_raw_data());
glEnable(GL_LIGHTING); ACG::GLState::enable(GL_LIGHTING);
properties_.glState().set_clear_color (clear_color); properties_.glState().set_clear_color (clear_color);
...@@ -439,8 +439,8 @@ bool glViewer::pickGL( ACG::SceneGraph::PickTarget _pickTarget, ...@@ -439,8 +439,8 @@ bool glViewer::pickGL( ACG::SceneGraph::PickTarget _pickTarget,
glMultMatrixd(projection.get_raw_data()); glMultMatrixd(projection.get_raw_data());
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glLoadMatrixd(modelview.get_raw_data()); glLoadMatrixd(modelview.get_raw_data());
glDisable(GL_LIGHTING); ACG::GLState::disable(GL_LIGHTING);
glDisable(GL_BLEND); ACG::GLState::disable(GL_BLEND);
glClear(GL_DEPTH_BUFFER_BIT); glClear(GL_DEPTH_BUFFER_BIT);
properties_.glState().pick_init (false); properties_.glState().pick_init (false);
...@@ -454,8 +454,8 @@ bool glViewer::pickGL( ACG::SceneGraph::PickTarget _pickTarget, ...@@ -454,8 +454,8 @@ bool glViewer::pickGL( ACG::SceneGraph::PickTarget _pickTarget,
glLoadMatrixd(projection.get_raw_data()); glLoadMatrixd(projection.get_raw_data());
glMatrixMode( GL_MODELVIEW ); glMatrixMode( GL_MODELVIEW );
glLoadMatrixd(modelview.get_raw_data()); glLoadMatrixd(modelview.get_raw_data());
glEnable(GL_LIGHTING); ACG::GLState::enable(GL_LIGHTING);
glEnable(GL_BLEND); ACG::GLState::enable(GL_BLEND);
// process hit record // process hit record
if ( hits > 0 ) if ( hits > 0 )
...@@ -571,9 +571,9 @@ bool glViewer::pick_region( ACG::SceneGraph::PickTarget _pickTarg ...@@ -571,9 +571,9 @@ bool glViewer::pick_region( ACG::SceneGraph::PickTarget _pickTarg
glMultMatrixd(projection.get_raw_data()); glMultMatrixd(projection.get_raw_data());
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glLoadMatrixd(modelview.get_raw_data()); glLoadMatrixd(modelview.get_raw_data());
glDisable(GL_LIGHTING); ACG::GLState::disable(GL_LIGHTING);
glDisable(GL_BLEND); ACG::GLState::disable(GL_BLEND);
glEnable(GL_DEPTH_TEST); ACG::GLState::enable(GL_DEPTH_TEST);
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
properties_.glState().pick_init (true); properties_.glState().pick_init (true);
...@@ -586,8 +586,8 @@ bool glViewer::pick_region( ACG::SceneGraph::PickTarget _pickTarg ...@@ -586,8 +586,8 @@ bool glViewer::pick_region( ACG::SceneGraph::PickTarget _pickTarg
glLoadMatrixd(projection.get_raw_data()); glLoadMatrixd(projection.get_raw_data());
glMatrixMode( GL_MODELVIEW ); glMatrixMode( GL_MODELVIEW );
glLoadMatrixd(modelview.get_raw_data()); glLoadMatrixd(modelview.get_raw_data());
glEnable(GL_LIGHTING); ACG::GLState::enable(GL_LIGHTING);
glEnable(GL_BLEND); ACG::GLState::enable(GL_BLEND);
properties_.glState().set_clear_color (clear_color); properties_.glState().set_clear_color (clear_color);
...@@ -713,9 +713,9 @@ bool glViewer::pick_region( ACG::SceneGraph::PickTarget _pickTarg ...@@ -713,9 +713,9 @@ bool glViewer::pick_region( ACG::SceneGraph::PickTarget _pickTarg
glMultMatrixd(projection.get_raw_data()); glMultMatrixd(projection.get_raw_data());
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glLoadMatrixd(modelview.get_raw_data()); glLoadMatrixd(modelview.get_raw_data());
glDisable(GL_LIGHTING); ACG::GLState::disable(GL_LIGHTING);
glDisable(GL_BLEND); ACG::GLState::disable(GL_BLEND);
glEnable(GL_DEPTH_TEST); ACG::GLState::enable(GL_DEPTH_TEST);
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
properties_.glState().pick_init (true); properties_.glState().pick_init (true);
...@@ -728,8 +728,8 @@ bool glViewer::pick_region( ACG::SceneGraph::PickTarget _pickTarg ...@@ -728,8 +728,8 @@ bool glViewer::pick_region( ACG::SceneGraph::PickTarget _pickTarg
glLoadMatrixd(projection.get_raw_data()); glLoadMatrixd(projection.get_raw_data());
glMatrixMode( GL_MODELVIEW ); glMatrixMode( GL_MODELVIEW );
glLoadMatrixd(modelview.get_raw_data()); glLoadMatrixd(modelview.get_raw_data());
glEnable(GL_LIGHTING); ACG::GLState::enable(GL_LIGHTING);
glEnable(GL_BLEND); ACG::GLState::enable(GL_BLEND);
properties_.glState().set_clear_color (clear_color); properties_.glState().set_clear_color (clear_color);
...@@ -886,9 +886,9 @@ bool glViewer::pick_region( ACG::SceneGraph::PickTarget _pickTarg ...@@ -886,9 +886,9 @@ bool glViewer::pick_region( ACG::SceneGraph::PickTarget _pickTarg
glMultMatrixd(projection.get_raw_data()); glMultMatrixd(projection.get_raw_data());
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glLoadMatrixd(modelview.get_raw_data()); glLoadMatrixd(modelview.get_raw_data());
glDisable(GL_LIGHTING); ACG::GLState::disable(GL_LIGHTING);
glDisable(GL_BLEND); ACG::GLState::disable(GL_BLEND);
glEnable(GL_DEPTH_TEST); ACG::GLState::enable(GL_DEPTH_TEST);
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
properties_.glState().pick_init (true); properties_.glState().pick_init (true);
...@@ -901,8 +901,8 @@ bool glViewer::pick_region( ACG::SceneGraph::PickTarget _pickTarg ...@@ -901,8 +901,8 @@ bool glViewer::pick_region( ACG::SceneGraph::PickTarget _pickTarg
glLoadMatrixd(projection.get_raw_data()); glLoadMatrixd(projection.get_raw_data());
glMatrixMode( GL_MODELVIEW ); glMatrixMode( GL_MODELVIEW );
glLoadMatrixd(modelview.get_raw_data()); glLoadMatrixd(modelview.get_raw_data());
glEnable(GL_LIGHTING); ACG::GLState::enable(GL_LIGHTING);
glEnable(GL_BLEND); ACG::GLState::enable(GL_BLEND);
properties_.glState().set_clear_color (clear_color); properties_.glState().set_clear_color (clear_color);
...@@ -1060,9 +1060,9 @@ bool glViewer::pick_region( ACG::SceneGraph::PickTarget _pickTarg ...@@ -1060,9 +1060,9 @@ bool glViewer::pick_region( ACG::SceneGraph::PickTarget _pickTarg
glMultMatrixd(projection.get_raw_data()); glMultMatrixd(projection.get_raw_data());
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glLoadMatrixd(modelview.get_raw_data()); glLoadMatrixd(modelview.get_raw_data());
glDisable(GL_LIGHTING); ACG::GLState::disable(GL_LIGHTING);
glDisable(GL_BLEND); ACG::GLState::disable(GL_BLEND);
glEnable(GL_DEPTH_TEST); ACG::GLState::enable(GL_DEPTH_TEST);
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
properties_.glState().pick_init (true); properties_.glState().pick_init (true);
...@@ -1075,8 +1075,8 @@ bool glViewer::pick_region( ACG::SceneGraph::PickTarget _pickTarg ...@@ -1075,8 +1075,8 @@ bool glViewer::pick_region( ACG::SceneGraph::PickTarget _pickTarg
glLoadMatrixd(projection.get_raw_data()); glLoadMatrixd(projection.get_raw_data());
glMatrixMode( GL_MODELVIEW ); glMatrixMode( GL_MODELVIEW );
glLoadMatrixd(modelview.get_raw_data()); glLoadMatrixd(modelview.get_raw_data());
glEnable(GL_LIGHTING); ACG::GLState::enable(GL_LIGHTING);
glEnable(GL_BLEND); ACG::GLState::enable(GL_BLEND);
properties_.glState().set_clear_color (clear_color); properties_.glState().set_clear_color (clear_color);
......
...@@ -356,15 +356,15 @@ glViewer::drawScene_customAnaglyphStereo() ...@@ -356,15 +356,15 @@ glViewer::drawScene_customAnaglyphStereo()
glCopyTexSubImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, 0, 0, vp_l, vp_b, vp_w, vp_h); glCopyTexSubImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, 0, 0, vp_l, vp_b, vp_w, vp_h);
ACG::GLState::bindTexture (GL_TEXTURE_RECTANGLE_ARB, 0); ACG::GLState::bindTexture (GL_TEXTURE_RECTANGLE_ARB, 0);
glActiveTexture (GL_TEXTURE0); ACG::GLState::activeTexture (GL_TEXTURE0);
ACG::GLState::bindTexture (GL_TEXTURE_RECTANGLE_ARB, agTexture_[0]); ACG::GLState::bindTexture (GL_TEXTURE_RECTANGLE_ARB, agTexture_[0]);
glEnable (GL_TEXTURE_RECTANGLE_ARB); ACG::GLState::enable (GL_TEXTURE_RECTANGLE_ARB);
glActiveTexture (GL_TEXTURE1); ACG::GLState::activeTexture (GL_TEXTURE1);
ACG::GLState::bindTexture (GL_TEXTURE_RECTANGLE_ARB, agTexture_[1]); ACG::GLState::bindTexture (GL_TEXTURE_RECTANGLE_ARB, agTexture_[1]);
glEnable (GL_TEXTURE_RECTANGLE_ARB); ACG::GLState::enable (GL_TEXTURE_RECTANGLE_ARB);
glEnable (GL_FRAGMENT_PROGRAM_ARB); ACG::GLState::enable (GL_FRAGMENT_PROGRAM_ARB);
glBindProgramARB (GL_FRAGMENT_PROGRAM_ARB, agProgram_); glBindProgramARB (GL_FRAGMENT_PROGRAM_ARB, agProgram_);
glProgramEnvParameter4fARB (GL_FRAGMENT_PROGRAM_ARB, 0, le[0], le[3], le[6], 0.0); glProgramEnvParameter4fARB (GL_FRAGMENT_PROGRAM_ARB, 0, le[0], le[3], le[6], 0.0);
...@@ -381,7 +381,7 @@ glViewer::drawScene_customAnaglyphStereo() ...@@ -381,7 +381,7 @@ glViewer::drawScene_customAnaglyphStereo()
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glLoadIdentity(); glLoadIdentity();
ACG::GLState::disable(GL_DEPTH_TEST); ACG::GLState::disable (GL_DEPTH_TEST);
glBegin (GL_QUADS); glBegin (GL_QUADS);
glMultiTexCoord2f (GL_TEXTURE0, 0, vp_h); glMultiTexCoord2f (GL_TEXTURE0, 0, vp_h);
...@@ -398,18 +398,18 @@ glViewer::drawScene_customAnaglyphStereo() ...@@ -398,18 +398,18 @@ glViewer::drawScene_customAnaglyphStereo()
glVertex2i(vp_w, 0); glVertex2i(vp_w, 0);
glEnd (); glEnd ();
glEnable (GL_DEPTH_TEST); ACG::GLState::enable (GL_DEPTH_TEST);
glBindProgramARB (GL_FRAGMENT_PROGRAM_ARB, 0); glBindProgramARB (GL_FRAGMENT_PROGRAM_ARB, 0);
ACG::GLState::disable(GL_FRAGMENT_PROGRAM_ARB); ACG::GLState::disable (GL_FRAGMENT_PROGRAM_ARB);
glActiveTexture (GL_TEXTURE1); ACG::GLState::activeTexture (GL_TEXTURE1);
ACG::GLState::bindTexture (GL_TEXTURE_RECTANGLE_ARB, 0); ACG::GLState::bindTexture (GL_TEXTURE_RECTANGLE_ARB, 0);
ACG::GLState::disable(GL_TEXTURE_RECTANGLE_ARB); ACG::GLState::disable (GL_TEXTURE_RECTANGLE_ARB);
glActiveTexture (GL_TEXTURE0); ACG::GLState::activeTexture (GL_TEXTURE0);
ACG::GLState::bindTexture (GL_TEXTURE_RECTANGLE_ARB, 0); ACG::GLState::bindTexture (GL_TEXTURE_RECTANGLE_ARB, 0);
ACG::GLState::disable(GL_TEXTURE_RECTANGLE_ARB); ACG::GLState::disable (GL_TEXTURE_RECTANGLE_ARB);
} }
......
Supports Markdown
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