version 1.1 | | version 1.2 |
---|
| | |
| | #include "ogl_init.h" |
| | |
#include <stdio.h> | | #include <stdio.h> |
#include <stdlib.h> | | #include <stdlib.h> |
#include <string.h> | | #include <string.h> |
| | |
HGLRC hRC; | | HGLRC hRC; |
| | |
// Enable OpenGL | | // Enable OpenGL |
| | /* |
VOID EnableOpenGL( HWND hWnd, HDC * hDC, HGLRC * hRC ) | | VOID EnableOpenGL( HWND hWnd, HDC * hDC, HGLRC * hRC ) |
{ | | { |
PIXELFORMATDESCRIPTOR pfd; | | PIXELFORMATDESCRIPTOR pfd; |
| | |
PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; | | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; |
pfd.iPixelType = PFD_TYPE_RGBA; | | pfd.iPixelType = PFD_TYPE_RGBA; |
pfd.cColorBits = 24; | | pfd.cColorBits = 24; |
pfd.cDepthBits = 16; | | //pfd.cDepthBits = 16; |
| | pfd.cDepthBits = 0;//we don't use depth buffering. |
pfd.iLayerType = PFD_MAIN_PLANE; | | pfd.iLayerType = PFD_MAIN_PLANE; |
iFormat = ChoosePixelFormat( *hDC, &pfd ); | | iFormat = ChoosePixelFormat( *hDC, &pfd ); |
SetPixelFormat( *hDC, iFormat, &pfd ); | | SetPixelFormat( *hDC, iFormat, &pfd ); |
| | |
| | #ifdef OGL_RUNTIME_LOAD |
| | ogl_init_load_library(); |
| | #endif |
| | |
// create and enable the render context (RC) | | // create and enable the render context (RC) |
*hRC = wglCreateContext( *hDC ); | | *hRC = wglCreateContext( *hDC ); |
wglMakeCurrent( *hDC, *hRC ); | | wglMakeCurrent( *hDC, *hRC ); |
| | |
wglDeleteContext( hRC ); | | wglDeleteContext( hRC ); |
ReleaseDC( hWnd, hDC ); | | ReleaseDC( hWnd, hDC ); |
} | | } |
| | */ |
static void finiObjects() | | static void finiObjects() |
{ | | { |
if(mouse_hidden) | | if(mouse_hidden) |
ShowCursor(TRUE); | | ShowCursor(TRUE); |
| | |
DisableOpenGL( g_hWnd, hDC, hRC ); | | // DisableOpenGL( g_hWnd, hDC, hRC ); |
} | | } |
| | |
| | |
| | |
g_hWnd = CreateWindowEx(0, | | g_hWnd = CreateWindowEx(0, |
"WinD1X", | | "WinD1X", |
"Descent", | | "Descent", |
WS_OVERLAPPED | WS_BORDER, | | WS_POPUP | WS_SYSMENU, |
| | // WS_OVERLAPPED | WS_BORDER, |
0, 0, | | 0, 0, |
GetSystemMetrics(SM_CXSCREEN), | | GetSystemMetrics(SM_CXSCREEN), |
GetSystemMetrics(SM_CYSCREEN), | | GetSystemMetrics(SM_CYSCREEN), |
| | |
ShowWindow(g_hWnd,SW_SHOWNORMAL); | | ShowWindow(g_hWnd,SW_SHOWNORMAL); |
UpdateWindow(g_hWnd); | | UpdateWindow(g_hWnd); |
| | |
EnableOpenGL( g_hWnd, &hDC, &hRC); | | // EnableOpenGL( g_hWnd, &hDC, &hRC); |
} | | } |
| | |
extern void key_init(void); | | extern void key_init(void); |