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