summaryrefslogtreecommitdiffstats
path: root/zoom.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'zoom.cpp')
-rw-r--r--zoom.cpp34
1 files changed, 14 insertions, 20 deletions
diff --git a/zoom.cpp b/zoom.cpp
index 8f01c1b..6fab527 100644
--- a/zoom.cpp
+++ b/zoom.cpp
@@ -66,8 +66,7 @@ bool WGLInit(HINSTANCE hInstance, HWND *hWnd, HDC *hDC, HGLRC *hRC) {
wc.lpszMenuName = 0;
wc.lpszClassName = "3D";
- if (!RegisterClass(&wc))
- {
+ if (!RegisterClass(&wc)) {
MessageBox(0, "Failed To Register The Window Class.", "ERROR", MB_OK|MB_ICONEXCLAMATION);
return false; // Exit And Return FALSE
}
@@ -85,14 +84,12 @@ bool WGLInit(HINSTANCE hInstance, HWND *hWnd, HDC *hDC, HGLRC *hRC) {
*hWnd = CreateWindowEx(dwExStyle, "3D" /* Class Name */, "3D" /* Title*/, WS_CLIPSIBLINGS | WS_CLIPCHILDREN | dwStyle,
0, 0, windowRect.right-windowRect.left, windowRect.bottom-windowRect.top, 0, 0, hInstance, 0);
- if(!*hWnd)
- {
+ if(!*hWnd) {
MessageBox(0, "Window Creation Error.", "ERROR", MB_OK|MB_ICONEXCLAMATION);
return false;
}
- static PIXELFORMATDESCRIPTOR pfd =
- {
+ static PIXELFORMATDESCRIPTOR pfd = {
sizeof(PIXELFORMATDESCRIPTOR), // Size Of This Pixel Format Descriptor
1, // Version Number
PFD_DRAW_TO_WINDOW | // Format Must Support Window
@@ -114,38 +111,33 @@ bool WGLInit(HINSTANCE hInstance, HWND *hWnd, HDC *hDC, HGLRC *hRC) {
};
*hDC=GetDC(*hWnd);
- if (!*hDC)
- {
+ if (!*hDC) {
WGLUninit(*hWnd, 0, 0);
MessageBox(0, "Can't Create A GL Device Context.", "ERROR", MB_OK|MB_ICONEXCLAMATION);
return false;
}
GLuint pixelFormat = ChoosePixelFormat(*hDC, &pfd);
- if(!pixelFormat)
- {
+ if(!pixelFormat) {
WGLUninit(*hWnd, *hDC, 0);
MessageBox(0, "Can't Find A Suitable PixelFormat.", "ERROR", MB_OK|MB_ICONEXCLAMATION);
return false;
}
- if(!SetPixelFormat(*hDC, pixelFormat, &pfd))
- {
+ if(!SetPixelFormat(*hDC, pixelFormat, &pfd)) {
WGLUninit(*hWnd, *hDC, 0);
MessageBox(0, "Can't Set The PixelFormat.", "ERROR", MB_OK|MB_ICONEXCLAMATION);
return false;
}
*hRC=wglCreateContext(*hDC);
- if(!*hRC)
- {
+ if(!*hRC) {
WGLUninit(*hWnd, *hDC, 0);
MessageBox(0, "Can't Create A GL Rendering Context.", "ERROR", MB_OK|MB_ICONEXCLAMATION);
return false;
}
- if(!wglMakeCurrent(*hDC, *hRC))
- {
+ if(!wglMakeCurrent(*hDC, *hRC)) {
WGLUninit(*hWnd, *hDC, *hRC);
MessageBox(0, "Can't Activate The GL Rendering Context.", "ERROR", MB_OK|MB_ICONEXCLAMATION);
return false;
@@ -171,17 +163,17 @@ void WGLUninit(HWND hWnd, HDC hDC, HGLRC hRC) {
DestroyWindow(hWnd);
}
-int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
-{
+int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
HWND hWnd = 0;
HDC hDC = 0;
HGLRC hRC = 0;
- if(!WGLInit(hInstance, &hWnd, &hDC, &hRC))
- {
+ if(!WGLInit(hInstance, &hWnd, &hDC, &hRC)) {
return 0;
}
+ glewInit();
+
resize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
bool running = true;
@@ -330,6 +322,8 @@ int main() {
if(!GLXinit(disp, windele, &wnd, &gc, &multisample))
return 1;
+ glewInit();
+
resize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
Zoom::Game game(multisample);