window.cc

来自「本文件中收录了多种3D文件格式」· CC 代码 · 共 62 行

CC
62
字号
//// File: Window.h// Created by: <Andrea Ingegneri>//#include <string>using namespace std;#include <GL/glut.h>#include "Window.h"CWindow::CWindow(string Title, int PosX, int PosY, int DimX, int DimY) :				 mTitle(Title), mPosX(PosX), mPosY(PosY), mDimX(DimX), mDimY(DimY){}void CWindow::Init(){	glShadeModel(GL_SMOOTH);     	glClearColor(0.0f, 0.0f, 0.0f, 0.5f);  	glClearDepth(1.0f);         	glEnable(GL_DEPTH_TEST);    	glDepthFunc(GL_LEQUAL);      	glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);}void CWindow::Reshape(int DimX, int DimY){	if (DimY==0)        	{		DimY=1;        	}	glViewport(0, 0, DimX, DimY);   	glMatrixMode(GL_PROJECTION);   	glLoadIdentity();      			gluPerspective(45.0f,(GLfloat)DimX/(GLfloat)DimY,0.1f,100.0f);		glMatrixMode(GL_MODELVIEW);    	glLoadIdentity();     }void CWindow::Display(){	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);	glLoadIdentity();        	glTranslatef(-1.5f,0.0f,-6.0f);     	glFlush();}void CWindow::Idle(){	Display();}void CWindow::Keyboard(unsigned char key, int x, int y){}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?