Ejemplo n.º 1
0
        void EntityRenderer::render(RenderContext& context) {
            if (!m_boundsValid)
                validateBounds(context);
            if (!m_modelRendererCacheValid)
                validateModels(context);

            if (context.viewOptions().showEntityModels())
                renderModels(context);
            if (context.viewOptions().showEntityBounds())
                renderBounds(context);
            if (context.viewOptions().showEntityClassnames())
                renderClassnames(context);
        }
void CCSceneObject::render(const bool alpha)
{	
    if( shouldRender )
    {
        if( alpha == false || transparentParent )
        {
            {
                for( int i=0; i<children.length; ++i )
                {
                    children.list[i]->render( alpha );
                }

                if( alpha == transparent )
                {
                    renderModels( alpha );
                }
            }
        }
    }
}
Ejemplo n.º 3
0
void onRender() {
	//Calculate fps
	totalFrames++;
	int current = glutGet(GLUT_ELAPSED_TIME);
	if((current - startTime) > 1000) {
		float elapsedTime = float(current-startTime);
		fps = ((float)(totalFrames * 1000) / elapsedTime) ;
		startTime = current;
		totalFrames=0;
	}

	snprintf(buffer, HUD_BUFFER_SIZE, "FPS: %3.2f", fps);

	resetPerspectiveProjection();

	// Handle reshaping (preparing NiViewer)
	glViewport(0, 0, nw, nh);
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	gluPerspective(60, (GLfloat)nw / (GLfloat)nh, 0.1f, 100.0f);
	glMatrixMode(GL_MODELVIEW);

	glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
	glTranslatef(0,0,dist);
	glRotatef(rX,0,1,0);
	glRotatef(rY,1,0,0);

	renderModels();

	setOrthoForFont();
	glColor3f(1,1,1);
	//Show the fps
	renderSpacedBitmapString(20, 20, 0, GLUT_BITMAP_HELVETICA_12, buffer);

	glutSwapBuffers();
}