资源简介
openGL特效动画包,包含7个动画的工程文件,其中包含水波流动,粒子特效,魔幻特效等效果的动画
代码片段和文件信息
// Main Include
#include “main.h“
#include “src/keyb.h“
// Main Setting
bool g_bFullScreen = FALSE;
HWND g_hWnd;
RECT g_rRect;
HDC g_hDC;
HGLRC g_hRC;
HINSTANCE g_hInstance;
Naskel3D Naskel;
CCamera objCamera;
GLdouble mouse_x mouse_y;
GLdouble mouse_3d_x mouse_3d_y;
POINT MouseDownPoint;
// Main Definition
LRESULT CALLBACK WinProc(HWND hWnd UINT message WPARAM wParam LPARAM lParam);
void RenderScene();
int seq = 0;
int num_water=6;
int key_move[4];
bool GotNextScene = false;
float m_Z=-0.5f;
float StartTime=0.0f;
bool bukey = false;
bool bdkey = false;
extern float cubeH;
void ChangeToFullScreen()
{
DEVMODE dmSettings;
memset(&dmSettings0sizeof(dmSettings));
if(!EnumDisplaySettings(NULLENUM_CURRENT_SETTINGS&dmSettings)) {
MessageBox(NULL “Could Not Enum Display Settings“ “Error“ MB_OK);
return;
}
dmSettings.dmPelsWidth = SCREEN_WIDTH;
dmSettings.dmPelsHeight = SCREEN_HEIGHT;
int result = ChangeDisplaySettings(&dmSettingsCDS_FULLSCREEN);
if(result != DISP_CHANGE_SUCCESSFUL) {
MessageBox(NULL “Display Mode Not Compatible“ “Error“ MB_OK);
PostQuitMessage(0);
}
}
HWND CreateMyWindow(LPSTR strWindowName int width int height DWORD dwstyle bool bFullScreen HINSTANCE hInstance)
{
HWND hWnd;
WNDCLASS wndclass;
memset(&wndclass 0 sizeof(WNDCLASS));
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = WinProc;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon(NULL IDI_APPLICATION);
wndclass.hCursor = LoadCursor(NULL IDC_ARROW);
wndclass.hbrBackground = (HBRUSH) (COLOR_WINDOW+1);
wndclass.lpszClassName = “Naskel3D“;
RegisterClass(&wndclass);
if(bFullScreen && !dwstyle) {
dwstyle = WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
ChangeToFullScreen();
ShowCursor(FALSE);
}
else if(!dwstyle)
dwstyle = WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
g_hInstance = hInstance;
RECT rWindow;
rWindow.left = 0;
rWindow.right = width;
rWindow.top = 0;
rWindow.bottom = height;
AdjustWindowRect( &rWindow dwstyle false);
hWnd = CreateWindow(“Naskel3D“ strWindowName dwstyle 0 0
rWindow.right - rWindow.left rWindow.bottom - rWindow.top
NULL NULL hInstance NULL);
if(!hWnd) return NULL;
ShowWindow(hWnd SW_SHOWNORMAL);
UpdateWindow(hWnd);
SetFocus(hWnd);
return hWnd;
}
WPARAM MainLoop()
{
MSG msg;
while(1) {
if (PeekMessage(&msg NULL 0 0 PM_REMOVE)) {
if(msg.message == WM_QUIT)
break;
TranslateMessage(&msg);
DispatchMessage(&msg);
} else {
RenderScene();
}
}
return(msg.
- 上一篇:openGL漫游
- 下一篇:现代控制系统第十版书后答案
评论
共有 条评论