comparison src/video/photon/SDL_ph_gl.c @ 1895:c121d94672cb

SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
author Sam Lantinga <slouken@libsdl.org>
date Mon, 10 Jul 2006 21:04:37 +0000
parents d910939febfa
children e1da92da346c 204be4fc2726
comparison
equal deleted inserted replaced
1894:c69cee13dd76 1895:c121d94672cb
27 27
28 #if SDL_VIDEO_OPENGL 28 #if SDL_VIDEO_OPENGL
29 29
30 #if (_NTO_VERSION >= 630) 30 #if (_NTO_VERSION >= 630)
31 /* PhotonGL functions */ 31 /* PhotonGL functions */
32 GLPH_DECLARE_FUNCS; 32 GLPH_DECLARE_FUNCS;
33 #endif /* 6.3.0 */ 33 #endif /* 6.3.0 */
34 34
35 #if (_NTO_VERSION < 630) 35 #if (_NTO_VERSION < 630)
36 void ph_GL_SwapBuffers(_THIS) 36 void
37 ph_GL_SwapBuffers(_THIS)
37 { 38 {
38 PgSetRegion(PtWidgetRid(window)); 39 PgSetRegion(PtWidgetRid(window));
39 PdOpenGLContextSwapBuffers(oglctx); 40 PdOpenGLContextSwapBuffers(oglctx);
40 } 41 }
41 #else 42 #else
42 void ph_GL_SwapBuffers(_THIS) 43 void
44 ph_GL_SwapBuffers(_THIS)
43 { 45 {
44 qnxgl_swap_buffers(oglbuffers); 46 qnxgl_swap_buffers(oglbuffers);
45 } 47 }
46 #endif /* 6.3.0 */ 48 #endif /* 6.3.0 */
47 49
48 int ph_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value) 50 int
49 { 51 ph_GL_GetAttribute(_THIS, SDL_GLattr attrib, int *value)
50 switch (attrib) 52 {
51 { 53 switch (attrib) {
52 case SDL_GL_DOUBLEBUFFER: 54 case SDL_GL_DOUBLEBUFFER:
53 *value=this->gl_config.double_buffer; 55 *value = this->gl_config.double_buffer;
54 break; 56 break;
55 case SDL_GL_STENCIL_SIZE: 57 case SDL_GL_STENCIL_SIZE:
56 *value=this->gl_config.stencil_size; 58 *value = this->gl_config.stencil_size;
57 break; 59 break;
58 case SDL_GL_DEPTH_SIZE: 60 case SDL_GL_DEPTH_SIZE:
59 *value=this->gl_config.depth_size; 61 *value = this->gl_config.depth_size;
60 break; 62 break;
61 #if (_NTO_VERSION >= 630) 63 #if (_NTO_VERSION >= 630)
62 case SDL_GL_RED_SIZE: 64 case SDL_GL_RED_SIZE:
63 *value=this->gl_config.red_size; 65 *value = this->gl_config.red_size;
64 break; 66 break;
65 case SDL_GL_GREEN_SIZE: 67 case SDL_GL_GREEN_SIZE:
66 *value=this->gl_config.green_size; 68 *value = this->gl_config.green_size;
67 break; 69 break;
68 case SDL_GL_BLUE_SIZE: 70 case SDL_GL_BLUE_SIZE:
69 *value=this->gl_config.blue_size; 71 *value = this->gl_config.blue_size;
70 break; 72 break;
71 case SDL_GL_ALPHA_SIZE: 73 case SDL_GL_ALPHA_SIZE:
72 *value=this->gl_config.alpha_size; 74 *value = this->gl_config.alpha_size;
73 break; 75 break;
74 case SDL_GL_ACCUM_RED_SIZE: 76 case SDL_GL_ACCUM_RED_SIZE:
75 *value=this->gl_config.accum_red_size; 77 *value = this->gl_config.accum_red_size;
76 break; 78 break;
77 case SDL_GL_ACCUM_GREEN_SIZE: 79 case SDL_GL_ACCUM_GREEN_SIZE:
78 *value=this->gl_config.accum_green_size; 80 *value = this->gl_config.accum_green_size;
79 break; 81 break;
80 case SDL_GL_ACCUM_BLUE_SIZE: 82 case SDL_GL_ACCUM_BLUE_SIZE:
81 *value=this->gl_config.accum_blue_size; 83 *value = this->gl_config.accum_blue_size;
82 break; 84 break;
83 case SDL_GL_ACCUM_ALPHA_SIZE: 85 case SDL_GL_ACCUM_ALPHA_SIZE:
84 *value=this->gl_config.accum_alpha_size; 86 *value = this->gl_config.accum_alpha_size;
85 break; 87 break;
86 case SDL_GL_STEREO: 88 case SDL_GL_STEREO:
87 *value=this->gl_config.stereo; 89 *value = this->gl_config.stereo;
88 break; 90 break;
89 #endif /* 6.3.0 */ 91 #endif /* 6.3.0 */
90 default: 92 default:
91 *value=0; 93 *value = 0;
92 return(-1); 94 return (-1);
93 } 95 }
94 return 0; 96 return 0;
95 } 97 }
96 98
97 #if (_NTO_VERSION < 630) 99 #if (_NTO_VERSION < 630)
98 int ph_GL_LoadLibrary(_THIS, const char* path) 100 int
101 ph_GL_LoadLibrary(_THIS, const char *path)
99 { 102 {
100 /* if code compiled with SDL_VIDEO_OPENGL, that mean that library already linked */ 103 /* if code compiled with SDL_VIDEO_OPENGL, that mean that library already linked */
101 this->gl_config.driver_loaded = 1; 104 this->gl_config.driver_loaded = 1;
102 105
103 return 0; 106 return 0;
104 } 107 }
105 #else 108 #else
106 int ph_GL_LoadLibrary(_THIS, const char* path) 109 int
107 { 110 ph_GL_LoadLibrary(_THIS, const char *path)
108 void* handle; 111 {
109 int dlopen_flags=RTLD_WORLD | RTLD_GROUP; 112 void *handle;
110 113 int dlopen_flags = RTLD_WORLD | RTLD_GROUP;
111 if (this->gl_config.dll_handle!=NULL) 114
112 { 115 if (this->gl_config.dll_handle != NULL) {
113 return 0; 116 return 0;
114 } 117 }
115 118
116 handle = dlopen(path, dlopen_flags); 119 handle = dlopen(path, dlopen_flags);
117 120
118 if (handle==NULL) 121 if (handle == NULL) {
119 {
120 SDL_SetError("ph_GL_LoadLibrary(): Could not load OpenGL library"); 122 SDL_SetError("ph_GL_LoadLibrary(): Could not load OpenGL library");
121 return -1; 123 return -1;
122 } 124 }
123 125
124 this->gl_config.dll_handle = handle; 126 this->gl_config.dll_handle = handle;
125 this->gl_config.driver_loaded = 1; 127 this->gl_config.driver_loaded = 1;
126 128
127 SDL_strlcpy(this->gl_config.driver_path, path, SDL_arraysize(this->gl_config.driver_path)); 129 SDL_strlcpy(this->gl_config.driver_path, path,
130 SDL_arraysize(this->gl_config.driver_path));
128 131
129 return 0; 132 return 0;
130 } 133 }
131 #endif /* 6.3.0 */ 134 #endif /* 6.3.0 */
132 135
133 #if (_NTO_VERSION < 630) 136 #if (_NTO_VERSION < 630)
134 void* ph_GL_GetProcAddress(_THIS, const char* proc) 137 void *
138 ph_GL_GetProcAddress(_THIS, const char *proc)
135 { 139 {
136 return NULL; 140 return NULL;
137 } 141 }
138 #else 142 #else
139 void* ph_GL_GetProcAddress(_THIS, const char* proc) 143 void *
140 { 144 ph_GL_GetProcAddress(_THIS, const char *proc)
141 void* function; 145 {
142 146 void *function;
143 if (this->gl_config.dll_handle==NULL) 147
144 { 148 if (this->gl_config.dll_handle == NULL) {
145 ph_GL_LoadLibrary(this, DEFAULT_OPENGL); 149 ph_GL_LoadLibrary(this, DEFAULT_OPENGL);
146 if (this->gl_config.dll_handle==NULL) 150 if (this->gl_config.dll_handle == NULL) {
147 {
148 return NULL; 151 return NULL;
149 } 152 }
150 } 153 }
151 154
152 function=qnxgl_get_func(proc, oglctx, 0); 155 function = qnxgl_get_func(proc, oglctx, 0);
153 if (function==NULL) 156 if (function == NULL) {
154 { 157 function = dlsym(this->gl_config.dll_handle, proc);
155 function=dlsym(this->gl_config.dll_handle, proc);
156 } 158 }
157 159
158 return function; 160 return function;
159 } 161 }
160 #endif /* 6.3.0 */ 162 #endif /* 6.3.0 */
161 163
162 #if (_NTO_VERSION < 630) 164 #if (_NTO_VERSION < 630)
163 int ph_GL_MakeCurrent(_THIS) 165 int
166 ph_GL_MakeCurrent(_THIS)
164 { 167 {
165 PgSetRegion(PtWidgetRid(window)); 168 PgSetRegion(PtWidgetRid(window));
166 169
167 if (oglctx!=NULL) 170 if (oglctx != NULL) {
168 {
169 PhDCSetCurrent(oglctx); 171 PhDCSetCurrent(oglctx);
170 } 172 }
171 173
172 return 0; 174 return 0;
173 } 175 }
174 #else 176 #else
175 int ph_GL_MakeCurrent(_THIS) 177 int
178 ph_GL_MakeCurrent(_THIS)
176 { 179 {
177 PgSetRegion(PtWidgetRid(window)); 180 PgSetRegion(PtWidgetRid(window));
178 181
179 if (oglctx!=NULL) 182 if (oglctx != NULL) {
180 { 183 if (qnxgl_set_current(oglctx) == -1) {
181 if (qnxgl_set_current(oglctx) == -1) 184 return -1;
182 {
183 return -1;
184 } 185 }
185 } 186 }
186 187
187 return 0; 188 return 0;
188 } 189 }
190 191
191 #if (_NTO_VERSION < 630) 192 #if (_NTO_VERSION < 630)
192 193
193 /* This code is actual for the Photon3D Runtime which was available prior to 6.3 only */ 194 /* This code is actual for the Photon3D Runtime which was available prior to 6.3 only */
194 195
195 int ph_SetupOpenGLContext(_THIS, int width, int height, int bpp, Uint32 flags) 196 int
197 ph_SetupOpenGLContext(_THIS, int width, int height, int bpp, Uint32 flags)
196 { 198 {
197 PhDim_t dim; 199 PhDim_t dim;
198 uint64_t OGLAttrib[PH_OGL_MAX_ATTRIBS]; 200 uint64_t OGLAttrib[PH_OGL_MAX_ATTRIBS];
199 int exposepost=0; 201 int exposepost = 0;
200 int OGLargc; 202 int OGLargc;
201 203
202 dim.w=width; 204 dim.w = width;
203 dim.h=height; 205 dim.h = height;
204 206
205 if ((oglctx!=NULL) && (oglflags==flags) && (oglbpp==bpp)) 207 if ((oglctx != NULL) && (oglflags == flags) && (oglbpp == bpp)) {
206 { 208 PdOpenGLContextResize(oglctx, &dim);
207 PdOpenGLContextResize(oglctx, &dim); 209 PhDCSetCurrent(oglctx);
208 PhDCSetCurrent(oglctx); 210 return 0;
209 return 0; 211 } else {
210 } 212 if (oglctx != NULL) {
211 else 213 PhDCSetCurrent(NULL);
212 { 214 PhDCRelease(oglctx);
213 if (oglctx!=NULL) 215 oglctx = NULL;
214 { 216 exposepost = 1;
215 PhDCSetCurrent(NULL); 217 }
216 PhDCRelease(oglctx); 218 }
217 oglctx=NULL; 219
218 exposepost=1; 220 OGLargc = 0;
219 } 221 if (this->gl_config.depth_size) {
220 } 222 OGLAttrib[OGLargc++] = PHOGL_ATTRIB_DEPTH_BITS;
221 223 OGLAttrib[OGLargc++] = this->gl_config.depth_size;
222 OGLargc=0; 224 }
223 if (this->gl_config.depth_size) 225 if (this->gl_config.stencil_size) {
224 { 226 OGLAttrib[OGLargc++] = PHOGL_ATTRIB_STENCIL_BITS;
225 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_DEPTH_BITS; 227 OGLAttrib[OGLargc++] = this->gl_config.stencil_size;
226 OGLAttrib[OGLargc++]=this->gl_config.depth_size; 228 }
227 } 229 OGLAttrib[OGLargc++] = PHOGL_ATTRIB_FORCE_SW;
228 if (this->gl_config.stencil_size) 230 if (flags & SDL_FULLSCREEN) {
229 { 231 OGLAttrib[OGLargc++] = PHOGL_ATTRIB_FULLSCREEN;
230 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_STENCIL_BITS; 232 OGLAttrib[OGLargc++] = PHOGL_ATTRIB_DIRECT;
231 OGLAttrib[OGLargc++]=this->gl_config.stencil_size; 233 OGLAttrib[OGLargc++] = PHOGL_ATTRIB_FULLSCREEN_BEST;
232 } 234 OGLAttrib[OGLargc++] = PHOGL_ATTRIB_FULLSCREEN_CENTER;
233 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_FORCE_SW; 235 }
234 if (flags & SDL_FULLSCREEN) 236 OGLAttrib[OGLargc++] = PHOGL_ATTRIB_NONE;
235 { 237
236 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_FULLSCREEN; 238 if (this->gl_config.double_buffer) {
237 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_DIRECT; 239 oglctx = PdCreateOpenGLContext(2, &dim, 0, OGLAttrib);
238 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_FULLSCREEN_BEST; 240 } else {
239 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_FULLSCREEN_CENTER; 241 oglctx = PdCreateOpenGLContext(1, &dim, 0, OGLAttrib);
240 } 242 }
241 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_NONE; 243
242 244 if (oglctx == NULL) {
243 if (this->gl_config.double_buffer) 245 SDL_SetError
244 { 246 ("ph_SetupOpenGLContext(): cannot create OpenGL context !\n");
245 oglctx=PdCreateOpenGLContext(2, &dim, 0, OGLAttrib);
246 }
247 else
248 {
249 oglctx=PdCreateOpenGLContext(1, &dim, 0, OGLAttrib);
250 }
251
252 if (oglctx==NULL)
253 {
254 SDL_SetError("ph_SetupOpenGLContext(): cannot create OpenGL context !\n");
255 return -1; 247 return -1;
256 } 248 }
257 249
258 PhDCSetCurrent(oglctx); 250 PhDCSetCurrent(oglctx);
259 251
260 PtFlush(); 252 PtFlush();
261 253
262 oglflags=flags; 254 oglflags = flags;
263 oglbpp=bpp; 255 oglbpp = bpp;
264 256
265 if (exposepost!=0) 257 if (exposepost != 0) {
266 {
267 /* OpenGL context has been recreated, so report about this fact */ 258 /* OpenGL context has been recreated, so report about this fact */
268 SDL_PrivateExpose(); 259 SDL_PrivateExpose();
269 } 260 }
270 261
271 return 0; 262 return 0;
273 264
274 #else /* _NTO_VERSION */ 265 #else /* _NTO_VERSION */
275 266
276 /* This code is actual for the built-in PhGL support, which became available since 6.3 */ 267 /* This code is actual for the built-in PhGL support, which became available since 6.3 */
277 268
278 int ph_SetupOpenGLContext(_THIS, int width, int height, int bpp, Uint32 flags) 269 int
270 ph_SetupOpenGLContext(_THIS, int width, int height, int bpp, Uint32 flags)
279 { 271 {
280 qnxgl_buf_attrib_t qnxgl_attribs[PH_OGL_MAX_ATTRIBS]; 272 qnxgl_buf_attrib_t qnxgl_attribs[PH_OGL_MAX_ATTRIBS];
281 qnxgl_buf_attrib_t* qnxgl_attribs_slide; 273 qnxgl_buf_attrib_t *qnxgl_attribs_slide;
282 int num_interfaces = 0; 274 int num_interfaces = 0;
283 int num_buffers = 0; 275 int num_buffers = 0;
284 276
285 /* Initialize the OpenGL subsystem */ 277 /* Initialize the OpenGL subsystem */
286 278
287 num_interfaces = qnxgl_init(NULL, NULL, 0); 279 num_interfaces = qnxgl_init(NULL, NULL, 0);
288 280
289 if (num_interfaces < 0) 281 if (num_interfaces < 0) {
290 { 282 SDL_SetError
291 SDL_SetError("ph_SetupOpenGLContext(): cannot initialize OpenGL subsystem !\n"); 283 ("ph_SetupOpenGLContext(): cannot initialize OpenGL subsystem !\n");
292 return -1; 284 return -1;
293 } 285 }
294 if (num_interfaces == 0) 286 if (num_interfaces == 0) {
295 { 287 SDL_SetError
296 SDL_SetError("ph_SetupOpenGLContext(): there are no available OpenGL renderers was found !\n"); 288 ("ph_SetupOpenGLContext(): there are no available OpenGL renderers was found !\n");
297 return -1; 289 return -1;
298 } 290 }
299 291
300 /* Driver is linked */ 292 /* Driver is linked */
301 this->gl_config.driver_loaded=1; 293 this->gl_config.driver_loaded = 1;
302 294
303 /* Initialize the OpenGL context attributes */ 295 /* Initialize the OpenGL context attributes */
304 qnxgl_attribs_slide=qnxgl_attribs; 296 qnxgl_attribs_slide = qnxgl_attribs;
305 297
306 /* Depth size */ 298 /* Depth size */
307 if (this->gl_config.depth_size) 299 if (this->gl_config.depth_size) {
308 {
309 fprintf(stderr, "setted depth size %d\n", this->gl_config.depth_size); 300 fprintf(stderr, "setted depth size %d\n", this->gl_config.depth_size);
310 qnxgl_attribs_slide = qnxgl_attrib_set_depth(qnxgl_attribs_slide, this->gl_config.depth_size); 301 qnxgl_attribs_slide =
302 qnxgl_attrib_set_depth(qnxgl_attribs_slide,
303 this->gl_config.depth_size);
311 } 304 }
312 305
313 /* Stencil size */ 306 /* Stencil size */
314 if (this->gl_config.stencil_size) 307 if (this->gl_config.stencil_size) {
315 { 308 qnxgl_attribs_slide =
316 qnxgl_attribs_slide = qnxgl_attrib_set_stencil(qnxgl_attribs_slide, this->gl_config.stencil_size); 309 qnxgl_attrib_set_stencil(qnxgl_attribs_slide,
310 this->gl_config.stencil_size);
317 } 311 }
318 312
319 /* The sum of the accum bits of each channel */ 313 /* The sum of the accum bits of each channel */
320 if ((this->gl_config.accum_red_size != 0) && (this->gl_config.accum_blue_size != 0) && 314 if ((this->gl_config.accum_red_size != 0)
321 (this->gl_config.accum_green_size != 0)) 315 && (this->gl_config.accum_blue_size != 0)
322 { 316 && (this->gl_config.accum_green_size != 0)) {
323 qnxgl_attribs_slide = qnxgl_attrib_set_accum(qnxgl_attribs_slide, 317 qnxgl_attribs_slide = qnxgl_attrib_set_accum(qnxgl_attribs_slide,
324 this->gl_config.accum_red_size + this->gl_config.accum_blue_size + 318 this->gl_config.
325 this->gl_config.accum_green_size + this->gl_config.accum_alpha_size); 319 accum_red_size +
326 } 320 this->gl_config.
327 321 accum_blue_size +
322 this->gl_config.
323 accum_green_size +
324 this->gl_config.
325 accum_alpha_size);
326 }
327
328 /* Stereo mode */ 328 /* Stereo mode */
329 if (this->gl_config.stereo) 329 if (this->gl_config.stereo) {
330 {
331 qnxgl_attribs_slide = qnxgl_attrib_set_stereo(qnxgl_attribs_slide); 330 qnxgl_attribs_slide = qnxgl_attrib_set_stereo(qnxgl_attribs_slide);
332 } 331 }
333 332
334 /* Fullscreen mode */ 333 /* Fullscreen mode */
335 if ((flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) 334 if ((flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) {
336 { 335 qnxgl_attribs_slide =
337 qnxgl_attribs_slide = qnxgl_attrib_set_hint_fullscreen(qnxgl_attribs_slide); 336 qnxgl_attrib_set_hint_fullscreen(qnxgl_attribs_slide);
338 } 337 }
339 338
340 /* Double buffering mode */ 339 /* Double buffering mode */
341 if (this->gl_config.double_buffer) 340 if (this->gl_config.double_buffer) {
342 { 341 num_buffers = 2;
343 num_buffers=2; 342 } else {
344 } 343 num_buffers = 1;
345 else
346 {
347 num_buffers=1;
348 } 344 }
349 345
350 /* Loading the function pointers so we can use the extensions */ 346 /* Loading the function pointers so we can use the extensions */
351 GLPH_LOAD_FUNCS_GC(oglctx); 347 GLPH_LOAD_FUNCS_GC(oglctx);
352 348
353 /* Set the buffers region to be that of our window's region */ 349 /* Set the buffers region to be that of our window's region */
354 qnxgl_attribs_slide = glph_attrib_set_region(qnxgl_attribs_slide, PtWidgetRid(window)); 350 qnxgl_attribs_slide =
351 glph_attrib_set_region(qnxgl_attribs_slide, PtWidgetRid(window));
355 352
356 /* End of the attributes array */ 353 /* End of the attributes array */
357 qnxgl_attribs_slide = qnxgl_attrib_set_end(qnxgl_attribs_slide); 354 qnxgl_attribs_slide = qnxgl_attrib_set_end(qnxgl_attribs_slide);
358 355
359 /* Create the buffers with the specified color model */ 356 /* Create the buffers with the specified color model */
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); 357 fprintf(stderr, "ARGB: %d, %d, %d, %d\n", this->gl_config.alpha_size,
361 oglbuffers = qnxgl_buffers_create( 358 this->gl_config.red_size, this->gl_config.green_size,
362 QNXGL_FORMAT_BEST_RGB, 359 this->gl_config.blue_size);
360 oglbuffers = qnxgl_buffers_create(QNXGL_FORMAT_BEST_RGB,
363 /* __QNXGL_BUILD_FORMAT(0, __QNXGL_COLOR_MODEL_RGB, this->gl_config.alpha_size, 361 /* __QNXGL_BUILD_FORMAT(0, __QNXGL_COLOR_MODEL_RGB, this->gl_config.alpha_size,
364 this->gl_config.red_size, this->gl_config.green_size, this->gl_config.blue_size), */ 362 this->gl_config.red_size, this->gl_config.green_size, this->gl_config.blue_size), */
365 num_buffers, width, height, qnxgl_attribs, -1); 363 num_buffers, width, height,
366 364 qnxgl_attribs, -1);
367 365
368 if (oglbuffers == NULL) 366
369 { 367 if (oglbuffers == NULL) {
370 SDL_SetError("ph_SetupOpenGLContext(): failed to create OpenGL buffers !\n"); 368 SDL_SetError
369 ("ph_SetupOpenGLContext(): failed to create OpenGL buffers !\n");
371 qnxgl_finish(); 370 qnxgl_finish();
372 return -1; 371 return -1;
373 } 372 }
374 373
375 /* Create a QNXGL context for the previously created buffer */ 374 /* Create a QNXGL context for the previously created buffer */
376 oglctx = qnxgl_context_create(oglbuffers, NULL); 375 oglctx = qnxgl_context_create(oglbuffers, NULL);
377 376
378 if (oglctx == NULL) 377 if (oglctx == NULL) {
379 { 378 SDL_SetError
380 SDL_SetError("ph_SetupOpenGLContext(): failed to create OpenGL context !\n"); 379 ("ph_SetupOpenGLContext(): failed to create OpenGL context !\n");
381 qnxgl_buffers_destroy(oglbuffers); 380 qnxgl_buffers_destroy(oglbuffers);
382 qnxgl_finish(); 381 qnxgl_finish();
383 return -1; 382 return -1;
384 } 383 }
385 384
386 /* Attempt to make the context current so we can use OpenGL commands */ 385 /* Attempt to make the context current so we can use OpenGL commands */
387 if (qnxgl_set_current(oglctx) == -1) 386 if (qnxgl_set_current(oglctx) == -1) {
388 { 387 SDL_SetError
389 SDL_SetError("ph_SetupOpenGLContext(): failed to make the OpenGL context current !\n"); 388 ("ph_SetupOpenGLContext(): failed to make the OpenGL context current !\n");
390 qnxgl_context_destroy(oglctx); 389 qnxgl_context_destroy(oglctx);
391 qnxgl_buffers_destroy(oglbuffers); 390 qnxgl_buffers_destroy(oglbuffers);
392 qnxgl_finish(); 391 qnxgl_finish();
393 return -1; 392 return -1;
394 } 393 }
395 394
396 PtFlush(); 395 PtFlush();
397 396
398 oglflags=flags; 397 oglflags = flags;
399 oglbpp=bpp; 398 oglbpp = bpp;
400 399
401 return 0; 400 return 0;
402 } 401 }
403 402
404 #endif /* _NTO_VERSION */ 403 #endif /* _NTO_VERSION */
405 404
406 #endif /* SDL_VIDEO_OPENGL */ 405 #endif /* SDL_VIDEO_OPENGL */
406 /* vi: set ts=4 sw=4 expandtab: */