annotate src/video/photon/SDL_ph_gl.c @ 1861:b42823412c3b

Fixed bug #232 ------- Comment #2 From Matthias Geissert 2006-05-24 07:54 [reply] ------- See http://dri.sourceforge.net/doc/DRIuserguide.html, section 11.5. There is written that you need to use RTLD_GLOBAL, since, otherwise, nested open of dynamic libraries doesn't work. However, This is necassary in this case, since libGL opens the hardware-specific driver/library. I hope this helps you.
author Sam Lantinga <slouken@libsdl.org>
date Tue, 20 Jun 2006 03:52:41 +0000
parents d910939febfa
children 782fd950bd46 c121d94672cb a1b03ba2fcd0
rev   line source
910
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 /*
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 910
diff changeset
3 Copyright (C) 1997-2006 Sam Lantinga
910
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 910
diff changeset
6 modify it under the terms of the GNU Lesser General Public
910
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 910
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
910
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 910
diff changeset
13 Lesser General Public License for more details.
910
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 910
diff changeset
15 You should have received a copy of the GNU Lesser General Public
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 910
diff changeset
16 License along with this library; if not, write to the Free Software
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 910
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
910
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19 Sam Lantinga
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
20 slouken@libsdl.org
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
21 */
1402
d910939febfa Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents: 1379
diff changeset
22 #include "SDL_config.h"
910
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24 #include <dlfcn.h>
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
25 #include "SDL.h"
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26 #include "SDL_ph_gl.h"
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1336
diff changeset
28 #if SDL_VIDEO_OPENGL
910
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30 #if (_NTO_VERSION >= 630)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31 /* PhotonGL functions */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32 GLPH_DECLARE_FUNCS;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
33 #endif /* 6.3.0 */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
34
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
35 #if (_NTO_VERSION < 630)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
36 void ph_GL_SwapBuffers(_THIS)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
37 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
38 PgSetRegion(PtWidgetRid(window));
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
39 PdOpenGLContextSwapBuffers(oglctx);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
40 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
41 #else
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
42 void ph_GL_SwapBuffers(_THIS)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
44 qnxgl_swap_buffers(oglbuffers);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
45 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
46 #endif /* 6.3.0 */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
47
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
48 int ph_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
49 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
50 switch (attrib)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
51 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
52 case SDL_GL_DOUBLEBUFFER:
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
53 *value=this->gl_config.double_buffer;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
54 break;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
55 case SDL_GL_STENCIL_SIZE:
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
56 *value=this->gl_config.stencil_size;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
57 break;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
58 case SDL_GL_DEPTH_SIZE:
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
59 *value=this->gl_config.depth_size;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
60 break;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
61 #if (_NTO_VERSION >= 630)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
62 case SDL_GL_RED_SIZE:
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
63 *value=this->gl_config.red_size;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
64 break;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
65 case SDL_GL_GREEN_SIZE:
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
66 *value=this->gl_config.green_size;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
67 break;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
68 case SDL_GL_BLUE_SIZE:
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
69 *value=this->gl_config.blue_size;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
70 break;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
71 case SDL_GL_ALPHA_SIZE:
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
72 *value=this->gl_config.alpha_size;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
73 break;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
74 case SDL_GL_ACCUM_RED_SIZE:
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
75 *value=this->gl_config.accum_red_size;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
76 break;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
77 case SDL_GL_ACCUM_GREEN_SIZE:
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
78 *value=this->gl_config.accum_green_size;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
79 break;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
80 case SDL_GL_ACCUM_BLUE_SIZE:
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
81 *value=this->gl_config.accum_blue_size;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
82 break;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
83 case SDL_GL_ACCUM_ALPHA_SIZE:
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
84 *value=this->gl_config.accum_alpha_size;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
85 break;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
86 case SDL_GL_STEREO:
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
87 *value=this->gl_config.stereo;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
88 break;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
89 #endif /* 6.3.0 */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
90 default:
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
91 *value=0;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
92 return(-1);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
93 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
94 return 0;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
95 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
96
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
97 #if (_NTO_VERSION < 630)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
98 int ph_GL_LoadLibrary(_THIS, const char* path)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
99 {
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1336
diff changeset
100 /* if code compiled with SDL_VIDEO_OPENGL, that mean that library already linked */
910
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
101 this->gl_config.driver_loaded = 1;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
102
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
103 return 0;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
104 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
105 #else
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
106 int ph_GL_LoadLibrary(_THIS, const char* path)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
107 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
108 void* handle;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
109 int dlopen_flags=RTLD_WORLD | RTLD_GROUP;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
110
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
111 if (this->gl_config.dll_handle!=NULL)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
112 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
113 return 0;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
114 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
115
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
116 handle = dlopen(path, dlopen_flags);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
117
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
118 if (handle==NULL)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
119 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
120 SDL_SetError("ph_GL_LoadLibrary(): Could not load OpenGL library");
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
121 return -1;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
122 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
123
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
124 this->gl_config.dll_handle = handle;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
125 this->gl_config.driver_loaded = 1;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
126
1379
c0a74f199ecf Use only safe string functions
Sam Lantinga <slouken@libsdl.org>
parents: 1361
diff changeset
127 SDL_strlcpy(this->gl_config.driver_path, path, SDL_arraysize(this->gl_config.driver_path));
910
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
128
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
129 return 0;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
130 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
131 #endif /* 6.3.0 */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
132
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
133 #if (_NTO_VERSION < 630)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
134 void* ph_GL_GetProcAddress(_THIS, const char* proc)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
135 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
136 return NULL;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
137 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
138 #else
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
139 void* ph_GL_GetProcAddress(_THIS, const char* proc)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
140 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
141 void* function;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
142
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
143 if (this->gl_config.dll_handle==NULL)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
144 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
145 ph_GL_LoadLibrary(this, DEFAULT_OPENGL);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
146 if (this->gl_config.dll_handle==NULL)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
147 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
148 return NULL;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
149 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
150 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
151
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
152 function=qnxgl_get_func(proc, oglctx, 0);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
153 if (function==NULL)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
154 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
155 function=dlsym(this->gl_config.dll_handle, proc);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
156 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
157
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
158 return function;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
159 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
160 #endif /* 6.3.0 */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
161
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
162 #if (_NTO_VERSION < 630)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
163 int ph_GL_MakeCurrent(_THIS)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
164 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
165 PgSetRegion(PtWidgetRid(window));
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
166
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
167 if (oglctx!=NULL)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
168 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
169 PhDCSetCurrent(oglctx);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
170 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
171
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
172 return 0;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
173 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
174 #else
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
175 int ph_GL_MakeCurrent(_THIS)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
176 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
177 PgSetRegion(PtWidgetRid(window));
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
178
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
179 if (oglctx!=NULL)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
180 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
181 if (qnxgl_set_current(oglctx) == -1)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
182 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
183 return -1;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
184 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
185 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
186
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
187 return 0;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
188 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
189 #endif /* 6.3.0 */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
190
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
191 #if (_NTO_VERSION < 630)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
192
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
193 /* This code is actual for the Photon3D Runtime which was available prior to 6.3 only */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
194
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
195 int ph_SetupOpenGLContext(_THIS, int width, int height, int bpp, Uint32 flags)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
196 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
197 PhDim_t dim;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
198 uint64_t OGLAttrib[PH_OGL_MAX_ATTRIBS];
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
199 int exposepost=0;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
200 int OGLargc;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
201
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
202 dim.w=width;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
203 dim.h=height;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
204
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
205 if ((oglctx!=NULL) && (oglflags==flags) && (oglbpp==bpp))
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
206 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
207 PdOpenGLContextResize(oglctx, &dim);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
208 PhDCSetCurrent(oglctx);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
209 return 0;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
210 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
211 else
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
212 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
213 if (oglctx!=NULL)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
214 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
215 PhDCSetCurrent(NULL);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
216 PhDCRelease(oglctx);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
217 oglctx=NULL;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
218 exposepost=1;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
219 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
220 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
221
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
222 OGLargc=0;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
223 if (this->gl_config.depth_size)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
224 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
225 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_DEPTH_BITS;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
226 OGLAttrib[OGLargc++]=this->gl_config.depth_size;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
227 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
228 if (this->gl_config.stencil_size)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
229 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
230 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_STENCIL_BITS;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
231 OGLAttrib[OGLargc++]=this->gl_config.stencil_size;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
232 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
233 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_FORCE_SW;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
234 if (flags & SDL_FULLSCREEN)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
235 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
236 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_FULLSCREEN;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
237 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_DIRECT;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
238 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_FULLSCREEN_BEST;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
239 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_FULLSCREEN_CENTER;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
240 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
241 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_NONE;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
242
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
243 if (this->gl_config.double_buffer)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
244 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
245 oglctx=PdCreateOpenGLContext(2, &dim, 0, OGLAttrib);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
246 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
247 else
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
248 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
249 oglctx=PdCreateOpenGLContext(1, &dim, 0, OGLAttrib);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
250 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
251
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
252 if (oglctx==NULL)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
253 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
254 SDL_SetError("ph_SetupOpenGLContext(): cannot create OpenGL context !\n");
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
255 return -1;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
256 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
257
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
258 PhDCSetCurrent(oglctx);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
259
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
260 PtFlush();
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
261
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
262 oglflags=flags;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
263 oglbpp=bpp;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
264
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
265 if (exposepost!=0)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
266 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
267 /* OpenGL context has been recreated, so report about this fact */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
268 SDL_PrivateExpose();
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
269 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
270
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
271 return 0;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
272 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
273
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
274 #else /* _NTO_VERSION */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
275
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
276 /* This code is actual for the built-in PhGL support, which became available since 6.3 */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
277
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
278 int ph_SetupOpenGLContext(_THIS, int width, int height, int bpp, Uint32 flags)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
279 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
280 qnxgl_buf_attrib_t qnxgl_attribs[PH_OGL_MAX_ATTRIBS];
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
281 qnxgl_buf_attrib_t* qnxgl_attribs_slide;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
282 int num_interfaces = 0;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
283 int num_buffers = 0;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
284
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
285 /* Initialize the OpenGL subsystem */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
286
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
287 num_interfaces = qnxgl_init(NULL, NULL, 0);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
288
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
289 if (num_interfaces < 0)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
290 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
291 SDL_SetError("ph_SetupOpenGLContext(): cannot initialize OpenGL subsystem !\n");
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
292 return -1;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
293 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
294 if (num_interfaces == 0)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
295 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
296 SDL_SetError("ph_SetupOpenGLContext(): there are no available OpenGL renderers was found !\n");
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
297 return -1;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
298 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
299
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
300 /* Driver is linked */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
301 this->gl_config.driver_loaded=1;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
302
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
303 /* Initialize the OpenGL context attributes */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
304 qnxgl_attribs_slide=qnxgl_attribs;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
305
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
306 /* Depth size */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
307 if (this->gl_config.depth_size)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
308 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
309 fprintf(stderr, "setted depth size %d\n", this->gl_config.depth_size);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
310 qnxgl_attribs_slide = qnxgl_attrib_set_depth(qnxgl_attribs_slide, this->gl_config.depth_size);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
311 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
312
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
313 /* Stencil size */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
314 if (this->gl_config.stencil_size)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
315 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
316 qnxgl_attribs_slide = qnxgl_attrib_set_stencil(qnxgl_attribs_slide, this->gl_config.stencil_size);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
317 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
318
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
319 /* The sum of the accum bits of each channel */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
320 if ((this->gl_config.accum_red_size != 0) && (this->gl_config.accum_blue_size != 0) &&
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
321 (this->gl_config.accum_green_size != 0))
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
322 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
323 qnxgl_attribs_slide = qnxgl_attrib_set_accum(qnxgl_attribs_slide,
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
324 this->gl_config.accum_red_size + this->gl_config.accum_blue_size +
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
325 this->gl_config.accum_green_size + this->gl_config.accum_alpha_size);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
326 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
327
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
328 /* Stereo mode */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
329 if (this->gl_config.stereo)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
330 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
331 qnxgl_attribs_slide = qnxgl_attrib_set_stereo(qnxgl_attribs_slide);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
332 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
333
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
334 /* Fullscreen mode */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
335 if ((flags & SDL_FULLSCREEN) == SDL_FULLSCREEN)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
336 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
337 qnxgl_attribs_slide = qnxgl_attrib_set_hint_fullscreen(qnxgl_attribs_slide);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
338 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
339
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
340 /* Double buffering mode */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
341 if (this->gl_config.double_buffer)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
342 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
343 num_buffers=2;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
344 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
345 else
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
346 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
347 num_buffers=1;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
348 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
349
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
350 /* Loading the function pointers so we can use the extensions */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
351 GLPH_LOAD_FUNCS_GC(oglctx);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
352
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
353 /* Set the buffers region to be that of our window's region */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
354 qnxgl_attribs_slide = glph_attrib_set_region(qnxgl_attribs_slide, PtWidgetRid(window));
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
355
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
356 /* End of the attributes array */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
357 qnxgl_attribs_slide = qnxgl_attrib_set_end(qnxgl_attribs_slide);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
358
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
359 /* Create the buffers with the specified color model */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
360 fprintf(stderr, "ARGB: %d, %d, %d, %d\n", this->gl_config.alpha_size, this->gl_config.red_size, this->gl_config.green_size, this->gl_config.blue_size);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
361 oglbuffers = qnxgl_buffers_create(
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
362 QNXGL_FORMAT_BEST_RGB,
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
363 /* __QNXGL_BUILD_FORMAT(0, __QNXGL_COLOR_MODEL_RGB, this->gl_config.alpha_size,
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
364 this->gl_config.red_size, this->gl_config.green_size, this->gl_config.blue_size), */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
365 num_buffers, width, height, qnxgl_attribs, -1);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
366
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
367
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
368 if (oglbuffers == NULL)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
369 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
370 SDL_SetError("ph_SetupOpenGLContext(): failed to create OpenGL buffers !\n");
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
371 qnxgl_finish();
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
372 return -1;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
373 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
374
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
375 /* Create a QNXGL context for the previously created buffer */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
376 oglctx = qnxgl_context_create(oglbuffers, NULL);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
377
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
378 if (oglctx == NULL)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
379 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
380 SDL_SetError("ph_SetupOpenGLContext(): failed to create OpenGL context !\n");
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
381 qnxgl_buffers_destroy(oglbuffers);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
382 qnxgl_finish();
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
383 return -1;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
384 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
385
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
386 /* Attempt to make the context current so we can use OpenGL commands */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
387 if (qnxgl_set_current(oglctx) == -1)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
388 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
389 SDL_SetError("ph_SetupOpenGLContext(): failed to make the OpenGL context current !\n");
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
390 qnxgl_context_destroy(oglctx);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
391 qnxgl_buffers_destroy(oglbuffers);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
392 qnxgl_finish();
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
393 return -1;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
394 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
395
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
396 PtFlush();
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
397
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
398 oglflags=flags;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
399 oglbpp=bpp;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
400
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
401 return 0;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
402 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
403
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
404 #endif /* _NTO_VERSION */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
405
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1336
diff changeset
406 #endif /* SDL_VIDEO_OPENGL */