Mercurial > sdl-ios-xcode
comparison src/video/photon/SDL_ph_gl.c @ 1662:782fd950bd46 SDL-1.3
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
WARNING: None of the video drivers have been updated for the new API yet! The API is still under design and very fluid.
The code is now run through a consistent indent format:
indent -i4 -nut -nsc -br -ce
The headers are being converted to automatically generate doxygen documentation.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 28 May 2006 13:04:16 +0000 |
parents | d910939febfa |
children | 4da1ee79c9af |
comparison
equal
deleted
inserted
replaced
1661:281d3f4870e5 | 1662:782fd950bd46 |
---|---|
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 { | 37 ph_GL_SwapBuffers (_THIS) |
38 PgSetRegion(PtWidgetRid(window)); | 38 { |
39 PdOpenGLContextSwapBuffers(oglctx); | 39 PgSetRegion (PtWidgetRid (window)); |
40 PdOpenGLContextSwapBuffers (oglctx); | |
40 } | 41 } |
41 #else | 42 #else |
42 void ph_GL_SwapBuffers(_THIS) | 43 void |
43 { | 44 ph_GL_SwapBuffers (_THIS) |
44 qnxgl_swap_buffers(oglbuffers); | 45 { |
45 } | 46 qnxgl_swap_buffers (oglbuffers); |
46 #endif /* 6.3.0 */ | 47 } |
47 | 48 #endif /* 6.3.0 */ |
48 int ph_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value) | 49 |
49 { | 50 int |
50 switch (attrib) | 51 ph_GL_GetAttribute (_THIS, SDL_GLattr attrib, int *value) |
51 { | 52 { |
52 case SDL_GL_DOUBLEBUFFER: | 53 switch (attrib) { |
53 *value=this->gl_config.double_buffer; | 54 case SDL_GL_DOUBLEBUFFER: |
54 break; | 55 *value = this->gl_config.double_buffer; |
55 case SDL_GL_STENCIL_SIZE: | 56 break; |
56 *value=this->gl_config.stencil_size; | 57 case SDL_GL_STENCIL_SIZE: |
57 break; | 58 *value = this->gl_config.stencil_size; |
58 case SDL_GL_DEPTH_SIZE: | 59 break; |
59 *value=this->gl_config.depth_size; | 60 case SDL_GL_DEPTH_SIZE: |
60 break; | 61 *value = this->gl_config.depth_size; |
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 { | 122 SDL_SetError ("ph_GL_LoadLibrary(): Could not load OpenGL library"); |
120 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 |
164 { | 166 ph_GL_MakeCurrent (_THIS) |
165 PgSetRegion(PtWidgetRid(window)); | 167 { |
166 | 168 PgSetRegion (PtWidgetRid (window)); |
167 if (oglctx!=NULL) | 169 |
168 { | 170 if (oglctx != NULL) { |
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 |
176 { | 178 ph_GL_MakeCurrent (_THIS) |
177 PgSetRegion(PtWidgetRid(window)); | 179 { |
178 | 180 PgSetRegion (PtWidgetRid (window)); |
179 if (oglctx!=NULL) | 181 |
180 { | 182 if (oglctx != NULL) { |
181 if (qnxgl_set_current(oglctx) == -1) | 183 if (qnxgl_set_current (oglctx) == -1) { |
182 { | 184 return -1; |
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); | 247 return -1; |
246 } | 248 } |
247 else | 249 |
248 { | 250 PhDCSetCurrent (oglctx); |
249 oglctx=PdCreateOpenGLContext(1, &dim, 0, OGLAttrib); | 251 |
250 } | 252 PtFlush (); |
251 | 253 |
252 if (oglctx==NULL) | 254 oglflags = flags; |
253 { | 255 oglbpp = bpp; |
254 SDL_SetError("ph_SetupOpenGLContext(): cannot create OpenGL context !\n"); | 256 |
255 return -1; | 257 if (exposepost != 0) { |
256 } | |
257 | |
258 PhDCSetCurrent(oglctx); | |
259 | |
260 PtFlush(); | |
261 | |
262 oglflags=flags; | |
263 oglbpp=bpp; | |
264 | |
265 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; |
272 } | 263 } |
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 { | 300 fprintf (stderr, "setted depth size %d\n", |
309 fprintf(stderr, "setted depth size %d\n", this->gl_config.depth_size); | 301 this->gl_config.depth_size); |
310 qnxgl_attribs_slide = qnxgl_attrib_set_depth(qnxgl_attribs_slide, this->gl_config.depth_size); | 302 qnxgl_attribs_slide = |
303 qnxgl_attrib_set_depth (qnxgl_attribs_slide, | |
304 this->gl_config.depth_size); | |
311 } | 305 } |
312 | 306 |
313 /* Stencil size */ | 307 /* Stencil size */ |
314 if (this->gl_config.stencil_size) | 308 if (this->gl_config.stencil_size) { |
315 { | 309 qnxgl_attribs_slide = |
316 qnxgl_attribs_slide = qnxgl_attrib_set_stencil(qnxgl_attribs_slide, this->gl_config.stencil_size); | 310 qnxgl_attrib_set_stencil (qnxgl_attribs_slide, |
311 this->gl_config.stencil_size); | |
317 } | 312 } |
318 | 313 |
319 /* The sum of the accum bits of each channel */ | 314 /* 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) && | 315 if ((this->gl_config.accum_red_size != 0) |
321 (this->gl_config.accum_green_size != 0)) | 316 && (this->gl_config.accum_blue_size != 0) |
322 { | 317 && (this->gl_config.accum_green_size != 0)) { |
323 qnxgl_attribs_slide = qnxgl_attrib_set_accum(qnxgl_attribs_slide, | 318 qnxgl_attribs_slide = qnxgl_attrib_set_accum (qnxgl_attribs_slide, |
324 this->gl_config.accum_red_size + this->gl_config.accum_blue_size + | 319 this->gl_config. |
325 this->gl_config.accum_green_size + this->gl_config.accum_alpha_size); | 320 accum_red_size + |
326 } | 321 this->gl_config. |
327 | 322 accum_blue_size + |
323 this->gl_config. | |
324 accum_green_size + | |
325 this->gl_config. | |
326 accum_alpha_size); | |
327 } | |
328 | |
328 /* Stereo mode */ | 329 /* Stereo mode */ |
329 if (this->gl_config.stereo) | 330 if (this->gl_config.stereo) { |
330 { | 331 qnxgl_attribs_slide = qnxgl_attrib_set_stereo (qnxgl_attribs_slide); |
331 qnxgl_attribs_slide = qnxgl_attrib_set_stereo(qnxgl_attribs_slide); | |
332 } | 332 } |
333 | 333 |
334 /* Fullscreen mode */ | 334 /* Fullscreen mode */ |
335 if ((flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) | 335 if ((flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) { |
336 { | 336 qnxgl_attribs_slide = |
337 qnxgl_attribs_slide = qnxgl_attrib_set_hint_fullscreen(qnxgl_attribs_slide); | 337 qnxgl_attrib_set_hint_fullscreen (qnxgl_attribs_slide); |
338 } | 338 } |
339 | 339 |
340 /* Double buffering mode */ | 340 /* Double buffering mode */ |
341 if (this->gl_config.double_buffer) | 341 if (this->gl_config.double_buffer) { |
342 { | 342 num_buffers = 2; |
343 num_buffers=2; | 343 } else { |
344 } | 344 num_buffers = 1; |
345 else | |
346 { | |
347 num_buffers=1; | |
348 } | 345 } |
349 | 346 |
350 /* Loading the function pointers so we can use the extensions */ | 347 /* Loading the function pointers so we can use the extensions */ |
351 GLPH_LOAD_FUNCS_GC(oglctx); | 348 GLPH_LOAD_FUNCS_GC (oglctx); |
352 | 349 |
353 /* Set the buffers region to be that of our window's region */ | 350 /* 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)); | 351 qnxgl_attribs_slide = |
352 glph_attrib_set_region (qnxgl_attribs_slide, PtWidgetRid (window)); | |
355 | 353 |
356 /* End of the attributes array */ | 354 /* End of the attributes array */ |
357 qnxgl_attribs_slide = qnxgl_attrib_set_end(qnxgl_attribs_slide); | 355 qnxgl_attribs_slide = qnxgl_attrib_set_end (qnxgl_attribs_slide); |
358 | 356 |
359 /* Create the buffers with the specified color model */ | 357 /* 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); | 358 fprintf (stderr, "ARGB: %d, %d, %d, %d\n", this->gl_config.alpha_size, |
361 oglbuffers = qnxgl_buffers_create( | 359 this->gl_config.red_size, this->gl_config.green_size, |
362 QNXGL_FORMAT_BEST_RGB, | 360 this->gl_config.blue_size); |
361 oglbuffers = qnxgl_buffers_create (QNXGL_FORMAT_BEST_RGB, | |
363 /* __QNXGL_BUILD_FORMAT(0, __QNXGL_COLOR_MODEL_RGB, this->gl_config.alpha_size, | 362 /* __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), */ | 363 this->gl_config.red_size, this->gl_config.green_size, this->gl_config.blue_size), */ |
365 num_buffers, width, height, qnxgl_attribs, -1); | 364 num_buffers, width, height, |
366 | 365 qnxgl_attribs, -1); |
367 | 366 |
368 if (oglbuffers == NULL) | 367 |
369 { | 368 if (oglbuffers == NULL) { |
370 SDL_SetError("ph_SetupOpenGLContext(): failed to create OpenGL buffers !\n"); | 369 SDL_SetError |
371 qnxgl_finish(); | 370 ("ph_SetupOpenGLContext(): failed to create OpenGL buffers !\n"); |
371 qnxgl_finish (); | |
372 return -1; | 372 return -1; |
373 } | 373 } |
374 | 374 |
375 /* Create a QNXGL context for the previously created buffer */ | 375 /* Create a QNXGL context for the previously created buffer */ |
376 oglctx = qnxgl_context_create(oglbuffers, NULL); | 376 oglctx = qnxgl_context_create (oglbuffers, NULL); |
377 | 377 |
378 if (oglctx == NULL) | 378 if (oglctx == NULL) { |
379 { | 379 SDL_SetError |
380 SDL_SetError("ph_SetupOpenGLContext(): failed to create OpenGL context !\n"); | 380 ("ph_SetupOpenGLContext(): failed to create OpenGL context !\n"); |
381 qnxgl_buffers_destroy(oglbuffers); | 381 qnxgl_buffers_destroy (oglbuffers); |
382 qnxgl_finish(); | 382 qnxgl_finish (); |
383 return -1; | 383 return -1; |
384 } | 384 } |
385 | 385 |
386 /* Attempt to make the context current so we can use OpenGL commands */ | 386 /* Attempt to make the context current so we can use OpenGL commands */ |
387 if (qnxgl_set_current(oglctx) == -1) | 387 if (qnxgl_set_current (oglctx) == -1) { |
388 { | 388 SDL_SetError |
389 SDL_SetError("ph_SetupOpenGLContext(): failed to make the OpenGL context current !\n"); | 389 ("ph_SetupOpenGLContext(): failed to make the OpenGL context current !\n"); |
390 qnxgl_context_destroy(oglctx); | 390 qnxgl_context_destroy (oglctx); |
391 qnxgl_buffers_destroy(oglbuffers); | 391 qnxgl_buffers_destroy (oglbuffers); |
392 qnxgl_finish(); | 392 qnxgl_finish (); |
393 return -1; | 393 return -1; |
394 } | 394 } |
395 | 395 |
396 PtFlush(); | 396 PtFlush (); |
397 | 397 |
398 oglflags=flags; | 398 oglflags = flags; |
399 oglbpp=bpp; | 399 oglbpp = bpp; |
400 | 400 |
401 return 0; | 401 return 0; |
402 } | 402 } |
403 | 403 |
404 #endif /* _NTO_VERSION */ | 404 #endif /* _NTO_VERSION */ |
405 | 405 |
406 #endif /* SDL_VIDEO_OPENGL */ | 406 #endif /* SDL_VIDEO_OPENGL */ |
407 /* vi: set ts=4 sw=4 expandtab: */ |