Пример #1
0
void Render()
{
	::shadowmatid = MaterialFind("extendvolume");
	if(updatecube)
	{
		if(!CubeMap) initcube();
		UpdateCube();
	}
	camera.RenderSetUp(); // in case updatecube() screwed stuff up.
	RenderStuff();

	extern void DoneMeshRendering();
	DoneMeshRendering(); // tells mesh module it can remove pointers to temp meshes.

	HRESULT hr = g_pd3dDevice->Present( NULL, NULL, NULL, NULL );     // Present the backbuffer contents to the display
	// if(hr==D3DERR_DEVICELOST)
}
Пример #2
0
void viewport::draw() {
    if (!valid()) {
        initcube();
        glClearColor(0.0, 0.0, 0.0, 0.0);
        glClearDepth(1.0);
        glDepthFunc(GL_LESS);
        glEnable(GL_DEPTH_TEST);
        glShadeModel(GL_FLAT);
    }

    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    // Position camera/viewport init
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glViewport(0,0,w(),h());
    gluPerspective(45.0, (float)w()/(float)h(), 1.0, 10.0);
    glTranslatef(0.0, 0.0, -5.0);
    // Position object
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    glRotatef(pitch, 1.0, 0.0, 0.0);
    glRotatef(roll, 0.0, 0.0, 1.0);

#if 1
        glColor3f(1.0, 0.0, 0.0); glBegin(GL_POLYGON); glVertex3f(TOP);   glVertex3f(RIGHT);  glVertex3f(LEFT);  glEnd();
        glColor3f(0.0, 1.0, 0.0); glBegin(GL_POLYGON); glVertex3f(TOP);   glVertex3f(BACK);   glVertex3f(RIGHT); glEnd();
        glColor3f(0.0, 0.0, 1.0); glBegin(GL_POLYGON); glVertex3f(TOP);   glVertex3f(LEFT);   glVertex3f(BACK);  glEnd();
        glColor3f(0.5, 0.5, 0.5); glBegin(GL_POLYGON); glVertex3f(RIGHT); glVertex3f(BACK);   glVertex3f(LEFT);  glEnd();
#else
    for (int i = 0; i < 6; i++) {
        glBegin(GL_QUADS);
        glColor3f(1/6.0*i, 0, 0);
        glNormal3fv(&n[i][0]);
        glVertex3fv(&v[faces[i][0]][0]);
        glVertex3fv(&v[faces[i][1]][0]);
        glVertex3fv(&v[faces[i][2]][0]);
        glVertex3fv(&v[faces[i][3]][0]);
        glEnd();
    }
#endif
}