⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 window.cpp

📁 本文件中收录了多种3D文件格式
💻 CPP
字号:
// Window.cpp: implementation of the CWindow class.
//
//////////////////////////////////////////////////////////////////////

#include <string>
using namespace std;

#include <GL/glut.h>

#include "Window.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -