1 | /*
|
---|
2 | * GDI32 OpenGl stubs
|
---|
3 | *
|
---|
4 | * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
|
---|
5 | *
|
---|
6 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
7 | *
|
---|
8 | */
|
---|
9 | #include <os2win.h>
|
---|
10 | #include <stdarg.h>
|
---|
11 | #include <string.h>
|
---|
12 | #include "misc.h"
|
---|
13 | #include "unicode.h"
|
---|
14 |
|
---|
15 | typedef int (* WIN32API CHOOSEPIXELFMT) (HDC, CONST PIXELFORMATDESCRIPTOR *);
|
---|
16 | typedef BOOL (* WIN32API SETPIXELFMT) (HDC, int, CONST PIXELFORMATDESCRIPTOR *);
|
---|
17 | typedef BOOL (* WIN32API SWAPBUFFERS) (HDC hdc);
|
---|
18 |
|
---|
19 | CHOOSEPIXELFMT glChoosePixelFormat = NULL;
|
---|
20 | SETPIXELFMT glSetPixelFormat = NULL;
|
---|
21 | SWAPBUFFERS glSwapBuffers = NULL;
|
---|
22 |
|
---|
23 | HINSTANCE hOpenGL = NULL;
|
---|
24 |
|
---|
25 | //******************************************************************************
|
---|
26 | //******************************************************************************
|
---|
27 | int WIN32API ChoosePixelFormat(HDC hdc, CONST PIXELFORMATDESCRIPTOR *pformat)
|
---|
28 | {
|
---|
29 | int rc;
|
---|
30 |
|
---|
31 | return(1);
|
---|
32 | dprintf(("OS2ChoosePixelFormat\n"));
|
---|
33 | if(hOpenGL == NULL) {
|
---|
34 | hOpenGL = O32_LoadLibrary("OPENGL32.DLL");
|
---|
35 | if(hOpenGL == NULL)
|
---|
36 | return(0);
|
---|
37 | }
|
---|
38 | if(glChoosePixelFormat == NULL) {
|
---|
39 | glChoosePixelFormat = (CHOOSEPIXELFMT)O32_GetProcAddress(hOpenGL, "OS2wglChoosePixelFormat");
|
---|
40 | if(glChoosePixelFormat == NULL)
|
---|
41 | return(0);
|
---|
42 | }
|
---|
43 | rc = glChoosePixelFormat(hdc, pformat);
|
---|
44 | dprintf(("wglChoosePixelFormat returned %d\n", rc));
|
---|
45 | return(rc);
|
---|
46 | }
|
---|
47 | //******************************************************************************
|
---|
48 | //******************************************************************************
|
---|
49 | BOOL WIN32API SetPixelFormat(HDC hdc, int whatever, CONST PIXELFORMATDESCRIPTOR * pformat)
|
---|
50 | {
|
---|
51 | BOOL rc;
|
---|
52 |
|
---|
53 | dprintf(("OS2SetPixelFormat\n"));
|
---|
54 | if(hOpenGL == NULL) {
|
---|
55 | hOpenGL = O32_LoadLibrary("OPENGL32.DLL");
|
---|
56 | if(hOpenGL == NULL)
|
---|
57 | return(FALSE);
|
---|
58 | }
|
---|
59 | if(glSetPixelFormat == NULL) {
|
---|
60 | glSetPixelFormat = (SETPIXELFMT)O32_GetProcAddress(hOpenGL, "OS2wglSetPixelFormat");
|
---|
61 | if(glSetPixelFormat == NULL)
|
---|
62 | return(FALSE);
|
---|
63 | }
|
---|
64 | rc = glSetPixelFormat(hdc, whatever, pformat);
|
---|
65 | dprintf(("wglSetPixelFormat returned %d\n", rc));
|
---|
66 | return(rc);
|
---|
67 | }
|
---|
68 | //******************************************************************************
|
---|
69 | //******************************************************************************
|
---|
70 | BOOL WIN32API SwapBuffers(HDC hdc)
|
---|
71 | {
|
---|
72 | BOOL rc;
|
---|
73 |
|
---|
74 | dprintf(("OS2SwapBuffers\n"));
|
---|
75 | if(hOpenGL == NULL) {
|
---|
76 | hOpenGL = O32_LoadLibrary("OPENGL32.DLL");
|
---|
77 | if(hOpenGL == NULL)
|
---|
78 | return(FALSE);
|
---|
79 | }
|
---|
80 | if(glSwapBuffers == NULL) {
|
---|
81 | glSwapBuffers = (SWAPBUFFERS)O32_GetProcAddress(hOpenGL, "OS2wglSwapBuffers");
|
---|
82 | if(glSwapBuffers == NULL)
|
---|
83 | return(FALSE);
|
---|
84 | }
|
---|
85 | rc = glSwapBuffers(hdc);
|
---|
86 | dprintf(("wglSwapBuffers returned %d\n", rc));
|
---|
87 | return(rc);
|
---|
88 | }
|
---|
89 | //******************************************************************************
|
---|
90 | //******************************************************************************
|
---|