亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? gl_app.cpp

?? game programing code
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
//==============================================================
//==============================================================
//= gl_app.cpp =================================================
//= Original coder: Trent Polack (trent@voxelsoft.com)			
//==============================================================
//= The application component from "the Engine Project."		
//==============================================================
//==============================================================


//--------------------------------------------------------------
//--------------------------------------------------------------
//- HEADERS AND LIBRARIES --------------------------------------
//--------------------------------------------------------------
//--------------------------------------------------------------
#include "gl_app.h"
#include "image.h"
#include "log.h"

#pragma comment( lib, "winmm.lib" )
#pragma comment( lib, "opengl32.lib" )
#pragma comment( lib, "glu32.lib" )


//--------------------------------------------------------------
//--------------------------------------------------------------
//- VARIABLES --------------------------------------------------
//--------------------------------------------------------------
//--------------------------------------------------------------
//the window's dimensions
int CGL_APP::m_iWidth;
int CGL_APP::m_iHeight;
int CGL_APP::m_iBPP;
WORD CGL_APP::m_menuCommand;

//input variables
int CGL_APP::m_iMouseX;
int CGL_APP::m_iMouseY;
int CGL_APP::m_iMouseButton;
bool CGL_APP::m_bKeys[256];

bool CGL_APP::m_bActive;
bool CGL_APP::m_bChangeSize;

PFNGLACTIVETEXTUREARBPROC	    glActiveTextureARB= NULL;
PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTextureARB= NULL;
PFNGLMULTITEXCOORD2FARBPROC	    glMultiTexCoord2fARB;
PFNGLMULTITEXCOORD2DARBPROC     glMultiTexCoord2dARB;

PFNGLLOCKARRAYSEXTPROC   glLockArraysEXT;
PFNGLUNLOCKARRAYSEXTPROC glUnlockArraysEXT;

PFNGLFOGCOORDFEXTPROC glFogCoordfEXT;

//--------------------------------------------------------------
//--------------------------------------------------------------
//- DEFINITIONS ------------------------------------------------
//--------------------------------------------------------------
//--------------------------------------------------------------

