OpenGL绘制长方体线框

实现代码如下:
#include  
void ChangeSize(int w, int h)
{
	glViewport(0,0,(GLsizei)w,(GLsizei)h);
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	glFrustum(-1.0,1.0,-1.0,1.0,1.5,20.0);
	glMatrixMode(GL_MODELVIEW);
}
void RenderScene(void)
{
	glClear(GL_COLOR_BUFFER_BIT);
	glColor3f(1.0f,1.0f,1.0f);
	glLoadIdentity();
	gluLookAt(0.0,0.0,5.0,0.0,0.0,0.0,0.0,1.0,0.0);
	glScalef(1.0f,2.0f,1.0f);
	glutWireCube(1.0);
	glutSwapBuffers();
}
int main(int argc, char* argv[])
{
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
	glutInitWindowSize(800, 600);
	glutCreateWindow("3D Effects Demo");
	glutReshapeFunc(ChangeSize);
	//glutKeyboardFunc(KeyPressFunc);
	glutDisplayFunc(RenderScene);

	//SetupRC();

	glutMainLoop();
	//glDeleteTextures(4,textures);
	return 0;
} 
 

你可能感兴趣的:(OpenGL绘制长方体线框)