annotate src/video/photon/SDL_ph_gl.c @ 1315:e94b0d7c33bc

Merged useful fixes from 1.3 branch
author Sam Lantinga <slouken@libsdl.org>
date Wed, 01 Feb 2006 08:17:54 +0000
parents c9b51268668f
children 3692456e7b0f
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 */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
22
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23 #include <dlfcn.h>
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24 #include "SDL.h"
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
25 #include "SDL_ph_gl.h"
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27 #ifdef HAVE_OPENGL
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
28
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29 #if (_NTO_VERSION >= 630)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30 /* PhotonGL functions */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31 GLPH_DECLARE_FUNCS;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32 #endif /* 6.3.0 */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
33
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
34 #if (_NTO_VERSION < 630)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
35 void ph_GL_SwapBuffers(_THIS)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
36 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
37 PgSetRegion(PtWidgetRid(window));
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
38 PdOpenGLContextSwapBuffers(oglctx);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
39 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
40 #else
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
41 void ph_GL_SwapBuffers(_THIS)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
42 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43 qnxgl_swap_buffers(oglbuffers);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
44 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
45 #endif /* 6.3.0 */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
46
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
47 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
48 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
49 switch (attrib)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
50 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
51 case SDL_GL_DOUBLEBUFFER:
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
52 *value=this->gl_config.double_buffer;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
53 break;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
54 case SDL_GL_STENCIL_SIZE:
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
55 *value=this->gl_config.stencil_size;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
56 break;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
57 case SDL_GL_DEPTH_SIZE:
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
58 *value=this->gl_config.depth_size;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
59 break;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
60 #if (_NTO_VERSION >= 630)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
61 case SDL_GL_RED_SIZE:
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
62 *value=this->gl_config.red_size;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
63 break;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
64 case SDL_GL_GREEN_SIZE:
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
65 *value=this->gl_config.green_size;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
66 break;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
67 case SDL_GL_BLUE_SIZE:
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
68 *value=this->gl_config.blue_size;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
69 break;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
70 case SDL_GL_ALPHA_SIZE:
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
71 *value=this->gl_config.alpha_size;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
72 break;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
73 case SDL_GL_ACCUM_RED_SIZE:
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
74 *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
75 break;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
76 case SDL_GL_ACCUM_GREEN_SIZE:
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
77 *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
78 break;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
79 case SDL_GL_ACCUM_BLUE_SIZE:
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
80 *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
81 break;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
82 case SDL_GL_ACCUM_ALPHA_SIZE:
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
83 *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
84 break;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
85 case SDL_GL_STEREO:
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
86 *value=this->gl_config.stereo;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
87 break;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
88 #endif /* 6.3.0 */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
89 default:
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
90 *value=0;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
91 return(-1);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
92 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
93 return 0;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
94 }
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 #if (_NTO_VERSION < 630)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
97 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
98 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
99 /* if code compiled with HAVE_OPENGL, that mean that library already linked */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
100 this->gl_config.driver_loaded = 1;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
101
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
102 return 0;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
103 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
104 #else
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
105 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
106 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
107 void* handle;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
108 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
109
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
110 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
111 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
112 return 0;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
113 }
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 handle = dlopen(path, dlopen_flags);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
116
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
117 if (handle==NULL)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
118 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
119 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
120 return -1;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
121 }
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 this->gl_config.dll_handle = handle;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
124 this->gl_config.driver_loaded = 1;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
125
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
126 strncpy(this->gl_config.driver_path, path, sizeof(this->gl_config.driver_path)-1);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
127
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
128 return 0;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
129 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
130 #endif /* 6.3.0 */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
131
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
132 #if (_NTO_VERSION < 630)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
133 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
134 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
135 return NULL;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
136 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
137 #else
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
138 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
139 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
140 void* function;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
141
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
142 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
143 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
144 ph_GL_LoadLibrary(this, DEFAULT_OPENGL);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
145 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
146 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
147 return NULL;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
148 }
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 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
152 if (function==NULL)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
153 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
154 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
155 }
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 return function;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
158 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
159 #endif /* 6.3.0 */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
160
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
161 #if (_NTO_VERSION < 630)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
162 int ph_GL_MakeCurrent(_THIS)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
163 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
164 PgSetRegion(PtWidgetRid(window));
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
165
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
166 if (oglctx!=NULL)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
167 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
168 PhDCSetCurrent(oglctx);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
169 }
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 return 0;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
172 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
173 #else
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
174 int ph_GL_MakeCurrent(_THIS)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
175 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
176 PgSetRegion(PtWidgetRid(window));
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
177
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
178 if (oglctx!=NULL)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
179 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
180 if (qnxgl_set_current(oglctx) == -1)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
181 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
182 return -1;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
183 }
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 return 0;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
187 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
188 #endif /* 6.3.0 */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
189
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
190 #if (_NTO_VERSION < 630)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
191
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
192 /* 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
193
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
194 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
195 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
196 PhDim_t dim;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
197 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
198 int exposepost=0;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
199 int OGLargc;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
200
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
201 dim.w=width;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
202 dim.h=height;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
203
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
204 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
205 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
206 PdOpenGLContextResize(oglctx, &dim);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
207 PhDCSetCurrent(oglctx);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
208 return 0;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
209 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
210 else
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
211 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
212 if (oglctx!=NULL)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
213 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
214 PhDCSetCurrent(NULL);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
215 PhDCRelease(oglctx);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
216 oglctx=NULL;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
217 exposepost=1;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
218 }
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 OGLargc=0;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
222 if (this->gl_config.depth_size)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
223 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
224 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_DEPTH_BITS;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
225 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
226 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
227 if (this->gl_config.stencil_size)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
228 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
229 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_STENCIL_BITS;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
230 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
231 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
232 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_FORCE_SW;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
233 if (flags & SDL_FULLSCREEN)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
234 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
235 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_FULLSCREEN;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
236 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_DIRECT;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
237 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_FULLSCREEN_BEST;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
238 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_FULLSCREEN_CENTER;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
239 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
240 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_NONE;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
241
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
242 if (this->gl_config.double_buffer)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
243 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
244 oglctx=PdCreateOpenGLContext(2, &dim, 0, OGLAttrib);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
245 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
246 else
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
247 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
248 oglctx=PdCreateOpenGLContext(1, &dim, 0, OGLAttrib);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
249 }
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 if (oglctx==NULL)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
252 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
253 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
254 return -1;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
255 }
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 PhDCSetCurrent(oglctx);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
258
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
259 PtFlush();
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
260
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
261 oglflags=flags;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
262 oglbpp=bpp;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
263
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
264 if (exposepost!=0)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
265 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
266 /* 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
267 SDL_PrivateExpose();
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
268 }
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 return 0;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
271 }
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 #else /* _NTO_VERSION */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
274
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
275 /* 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
276
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
277 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
278 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
279 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
280 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
281 int num_interfaces = 0;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
282 int num_buffers = 0;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
283
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
284 /* Initialize the OpenGL subsystem */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
285
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
286 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
287
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
288 if (num_interfaces < 0)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
289 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
290 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
291 return -1;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
292 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
293 if (num_interfaces == 0)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
294 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
295 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
296 return -1;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
297 }
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 /* Driver is linked */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
300 this->gl_config.driver_loaded=1;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
301
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
302 /* Initialize the OpenGL context attributes */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
303 qnxgl_attribs_slide=qnxgl_attribs;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
304
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
305 /* Depth size */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
306 if (this->gl_config.depth_size)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
307 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
308 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
309 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
310 }
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 /* Stencil size */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
313 if (this->gl_config.stencil_size)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
314 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
315 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
316 }
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 /* 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
319 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
320 (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
321 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
322 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
323 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
324 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
325 }
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 /* Stereo mode */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
328 if (this->gl_config.stereo)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
329 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
330 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
331 }
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 /* Fullscreen mode */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
334 if ((flags & SDL_FULLSCREEN) == SDL_FULLSCREEN)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
335 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
336 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
337 }
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 /* Double buffering mode */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
340 if (this->gl_config.double_buffer)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
341 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
342 num_buffers=2;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
343 }
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
344 else
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
345 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
346 num_buffers=1;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
347 }
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 /* 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
350 GLPH_LOAD_FUNCS_GC(oglctx);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
351
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
352 /* 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
353 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
354
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
355 /* End of the attributes array */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
356 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
357
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
358 /* 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
359 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
360 oglbuffers = qnxgl_buffers_create(
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
361 QNXGL_FORMAT_BEST_RGB,
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
362 /* __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
363 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
364 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
365
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 if (oglbuffers == NULL)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
368 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
369 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
370 qnxgl_finish();
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
371 return -1;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
372 }
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 /* 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
375 oglctx = qnxgl_context_create(oglbuffers, NULL);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
376
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
377 if (oglctx == NULL)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
378 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
379 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
380 qnxgl_buffers_destroy(oglbuffers);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
381 qnxgl_finish();
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
382 return -1;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
383 }
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 /* 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
386 if (qnxgl_set_current(oglctx) == -1)
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
387 {
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
388 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
389 qnxgl_context_destroy(oglctx);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
390 qnxgl_buffers_destroy(oglbuffers);
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
391 qnxgl_finish();
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
392 return -1;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
393 }
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 PtFlush();
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
396
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
397 oglflags=flags;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
398 oglbpp=bpp;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
399
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
400 return 0;
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
401 }
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 #endif /* _NTO_VERSION */
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
404
4ab6d1fd028f Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
405 #endif /* HAVE_OPENGL */