//--------------------------------------------------------------
// Name:			CGL_APP::Init - public
// Description:		Initiate an OpenGL application
// Arguments:		-iX, iY: the upperleft position of the window
//					-iWidth, iHeight: the dimensions of the window
//					-iBPP: the pixel depth of the window (usually 16 or 32)
//					-szTitle: the title to appear in the window's titlebar
//					-icon: a resource ID for a program application icon (defaults to NULL)
//					-menu: a resource ID for a menu (defaults to NULL)
// Return Value:	A boolean variable: -true: successful window initiation
//										-false: unsuccessful window initiation
//--------------------------------------------------------------
bool CGL_APP::Init( int iX, int iY, int iWidth, int iHeight, int iBPP, 
					const char* szTitle, WORD icon, WORD menu )
{
	WNDCLASS winclass;				//The windows class structure
	unsigned int uiPixelFormat;		//Hold the correct match for the pixel format

	//initiate the program log
	g_log.Init( "program log.html" );

	if( m_timer.Init( ) )
		g_log.Write( LOG_PLAINTEXT, "Performance timer has been initialized" );
	else
		g_log.Write( LOG_PLAINTEXT, "Multimedia timer has been initialized" );

	//record the dimensions in the class's members
	m_iWidth = iWidth;
	m_iHeight= iHeight;
	m_iBPP   = iBPP;

	//customize the window's parameters
	m_hInstance			  = GetModuleHandle( NULL );				//get the window's instance
	winclass.style		  = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;		//redraw the window on resize
	winclass.lpfnWndProc  = WindowProc;								//handle the WINPROC messages
	winclass.cbClsExtra	  = 0;										//no extra win data
	winclass.cbWndExtra	  = 0;										//no extra win data
	winclass.hInstance	  = m_hInstance;							//get the window's instance
	winclass.hIcon		  = LoadIcon( NULL, MAKEINTRESOURCE( icon ) );//load an icon
	winclass.hCursor	  = LoadCursor( NULL, IDC_ARROW );			//load the mouse pointer
	winclass.lpszMenuName = MAKEINTRESOURCE( menu );				//load the menu
	winclass.hbrBackground= ( HBRUSH )GetStockObject( BLACK_BRUSH );//no background required for OpenGL stuff
	winclass.lpszClassName= APP_CLASSNAME;							//set the class name

	//register the window class
	if( !RegisterClass(&winclass ) )
	{
		g_log.Write( LOG_FAILURE, "WINDOW FAILURE: could not register class" );
		return false;		
	}
	//ruh-roh, something screwed up
	else
		g_log.Write( LOG_SUCCESS, "WINDOW SUCCESS: class registered" );

	//create the window
	if( !( m_hWnd=CreateWindowEx( WS_EX_CLIENTEDGE,			//the extended style for the window
							      APP_CLASSNAME,			//the class name
							      szTitle,					//the window's title
							      WS_SYSMENU | WS_BORDER | WS_CAPTION | WS_VISIBLE,
							      iX, iY,					//the window's position
							      m_iWidth,					//calculate the window's width
							      m_iHeight,				//calculate the window's height
							      NULL,						//no parent window
							      NULL,						//no menu needed
							      m_hInstance,				//the window's instance
							      NULL ) ) )				//nothing to pass to WM_CREATE
	{
		//the window could not be created
		Shutdown( );				
		g_log.Write( LOG_FAILURE, "WINDOW ERROR: window could not be created" );
		return false;			
	}

	//get the pixel format's description
	static PIXELFORMATDESCRIPTOR pfd=
	{
		sizeof( PIXELFORMATDESCRIPTOR ),	//Get the size of the structure
		1,									//Version number
		PFD_DRAW_TO_WINDOW |				//Format must support Windows
		PFD_SUPPORT_OPENGL |				//Format must support OpenGL
		PFD_DOUBLEBUFFER,					//Must support Double Buffering
		PFD_TYPE_RGBA,						//Request a RGBA (red,green,blue,alpha) format
		m_iBPP,								//Select the bits per pixel
		0, 0, 0, 0, 0, 0,					//Color bits ignored
		0,									//No alpha buffer
		0,									//shift bit ignored
		0,									//No accumulation buffer (advanced)
		0, 0, 0, 0,							//Accumulation bits ignored
		32,									//16 bit Z-Buffer (Depth Buffer)  
		0,									//No Stencil Buffer (advanced)
		0,									//No Auxiliary Buffer (advanced)
		PFD_MAIN_PLANE,						//The main drawing layer
		0,									//Reserved area
		0, 0, 0								//Layer masks ignored
	};
	
	//get a handle to the device context
	if( !( m_hDC= GetDC( m_hWnd ) ) )
	{
		//no device context for us
		Shutdown( );
		MessageBox( m_hWnd, "Could not create a OpenGL device context", "RENDERER ERROR", MB_OK | MB_ICONSTOP );
		return false;								
	}

	//find a compatible pixel format
	if(!(uiPixelFormat= ChoosePixelFormat(m_hDC, &pfd)))
	{
		//no suitable pixel format
		Shutdown( );
		MessageBox( m_hWnd, "Could not find a suitable pixel format", "RENDERER ERROR", MB_OK | MB_ICONSTOP );
		return false;
	}

	//set the previously found pixel format
	if( !SetPixelFormat( m_hDC, uiPixelFormat, &pfd ) )
	{
		//could not set the pixel format
		Shutdown( );
		MessageBox( m_hWnd, "Could not set pixel format", "RENDERER ERROR", MB_OK | MB_ICONSTOP );
		return false;
	}
	
	//get a handle to the application's rendering context
	if( !( m_hRC= wglCreateContext( m_hDC ) ) )
	{
		//could not get OpenGL support
		Shutdown( );
		MessageBox( m_hWnd, "Could not create the OpenGL rendering context", "RENDERER ERROR", MB_OK | MB_ICONSTOP );
		return false;		
	}

	//set the device and rendering context to our window (activating OpenGL)
	if( !wglMakeCurrent( m_hDC, m_hRC ) )
	{
		//could not activate OpenGL
		Shutdown( );
		MessageBox( m_hWnd, "Could not activate the OpenGL rendering context", "RENDERER ERROR", MB_OK | MB_ICONSTOP );
		return false;
	}

	glShadeModel( GL_SMOOTH );							//Enable smooth shading (so you can't see the individual polygons of a primitive, best shown when drawing a sphere)
	glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );
	glClearDepth( 1.0 );									//Depth buffer setup
	glDepthFunc( GL_LEQUAL );								//The type of depth testing to do (LEQUAL==less than or equal to)
	glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST );	//The nicest perspective look

	ShowWindow( m_hWnd, SW_SHOW );						//Show the window
	SetForegroundWindow( m_hWnd );						//Give the window a high priority
	SetFocus( m_hWnd );									//Sets the keyboard's focus to the window

	//setup the program's perspective view
	ResizeScene( m_iWidth, m_iHeight );

	m_szSupportedGLExtensions= ( char* )glGetString( GL_EXTENSIONS );

	if( CheckExtension( "GL_ARB_multitexture" ) )
	{
		glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &m_iNumTextureUnits);
		if(m_iNumTextureUnits > 1)
			m_bCanMultitexture= true;
		else
			m_bCanMultitexture= false;
	}
	else
		m_bCanMultitexture= false;

	glActiveTextureARB		= ( PFNGLACTIVETEXTUREARBPROC )	     wglGetProcAddress( "glActiveTextureARB" );
	glClientActiveTextureARB= ( PFNGLCLIENTACTIVETEXTUREARBPROC )wglGetProcAddress( "glClientActiveTextureARB" );
	glMultiTexCoord2fARB	= ( PFNGLMULTITEXCOORD2FARBPROC )	 wglGetProcAddress( "glMultiTexCoord2fARB" );
	glMultiTexCoord2dARB	= ( PFNGLMULTITEXCOORD2DARBPROC )	 wglGetProcAddress( "glMultiTexCoord2dARB" );

	g_log.Write( LOG_RENDERER, "Multitexturing has been initiated, and your video card supports %d texture units", m_iNumTextureUnits );

	if( CheckExtension( "GL_EXT_compiled_vertex_array" ) )
		m_bCanCVA= true;
	else
		m_bCanCVA= false;

	CheckExtension( "GL_CLAMP_TO_EDGE" );

	//configure the volumetric fog system
	if( CheckExtension( "GL_EXT_fog_coord" ) )
		glFogCoordfEXT= ( PFNGLFOGCOORDFEXTPROC )wglGetProcAddress( "glFogCoordfEXT" );

	glLockArraysEXT  = ( PFNGLLOCKARRAYSEXTPROC )  wglGetProcAddress( "glLockArraysEXT" );
	glUnlockArraysEXT= ( PFNGLUNLOCKARRAYSEXTPROC )wglGetProcAddress( "glUnlockArraysEXT" );

	m_bActive= APP_ACTIVE;
	g_log.Write( LOG_SUCCESS, "WINDOW SUCCESS: A %dx%dx%d window has been created", m_iWidth, m_iHeight, m_iBPP);
	return true;
}

