void AppearanceNode::setGLState(GLRenderState& renderState) const
	{
	if(material.getValue()!=0)
		material.getValue()->setGLState(renderState);
	else
		{
		renderState.disableMaterials();
		renderState.emissiveColor=GLRenderState::Color(0.0f,0.0f,0.0f);
		}
	
	if(texture.getValue()!=0)
		{
		texture.getValue()->setGLState(renderState);
		if(textureTransform.getValue()!=0)
			{
			/* Set the texture transformation: */
			glMatrixMode(GL_TEXTURE);
			glPushMatrix();
			glMultMatrix(textureTransform.getValue()->getTransform());
			glMatrixMode(GL_MODELVIEW);
			}
		}
	else
		renderState.disableTextures();
	}
Example #2
0
void ShapeNode::glRenderAction(GLRenderState& renderState) const
{
    /* Set the attribute node's OpenGL state: */
    if(appearance.getValue()!=0)
        appearance.getValue()->setGLState(renderState);
    else
    {
        /* Turn off all appearance aspects: */
        renderState.disableMaterials();
        renderState.emissiveColor=GLRenderState::Color(1.0f,1.0f,1.0f);
        renderState.disableTextures();
    }

    /* Render the geometry node: */
    if(geometry.getValue()!=0)
        geometry.getValue()->glRenderAction(renderState);

    /* Reset the attribute node's OpenGL state: */
    if(appearance.getValue()!=0)
        appearance.getValue()->resetGLState(renderState);
}