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

Fixed performance degression by caching the drawmode.

closes #1695

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@17250 383ad7c9-94d9-4d36-a494-682f7c89f535
parent c22d7242
......@@ -83,8 +83,11 @@ TextureNode::TextureNode( BaseNode* _parent,
mipmapping_globally_active_(true),
last_mipmapping_status_(true),
mipmapping_(true),
activeTexture_(-1)
activeTexture_(-1),
open_volume_mesh_texture_draw_modes_()
{
open_volume_mesh_texture_draw_modes_ = DrawModes::getDrawMode("Faces (textured)");
open_volume_mesh_texture_draw_modes_ |= DrawModes::getDrawMode("Faces (textured and shaded)");
}
......@@ -516,10 +519,7 @@ void TextureNode::enter(GLState& _state , const DrawModes::DrawMode& _drawmode)
DrawModes::SOLID_2DTEXTURED_FACE |
DrawModes::SOLID_2DTEXTURED_FACE_SHADED |
DrawModes::SOLID_SHADER |
//OpenVolumeMesh DrawModes
DrawModes::getDrawMode("Faces (textured)") |
DrawModes::getDrawMode("Faces (textured and shaded)") ))
open_volume_mesh_texture_draw_modes_ ))
{
ACG::GLState::enable( GL_TEXTURE_2D );
......@@ -555,10 +555,7 @@ void TextureNode::leave(GLState& /* _state */ , const DrawModes::DrawMode& _draw
DrawModes::SOLID_2DTEXTURED_FACE |
DrawModes::SOLID_2DTEXTURED_FACE_SHADED |
DrawModes::SOLID_SHADER |
//OpenVolumeMesh DrawModes
DrawModes::getDrawMode("Faces (textured)") |
DrawModes::getDrawMode("Faces (textured and shaded)") ))
open_volume_mesh_texture_draw_modes_ ))
{
ACG::GLState::bindTexture( GL_TEXTURE_2D, 0 );
ACG::GLState::disable( GL_TEXTURE_2D );
......
......@@ -338,6 +338,12 @@ private:
* This index is an index to the textures_ vector! Not the GLuint!!
*/
int activeTexture_;
/** \brief OpenVolumeMesh DrawModes using textures
*
* Texturing will be activated for all DrawModes which are combined in this DrawMode
*/
DrawModes::DrawMode open_volume_mesh_texture_draw_modes_;
};
......
......@@ -137,6 +137,8 @@ void VolumeMeshObject<MeshT>::init() {
if(OpenFlipper::Options::nogui())
return;
VolumeMeshDrawModesContainer drawModes; // create this object before initializing the textureNode
textureNode_ = new ACG::SceneGraph::TextureNode(materialNode() , "NEW TextureNode for ");
shaderNode_ = new ACG::SceneGraph::ShaderNode(textureNode_ , "NEW ShaderNode for ");
......@@ -156,7 +158,6 @@ void VolumeMeshObject<MeshT>::init() {
std::string shaderDirectory = std::string( shaderDir.toUtf8() );
shaderNode_->setShaderDir( shaderDirectory );
VolumeMeshDrawModesContainer drawModes;
if ( QFile( shaderDir + "Phong/Vertex.glsl").exists() && QFile( shaderDir + "Phong/Fragment.glsl" ).exists() )
{
shaderNode_->setShader(drawModes.cellsPhongShaded, "Phong/Vertex.glsl" , "Phong/Fragment.glsl" );
......
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