//--------------------------------------------------------------
// Name:			CGL_APP::Shutdown - public
// Description:		Shutdown an OpenGL application
// Arguments:		None
// Return Value:	None
//--------------------------------------------------------------
void CGL_APP::Shutdown( void )
{
	ShowCursor( TRUE );

	//Release the main window handle
	if( m_hWnd && !DestroyWindow( m_hWnd ) )
	{
		g_log.Write( LOG_FAILURE, "WINDOW ERROR: could not release main handle" );
		m_hWnd= NULL;					
	}
	else
		g_log.Write( LOG_SUCCESS, "WINDOW SUCCESS: released Main handle" );

	//Unregister the window's class
	if( !UnregisterClass( APP_CLASSNAME, m_hInstance ) )
	{
		g_log.Write( LOG_FAILURE, "WINDOW ERROR: could not unregister class" );	
		m_hInstance= NULL;			
	}
	else
		g_log.Write( LOG_SUCCESS, "WINDOW SUCCESS: unregistered class" );
}

//--------------------------------------------------------------
// Name:			CGL_APP::Shutdown - public
// Description:		Check to see if the current graphics card supports
//					the given OpenGL extension
// Arguments:		-szExtensionName: the extension to check
// Return Value:	A boolean variable: -true: the extension is supported
//										-false: the extenson is not supported
//--------------------------------------------------------------
bool CGL_APP::CheckExtension( char* szExtensionName )
{
	unsigned int uiNextExtension;
	char*		 szSupExt= m_szSupportedGLExtensions;
	char*		 cEndExtensions;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
美女在线视频一区| 亚洲第一久久影院| 国产精品12区| 中文字幕永久在线不卡| 成+人+亚洲+综合天堂| 亚洲品质自拍视频| 欧美亚洲一区三区| 日本中文字幕不卡| 久久久精品免费观看| aaa欧美日韩| 亚洲成av人片一区二区梦乃| 日韩亚洲欧美一区| 国产suv精品一区二区6| 亚洲欧美日韩国产综合在线| 欧美疯狂做受xxxx富婆| 韩国理伦片一区二区三区在线播放| 久久久三级国产网站| 97久久精品人人爽人人爽蜜臀| 亚洲最新视频在线观看| 日韩午夜激情免费电影| 成人一级视频在线观看| 一区二区高清视频在线观看| 日韩一区二区精品葵司在线| 成人午夜精品在线| 午夜精品一区二区三区免费视频| 欧美大片一区二区| 色素色在线综合| 蜜桃一区二区三区在线观看| 国产精品久久久久久福利一牛影视| 欧美日韩在线播| 夫妻av一区二区| 天天色综合成人网| 国产精品久久久久7777按摩| 欧美吞精做爰啪啪高潮| 丰满岳乱妇一区二区三区| 午夜不卡在线视频| 亚洲欧洲精品成人久久奇米网| 91精品国产综合久久精品图片| 丁香天五香天堂综合| 日本不卡一二三| 亚洲欧美日韩久久| 国产三级精品三级| 日韩欧美的一区二区| 99re视频这里只有精品| 在线免费观看视频一区| 精品亚洲porn| 婷婷中文字幕综合| 亚洲欧美电影一区二区| 久久噜噜亚洲综合| 日韩免费福利电影在线观看| 91成人国产精品| 成人免费视频视频| 国产米奇在线777精品观看| 亚洲福利视频导航| 亚洲人被黑人高潮完整版| 日本一区二区三区在线观看| 2024国产精品| 精品国产网站在线观看| 欧美一区在线视频| 欧美日韩免费电影| 在线观看亚洲一区| 色呦呦国产精品| 色先锋资源久久综合| 99热在这里有精品免费| 成人午夜免费电影| av日韩在线网站| 成人av影院在线| 成人av在线看| 91麻豆精东视频| 91美女片黄在线| 91免费观看国产| 91福利小视频| 欧美日韩亚洲综合在线| 欧美视频一区在线| 欧美性猛交xxxxxxxx| 91成人网在线| 欧美日韩黄色一区二区| 欧美日本一区二区在线观看| 欧美日韩一区成人| 欧美一区二区三区性视频| 717成人午夜免费福利电影| 91.xcao| 欧美日韩精品久久久| 欧美日本不卡视频| 欧美一三区三区四区免费在线看| 日韩欧美一区二区久久婷婷| 欧美成人性福生活免费看| 久久尤物电影视频在线观看| 国产亚洲欧美日韩俺去了| 欧美激情综合网| 亚洲天堂成人网| 亚洲福利一二三区| 久久99国产精品久久| 国产成人午夜精品5599| 99视频超级精品| 欧美日韩免费观看一区三区| 欧美一区二区二区| 国产偷国产偷亚洲高清人白洁| 中文字幕电影一区| 亚洲狠狠爱一区二区三区| 秋霞午夜av一区二区三区| 国内精品自线一区二区三区视频| 成人一级黄色片| 欧美性猛交xxxx黑人交| 精品国产亚洲在线| 亚洲精品一二三区| 91精品啪在线观看国产60岁| 精品在线你懂的| 日本欧美肥老太交大片| 国产呦萝稀缺另类资源| 91视频你懂的| 日韩片之四级片| 亚洲视频一区在线观看| 亚洲成人7777| 国产91精品欧美| 欧美日免费三级在线| 久久女同性恋中文字幕| 亚洲综合男人的天堂| 国产露脸91国语对白| 91成人免费在线视频| 国产日韩欧美在线一区| 婷婷综合在线观看| 成熟亚洲日本毛茸茸凸凹| 欧美男女性生活在线直播观看| 久久九九国产精品| 亚洲一区电影777| 懂色av噜噜一区二区三区av| 这里只有精品视频在线观看| 国产欧美精品一区aⅴ影院 | 欧美一区二区视频网站| 国产精品久久综合| 精品在线播放午夜| 欧美在线观看视频一区二区 | 99视频超级精品| 精品福利一区二区三区| 亚洲午夜一二三区视频| 成人午夜视频网站| 精品理论电影在线| 午夜精品福利久久久| 色菇凉天天综合网| 欧美激情一区二区三区在线| 日本aⅴ精品一区二区三区| 色av综合在线| 中文字幕日韩欧美一区二区三区| 激情六月婷婷综合| 欧美日本国产视频| 亚洲欧美激情在线| k8久久久一区二区三区| 久久精品欧美日韩精品| 喷水一区二区三区| 欧美精品免费视频| 亚洲成人综合视频| 欧美一a一片一级一片| 亚洲精品视频免费观看| 成人av高清在线| 国产农村妇女毛片精品久久麻豆 | 色爱区综合激月婷婷| 亚洲欧洲精品一区二区三区 | 国产91富婆露脸刺激对白| 欧美成人精品二区三区99精品| 三级精品在线观看| 欧美另类z0zxhd电影| 午夜欧美电影在线观看| 精品视频在线免费观看| 亚洲高清在线精品| 欧美精品粉嫩高潮一区二区| 性欧美大战久久久久久久久| 欧美在线你懂得| 亚洲综合在线第一页| 在线亚洲人成电影网站色www| 亚洲精品国产一区二区三区四区在线| 成人av在线资源| 亚洲精品你懂的| 欧美熟乱第一页| 日韩高清一区在线| 精品日韩欧美在线| 国产在线播放一区| 国产精品美日韩| 91成人免费在线视频| 日本不卡视频一二三区| 久久久美女艺术照精彩视频福利播放| 狠狠网亚洲精品| 国产精品色呦呦| 在线观看亚洲专区| 免费成人在线观看视频| 久久久久久久久久美女| 99国产欧美另类久久久精品| 一区二区三区免费观看| 91精品久久久久久蜜臀| 国产精品综合一区二区三区| 国产精品久久夜| 欧美人牲a欧美精品| 国内精品久久久久影院薰衣草| 国产精品水嫩水嫩| 欧美私人免费视频| 国产精品综合一区二区三区| 一区二区三区在线视频免费| 欧美一级欧美一级在线播放| 大白屁股一区二区视频| 天天爽夜夜爽夜夜爽精品视频|