Mercurial > sdl-ios-xcode
annotate src/video/photon/SDL_photon.c @ 4829:7160e833c4ac
Implemented shaped windows for Cocoa. Still need to see if they actually work.
author | egottlieb |
---|---|
date | Tue, 03 Aug 2010 21:56:05 -0400 |
parents | f7b03b6838cb |
children | 25d4feb7c127 |
rev | line source |
---|---|
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1 /* |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
3697 | 3 Copyright (C) 1997-2010 Sam Lantinga |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4 |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
9 |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
13 Lesser General Public License for more details. |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
14 |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
18 |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
19 Sam Lantinga |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
20 slouken@libsdl.org |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
21 |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
22 QNX Photon GUI SDL driver |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
23 Copyright (C) 2009 Mike Gorchak |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
24 (mike@malva.ua, lestat@i.com.ua) |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
25 */ |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
26 |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
27 /* SDL internals */ |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
28 #include "SDL_config.h" |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
29 #include "../SDL_sysvideo.h" |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
30 #include "SDL_version.h" |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
31 #include "SDL_syswm.h" |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
32 #include "SDL_loadso.h" |
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
33 #include "SDL_events.h" |
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
34 #include "../../events/SDL_mouse_c.h" |
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
35 #include "../../events/SDL_keyboard_c.h" |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
36 |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
37 /* Photon declarations */ |
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
38 #include "SDL_photon.h" |
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
39 |
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
40 /* Pixel format conversion routines */ |
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
41 #include "SDL_photon_pixelfmt.h" |
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
42 |
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
43 /* Use GF's pixel format functions for OpenGL ES context creation */ |
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
44 #if defined(SDL_VIDEO_OPENGL_ES) |
3139 | 45 #include "../qnxgf/SDL_gf_pixelfmt.h" |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
46 |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
47 /* If GF driver is not compiled in, include some of usefull functions */ |
3139 | 48 #if !defined(SDL_VIDEO_DRIVER_QNXGF) |
49 #include "../qnxgf/SDL_gf_pixelfmt.c" | |
50 #endif /* SDL_VIDEO_DRIVER_QNXGF */ | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
51 #endif /* SDL_VIDEO_OPENGL_ES */ |
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
52 |
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
53 /* Use GF's OpenGL ES 1.1 functions emulation */ |
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
54 #if defined(SDL_VIDEO_OPENGL_ES) |
3139 | 55 #include "../qnxgf/SDL_gf_opengles.h" |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
56 |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
57 /* If GF driver is not compiled in, include some of usefull functions */ |
3139 | 58 #if !defined(SDL_VIDEO_DRIVER_QNXGF) |
59 #include "../qnxgf/SDL_gf_opengles.c" | |
60 #endif /* SDL_VIDEO_DRIVER_QNXGF */ | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
61 #endif /* SDL_VIDEO_OPENGL_ES */ |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
62 |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
63 /* Low level device graphics driver names, which they are reporting */ |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
64 static const Photon_DeviceCaps photon_devicename[] = { |
3139 | 65 /* ATI Rage 128 graphics driver (devg-ati_rage128) */ |
66 {"ati_rage128", SDL_PHOTON_ACCELERATED | SDL_PHOTON_UNACCELERATED_3D} | |
67 , | |
68 /* Fujitsu Carmine graphics driver (devg-carmine.so) */ | |
69 {"carmine", SDL_PHOTON_ACCELERATED | SDL_PHOTON_ACCELERATED_3D} | |
70 , | |
71 /* C&T graphics driver (devg-chips.so) */ | |
72 {"chips", SDL_PHOTON_ACCELERATED | SDL_PHOTON_UNACCELERATED_3D} | |
73 , | |
74 /* Fujitsu Coral graphics driver (devg-coral.so) */ | |
75 {"coral", SDL_PHOTON_ACCELERATED | SDL_PHOTON_ACCELERATED_3D} | |
76 , | |
77 /* Intel integrated graphics driver (devg-extreme2.so) */ | |
78 {"extreme2", SDL_PHOTON_ACCELERATED | SDL_PHOTON_ACCELERATED_3D} | |
79 , | |
80 /* Unaccelerated FB driver (devg-flat.so) */ | |
81 {"flat", SDL_PHOTON_UNACCELERATED | SDL_PHOTON_UNACCELERATED_3D} | |
82 , | |
83 /* NS Geode graphics driver (devg-geode.so) */ | |
84 {"geode", SDL_PHOTON_ACCELERATED | SDL_PHOTON_UNACCELERATED_3D} | |
85 , | |
86 /* Geode LX graphics driver (devg-geodelx.so) */ | |
87 {"geodelx", SDL_PHOTON_ACCELERATED | SDL_PHOTON_UNACCELERATED_3D} | |
88 , | |
89 /* Intel integrated graphics driver (devg-gma9xx.so) */ | |
90 {"gma", SDL_PHOTON_ACCELERATED | SDL_PHOTON_ACCELERATED_3D} | |
91 , | |
92 /* Intel integrated graphics driver (devg-i810.so) */ | |
93 {"i810", SDL_PHOTON_ACCELERATED | SDL_PHOTON_UNACCELERATED_3D} | |
94 , | |
95 /* Intel integrated graphics driver (devg-i830.so) */ | |
96 {"i830", SDL_PHOTON_ACCELERATED | SDL_PHOTON_UNACCELERATED_3D} | |
97 , | |
98 /* Geode LX graphics driver (devg-lx800.so) */ | |
99 {"lx800", SDL_PHOTON_ACCELERATED | SDL_PHOTON_UNACCELERATED_3D} | |
100 , | |
101 /* Matrox Gxx graphics driver (devg-matroxg.so) */ | |
102 {"matroxg", SDL_PHOTON_ACCELERATED | SDL_PHOTON_UNACCELERATED_3D} | |
103 , | |
104 /* Intel Poulsbo graphics driver (devg-poulsbo.so) */ | |
105 {"poulsbo", SDL_PHOTON_ACCELERATED | SDL_PHOTON_ACCELERATED_3D} | |
106 , | |
107 /* ATI Radeon driver (devg-radeon.so) */ | |
108 {"radeon", SDL_PHOTON_ACCELERATED | SDL_PHOTON_UNACCELERATED_3D} | |
109 , | |
110 /* ATI Rage driver (devg-rage.so) */ | |
111 {"rage", SDL_PHOTON_ACCELERATED | SDL_PHOTON_UNACCELERATED_3D} | |
112 , | |
113 /* S3 Savage graphics driver (devg-s3_savage.so) */ | |
114 {"s3_savage", SDL_PHOTON_ACCELERATED | SDL_PHOTON_UNACCELERATED_3D} | |
115 , | |
116 /* SiS630 integrated graphics driver (devg-sis630.so) */ | |
117 {"sis630", SDL_PHOTON_ACCELERATED | SDL_PHOTON_UNACCELERATED_3D} | |
118 , | |
119 /* PowerVR SGX 535 graphics driver (devg-poulsbo.so) */ | |
120 {"sgx", SDL_PHOTON_ACCELERATED | SDL_PHOTON_ACCELERATED_3D} | |
121 , | |
122 /* SM Voyager GX graphics driver (devg-smi5xx.so) */ | |
123 {"smi5xx", SDL_PHOTON_ACCELERATED | SDL_PHOTON_UNACCELERATED_3D} | |
124 , | |
125 /* Silicon Motion graphics driver (devg-smi7xx.so) */ | |
126 {"smi7xx", SDL_PHOTON_ACCELERATED | SDL_PHOTON_UNACCELERATED_3D} | |
127 , | |
128 /* SVGA unaccelerated gfx driver (devg-svga.so) */ | |
129 {"svga", SDL_PHOTON_UNACCELERATED | SDL_PHOTON_UNACCELERATED_3D} | |
130 , | |
131 /* nVidia TNT graphics driver (devg-tnt.so) */ | |
132 {"tnt", SDL_PHOTON_ACCELERATED | SDL_PHOTON_UNACCELERATED_3D} | |
133 , | |
134 /* VIA integrated graphics driver (devg-tvia.so) */ | |
135 {"tvia", SDL_PHOTON_ACCELERATED | SDL_PHOTON_UNACCELERATED_3D} | |
136 , | |
137 /* VIA UniChrome graphics driver (devg-unichrome.so) */ | |
138 {"unichrome", SDL_PHOTON_ACCELERATED | SDL_PHOTON_UNACCELERATED_3D} | |
139 , | |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
140 /* VESA unaccelerated gfx driver (devg-vesabios.so) */ |
3139 | 141 {"vesa", SDL_PHOTON_UNACCELERATED | SDL_PHOTON_UNACCELERATED_3D} |
142 , | |
143 /* VmWare graphics driver (devg-volari.so) */ | |
144 {"vmware", SDL_PHOTON_ACCELERATED | SDL_PHOTON_UNACCELERATED_3D} | |
145 , | |
146 /* XGI XP10 graphics driver (devg-volari.so), OpenGL 1.5 */ | |
147 {"volari", SDL_PHOTON_ACCELERATED | SDL_PHOTON_UNACCELERATED_3D} | |
148 , | |
149 /* End of list */ | |
150 {NULL, 0x00000000} | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
151 }; |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
152 |
3139 | 153 static SDL_bool photon_initialized = SDL_FALSE; |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
154 |
3139 | 155 static int |
156 photon_available(void) | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
157 { |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
158 int32_t status; |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
159 |
3139 | 160 /* Check if Photon was initialized before */ |
161 if (photon_initialized == SDL_FALSE) { | |
162 /* Initialize Photon widget library and open channel to Photon */ | |
163 status = PtInit(NULL); | |
164 if (status == 0) { | |
165 photon_initialized = SDL_TRUE; | |
166 return 1; | |
167 } else { | |
168 photon_initialized = SDL_FALSE; | |
169 return 0; | |
170 } | |
171 } | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
172 |
3139 | 173 return 1; |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
174 } |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
175 |
3139 | 176 static void |
177 photon_destroy(SDL_VideoDevice * device) | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
178 { |
3139 | 179 SDL_VideoData *phdata = (SDL_VideoData *) device->driverdata; |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
180 |
3139 | 181 #if defined(SDL_VIDEO_OPENGL_ES) |
182 if (phdata->gfinitialized != SDL_FALSE) { | |
183 gf_dev_detach(phdata->gfdev); | |
184 } | |
185 #endif /* SDL_VIDEO_OPENGL_ES */ | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
186 |
3139 | 187 if (device->driverdata != NULL) { |
188 device->driverdata = NULL; | |
189 } | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
190 } |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
191 |
3139 | 192 static SDL_VideoDevice * |
193 photon_create(int devindex) | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
194 { |
3139 | 195 SDL_VideoDevice *device; |
196 SDL_VideoData *phdata; | |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
197 int32_t status; |
3139 | 198 |
199 /* Check if photon could be initialized */ | |
200 status = photon_available(); | |
201 if (status == 0) { | |
202 /* Photon could not be used */ | |
203 return NULL; | |
204 } | |
205 | |
206 /* Photon agregates all video devices to one with multiple heads */ | |
207 if (devindex != 0) { | |
208 /* devindex could be zero only in Photon SDL driver */ | |
209 return NULL; | |
210 } | |
211 | |
212 /* Initialize SDL_VideoDevice structure */ | |
213 device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice)); | |
214 if (device == NULL) { | |
215 SDL_OutOfMemory(); | |
216 return NULL; | |
217 } | |
218 | |
219 /* Initialize internal photon specific data */ | |
220 phdata = (SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData)); | |
221 if (phdata == NULL) { | |
222 SDL_OutOfMemory(); | |
223 SDL_free(device); | |
224 return NULL; | |
225 } | |
226 device->driverdata = phdata; | |
227 | |
228 /* Get all photon display devices */ | |
229 phdata->avail_rids = | |
230 PdGetDevices(&phdata->rid[0], SDL_VIDEO_PHOTON_MAX_RIDS); | |
231 if (phdata->avail_rids > SDL_VIDEO_PHOTON_MAX_RIDS) { | |
232 phdata->avail_rids = SDL_VIDEO_PHOTON_MAX_RIDS; | |
233 } | |
234 #if defined(SDL_VIDEO_OPENGL_ES) | |
235 /* TODO: add real device detection versus multiple heads */ | |
236 status = | |
237 gf_dev_attach(&phdata->gfdev, GF_DEVICE_INDEX(0), | |
238 &phdata->gfdev_info); | |
239 if (status != GF_ERR_OK) { | |
240 /* Do not fail right now, if GF can't be attached */ | |
241 phdata->gfinitialized = SDL_FALSE; | |
242 } else { | |
243 phdata->gfinitialized = SDL_TRUE; | |
244 } | |
245 #endif /* SDL_VIDEO_OPENGL_ES */ | |
246 | |
247 /* Set default target device */ | |
248 status = PdSetTargetDevice(NULL, phdata->rid[0]); | |
249 if (status == -1) { | |
250 SDL_SetError("Photon: Can't set default target device"); | |
251 #if defined(SDL_VIDEO_OPENGL_ES) | |
252 gf_dev_detach(phdata->gfdev); | |
253 #endif /* SDL_VIDEO_OPENGL_ES */ | |
254 SDL_free(phdata); | |
255 SDL_free(device); | |
256 return NULL; | |
257 } | |
258 phdata->current_device_id = 0; | |
259 | |
260 /* Setup amount of available displays and current display */ | |
261 device->num_displays = 0; | |
262 device->current_display = 0; | |
263 | |
264 /* Set device free function */ | |
265 device->free = photon_destroy; | |
266 | |
267 /* Setup all functions which we can handle */ | |
268 device->VideoInit = photon_videoinit; | |
269 device->VideoQuit = photon_videoquit; | |
270 device->GetDisplayModes = photon_getdisplaymodes; | |
271 device->SetDisplayMode = photon_setdisplaymode; | |
272 device->CreateWindow = photon_createwindow; | |
273 device->CreateWindowFrom = photon_createwindowfrom; | |
274 device->SetWindowTitle = photon_setwindowtitle; | |
275 device->SetWindowIcon = photon_setwindowicon; | |
276 device->SetWindowPosition = photon_setwindowposition; | |
277 device->SetWindowSize = photon_setwindowsize; | |
278 device->ShowWindow = photon_showwindow; | |
279 device->HideWindow = photon_hidewindow; | |
280 device->RaiseWindow = photon_raisewindow; | |
281 device->MaximizeWindow = photon_maximizewindow; | |
282 device->MinimizeWindow = photon_minimizewindow; | |
283 device->RestoreWindow = photon_restorewindow; | |
284 device->SetWindowGrab = photon_setwindowgrab; | |
285 device->DestroyWindow = photon_destroywindow; | |
286 device->GetWindowWMInfo = photon_getwindowwminfo; | |
287 device->GL_LoadLibrary = photon_gl_loadlibrary; | |
288 device->GL_GetProcAddress = photon_gl_getprocaddres; | |
289 device->GL_UnloadLibrary = photon_gl_unloadlibrary; | |
290 device->GL_CreateContext = photon_gl_createcontext; | |
291 device->GL_MakeCurrent = photon_gl_makecurrent; | |
292 device->GL_SetSwapInterval = photon_gl_setswapinterval; | |
293 device->GL_GetSwapInterval = photon_gl_getswapinterval; | |
294 device->GL_SwapWindow = photon_gl_swapwindow; | |
295 device->GL_DeleteContext = photon_gl_deletecontext; | |
296 device->PumpEvents = photon_pumpevents; | |
297 device->SuspendScreenSaver = photon_suspendscreensaver; | |
298 | |
299 return device; | |
300 } | |
301 | |
302 VideoBootStrap photon_bootstrap = { | |
303 "photon", | |
304 "SDL QNX Photon video driver", | |
305 photon_available, | |
306 photon_create | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
307 }; |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
308 |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
309 /*****************************************************************************/ |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
310 /* SDL Video and Display initialization/handling functions */ |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
311 /*****************************************************************************/ |
3139 | 312 int |
313 photon_videoinit(_THIS) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
314 { |
3139 | 315 SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; |
316 PgHWCaps_t hwcaps; | |
317 PgVideoModeInfo_t modeinfo; | |
318 int32_t status; | |
319 SDL_VideoDisplay display; | |
320 SDL_DisplayMode current_mode; | |
321 SDL_DisplayData *didata; | |
322 uint32_t it; | |
323 uint32_t jt; | |
324 char *override; | |
325 | |
326 /* By default Photon do not uses swap on VSYNC */ | |
3411
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
327 #if defined(SDL_VIDEO_OPENGL_ES) |
3139 | 328 phdata->swapinterval = 0; |
3411
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
329 #endif /* SDL_VIDEO_OPENGL_ES */ |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
330 |
3139 | 331 for (it = 0; it < phdata->avail_rids; it++) { |
332 didata = (SDL_DisplayData *) SDL_calloc(1, sizeof(SDL_DisplayData)); | |
333 if (didata == NULL) { | |
334 /* memory allocation error */ | |
335 SDL_OutOfMemory(); | |
336 return -1; | |
337 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
338 |
3139 | 339 /* Allocate two cursors with SDL_VIDEO_PHOTON_MAX_CURSOR_SIZE size */ |
340 /* and 128 bytes of spare place */ | |
341 didata->cursor_size = | |
342 ((SDL_VIDEO_PHOTON_MAX_CURSOR_SIZE * 4) >> 3) + 128; | |
343 didata->cursor = (PhCursorDef_t *) SDL_calloc(1, didata->cursor_size); | |
344 if (didata->cursor == NULL) { | |
345 /* memory allocation error */ | |
346 SDL_OutOfMemory(); | |
347 SDL_free(didata); | |
348 return -1; | |
349 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
350 |
3139 | 351 /* Initialize GF in case of OpenGL ES support is compiled in */ |
352 #if defined(SDL_VIDEO_OPENGL_ES) | |
353 /* TODO: add real device detection versus multiple heads */ | |
354 if (phdata->gfinitialized == SDL_TRUE) { | |
355 status = | |
356 gf_display_attach(&didata->display, phdata->gfdev, it, | |
357 &didata->display_info); | |
358 if (status != GF_ERR_OK) { | |
359 /* Just shutdown GF, do not fail */ | |
360 gf_dev_detach(phdata->gfdev); | |
361 phdata->gfinitialized = SDL_FALSE; | |
362 } | |
363 } | |
364 #endif /* SDL_VIDEO_OPENGL_ES */ | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
365 |
3139 | 366 /* Check if current device is not the same as target */ |
367 if (phdata->current_device_id != it) { | |
368 /* Set target device as default for Pd and Pg functions */ | |
369 status = PdSetTargetDevice(NULL, phdata->rid[it]); | |
370 if (status != 0) { | |
371 SDL_SetError("Photon: Can't set default target device\n"); | |
372 SDL_free(didata->cursor); | |
373 SDL_free(didata); | |
374 return -1; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
375 } |
3139 | 376 phdata->current_device_id = it; |
377 } | |
378 | |
379 /* Store device id */ | |
380 didata->device_id = it; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
381 |
3139 | 382 /* Query photon about graphics hardware caps and current video mode */ |
3384
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
383 SDL_memset(&hwcaps, 0x00, sizeof(PgHWCaps_t)); |
3139 | 384 status = PgGetGraphicsHWCaps(&hwcaps); |
385 if (status != 0) { | |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
386 PhRect_t extent; |
3193
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
387 PdOffscreenContext_t* curctx; |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
388 |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
389 /* If error happens, this also could mean, that photon is working */ |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
390 /* under custom (not listed by photon) video mode */ |
3193
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
391 status=PhWindowQueryVisible(Ph_QUERY_GRAPHICS, 0, 0, &extent); |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
392 if (status != 0) { |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
393 SDL_SetError("Photon: Can't get graphics driver region"); |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
394 SDL_free(didata->cursor); |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
395 SDL_free(didata); |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
396 return -1; |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
397 } |
3193
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
398 modeinfo.width=extent.lr.x+1; |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
399 modeinfo.height=extent.lr.y+1; |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
400 /* Hardcode 60Hz, as the base refresh rate frequency */ |
3193
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
401 hwcaps.current_rrate=60; |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
402 /* Clear current video driver name, no way to get it somehow */ |
3193
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
403 hwcaps.chip_name[0]=0x00; |
3139 | 404 |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
405 /* Create offscreen context from video memory, which is currently */ |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
406 /* displayed on the screen */ |
3193
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
407 curctx=PdCreateOffscreenContext(0, 0, 0, Pg_OSC_MAIN_DISPLAY); |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
408 if (curctx==NULL) |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
409 { |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
410 SDL_SetError("Photon: Can't get display area capabilities"); |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
411 SDL_free(didata->cursor); |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
412 SDL_free(didata); |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
413 return -1; |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
414 } |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
415 /* Retrieve current bpp */ |
3193
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
416 modeinfo.type=curctx->format; |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
417 PhDCRelease(curctx); |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
418 } else { |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
419 /* Get current video mode details */ |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
420 status = PgGetVideoModeInfo(hwcaps.current_video_mode, &modeinfo); |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
421 if (status != 0) { |
3193
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
422 SDL_SetError("Photon: Can't get current video mode information"); |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
423 SDL_free(didata->cursor); |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
424 SDL_free(didata); |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
425 return -1; |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
426 } |
3384
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
427 |
3399
f96615051c8c
Working on fullscreen video modes support
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
428 /* Get current video mode 2D capabilities for the renderer */ |
3384
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
429 didata->mode_2dcaps=0; |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
430 if ((modeinfo.mode_capabilities2 & PgVM_MODE_CAP2_ALPHA_BLEND)==PgVM_MODE_CAP2_ALPHA_BLEND) |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
431 { |
3386
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
432 didata->mode_2dcaps|=SDL_VIDEO_PHOTON_CAP_ALPHA_BLEND; |
3384
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
433 } |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
434 if ((modeinfo.mode_capabilities2 & PgVM_MODE_CAP2_SCALED_BLIT)==PgVM_MODE_CAP2_SCALED_BLIT) |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
435 { |
3386
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
436 didata->mode_2dcaps|=SDL_VIDEO_PHOTON_CAP_SCALED_BLIT; |
3384
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
437 } |
3139 | 438 } |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
439 |
3139 | 440 /* Setup current desktop mode for SDL */ |
441 SDL_zero(current_mode); | |
442 current_mode.w = modeinfo.width; | |
443 current_mode.h = modeinfo.height; | |
444 current_mode.refresh_rate = hwcaps.current_rrate; | |
445 current_mode.format = photon_image_to_sdl_pixelformat(modeinfo.type); | |
446 current_mode.driverdata = NULL; | |
447 | |
448 /* Copy device name */ | |
449 SDL_strlcpy(didata->description, hwcaps.chip_name, | |
450 SDL_VIDEO_PHOTON_DEVICENAME_MAX - 1); | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
451 |
3139 | 452 /* Search device capabilities and possible workarounds */ |
453 jt = 0; | |
454 do { | |
455 if (photon_devicename[jt].name == NULL) { | |
456 break; | |
457 } | |
458 if (SDL_strncmp | |
459 (photon_devicename[jt].name, didata->description, | |
460 SDL_strlen(photon_devicename[jt].name)) == 0) { | |
461 didata->caps = photon_devicename[jt].caps; | |
462 } | |
463 jt++; | |
464 } while (1); | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
465 |
3139 | 466 /* Initialize display structure */ |
467 SDL_zero(display); | |
468 display.desktop_mode = current_mode; | |
469 display.current_mode = current_mode; | |
3399
f96615051c8c
Working on fullscreen video modes support
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
470 display.fullscreen_mode = current_mode; |
3139 | 471 display.driverdata = didata; |
472 didata->current_mode = current_mode; | |
473 SDL_AddVideoDisplay(&display); | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
474 |
3139 | 475 /* Check for environment variables which could override some SDL settings */ |
476 didata->custom_refresh = 0; | |
477 override = SDL_getenv("SDL_VIDEO_PHOTON_REFRESH_RATE"); | |
478 if (override != NULL) { | |
479 if (SDL_sscanf(override, "%u", &didata->custom_refresh) != 1) { | |
480 didata->custom_refresh = 0; | |
481 } | |
482 } | |
483 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
484 |
3139 | 485 /* Add photon input devices */ |
486 status = photon_addinputdevices(_this); | |
487 if (status != 0) { | |
488 /* SDL error is set by photon_addinputdevices() function */ | |
489 return -1; | |
490 } | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
491 |
3139 | 492 /* Add photon renderer to SDL */ |
493 photon_addrenderdriver(_this); | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
494 |
3139 | 495 /* video has been initialized successfully */ |
496 return 1; | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
497 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
498 |
3139 | 499 void |
500 photon_videoquit(_THIS) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
501 { |
3139 | 502 SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; |
503 SDL_DisplayData *didata; | |
504 uint32_t it; | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
505 |
3139 | 506 /* SDL will restore our desktop mode on exit */ |
507 for (it = 0; it < _this->num_displays; it++) { | |
508 didata = _this->displays[it].driverdata; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
509 |
3139 | 510 if (didata->cursor != NULL) { |
511 SDL_free(didata->cursor); | |
512 } | |
513 #if defined(SDL_VIDEO_OPENGL_ES) | |
514 if (phdata->gfinitialized == SDL_TRUE) { | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
515 /* Detach GF display */ |
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
516 gf_display_detach(didata->display); |
3139 | 517 } |
518 #endif /* SDL_VIDEO_OPENGL_ES */ | |
519 } | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
520 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
521 |
3139 | 522 void |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3465
diff
changeset
|
523 photon_getdisplaymodes(_THIS, SDL_VideoDisplay * display) |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
524 { |
3139 | 525 SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3465
diff
changeset
|
526 SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata; |
3139 | 527 SDL_DisplayMode mode; |
528 PgVideoModes_t modes; | |
529 PgVideoModeInfo_t modeinfo; | |
530 int32_t status; | |
531 uint32_t it; | |
532 uint32_t jt; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
533 |
3139 | 534 /* Check if current device is not the same as target */ |
535 if (phdata->current_device_id != didata->device_id) { | |
536 /* Set target device as default for Pd and Pg functions */ | |
537 status = PdSetTargetDevice(NULL, phdata->rid[didata->device_id]); | |
538 if (status != 0) { | |
539 SDL_SetError("Photon: Can't set default target device\n"); | |
540 return; | |
541 } | |
542 phdata->current_device_id = didata->device_id; | |
543 } | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
544 |
3139 | 545 /* Get array of available video modes */ |
546 status = PgGetVideoModeList(&modes); | |
547 if (status != 0) { | |
548 SDL_SetError("Photon: Can't get video mode list"); | |
549 return; | |
550 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
551 |
3139 | 552 for (it = 0; it < modes.num_modes; it++) { |
553 status = PgGetVideoModeInfo(modes.modes[it], &modeinfo); | |
554 if (status != 0) { | |
555 /* Maybe something wrong with this particular mode, skip it */ | |
556 continue; | |
557 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
558 |
3139 | 559 jt = 0; |
560 do { | |
561 if (modeinfo.refresh_rates[jt] != 0) { | |
562 mode.w = modeinfo.width; | |
563 mode.h = modeinfo.height; | |
564 mode.refresh_rate = modeinfo.refresh_rates[jt]; | |
565 mode.format = photon_image_to_sdl_pixelformat(modeinfo.type); | |
566 mode.driverdata = NULL; | |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3465
diff
changeset
|
567 SDL_AddDisplayMode(display, &mode); |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
568 |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
569 /* If mode is RGBA8888, add the same mode as RGBx888 */ |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
570 if (modeinfo.type == Pg_IMAGE_DIRECT_8888) { |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
571 mode.w = modeinfo.width; |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
572 mode.h = modeinfo.height; |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
573 mode.refresh_rate = modeinfo.refresh_rates[jt]; |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
574 mode.format = SDL_PIXELFORMAT_RGB888; |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
575 mode.driverdata = NULL; |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3465
diff
changeset
|
576 SDL_AddDisplayMode(display, &mode); |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
577 } |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
578 |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
579 /* If mode is RGBA1555, add the same mode as RGBx555 */ |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
580 if (modeinfo.type == Pg_IMAGE_DIRECT_1555) { |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
581 mode.w = modeinfo.width; |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
582 mode.h = modeinfo.height; |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
583 mode.refresh_rate = modeinfo.refresh_rates[jt]; |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
584 mode.format = SDL_PIXELFORMAT_RGB555; |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
585 mode.driverdata = NULL; |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3465
diff
changeset
|
586 SDL_AddDisplayMode(display, &mode); |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
587 } |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
588 |
3139 | 589 jt++; |
590 } else { | |
591 break; | |
592 } | |
593 } while (1); | |
594 } | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
595 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
596 |
3139 | 597 int |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3465
diff
changeset
|
598 photon_setdisplaymode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode) |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
599 { |
3139 | 600 SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3465
diff
changeset
|
601 SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata; |
3139 | 602 PgVideoModes_t modes; |
603 PgVideoModeInfo_t modeinfo; | |
604 PgDisplaySettings_t modesettings; | |
605 uint32_t refresh_rate = 0; | |
606 int32_t status; | |
607 uint32_t it; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
608 |
3139 | 609 /* Check if current device is not the same as target */ |
610 if (phdata->current_device_id != didata->device_id) { | |
611 /* Set target device as default for Pd and Pg functions */ | |
612 status = PdSetTargetDevice(NULL, phdata->rid[didata->device_id]); | |
613 if (status != 0) { | |
614 SDL_SetError("Photon: Can't set default target device\n"); | |
3399
f96615051c8c
Working on fullscreen video modes support
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
615 return -1; |
3139 | 616 } |
617 phdata->current_device_id = didata->device_id; | |
618 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
619 |
3139 | 620 /* Get array of available video modes */ |
621 status = PgGetVideoModeList(&modes); | |
622 if (status != 0) { | |
623 SDL_SetError("Photon: Can't get video mode list"); | |
3399
f96615051c8c
Working on fullscreen video modes support
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
624 return -1; |
3139 | 625 } |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
626 |
3139 | 627 /* Current display dimension and bpp are no more valid */ |
628 didata->current_mode.format = SDL_PIXELFORMAT_UNKNOWN; | |
629 didata->current_mode.w = 0; | |
630 didata->current_mode.h = 0; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
631 |
3139 | 632 /* Check if custom refresh rate requested */ |
633 if (didata->custom_refresh != 0) { | |
634 refresh_rate = didata->custom_refresh; | |
635 } else { | |
636 refresh_rate = mode->refresh_rate; | |
637 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
638 |
3139 | 639 /* Check if SDL GF driver needs to find appropriate refresh rate itself */ |
640 if (refresh_rate == 0) { | |
641 SDL_DisplayMode tempmode; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
642 |
3139 | 643 /* Clear display mode structure */ |
644 SDL_memset(&tempmode, 0x00, sizeof(SDL_DisplayMode)); | |
645 tempmode.refresh_rate = 0x0000FFFF; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
646 |
3139 | 647 /* Check if window width and height matches one of our modes */ |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3465
diff
changeset
|
648 for (it = 0; it < display->num_display_modes; it++) { |
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3465
diff
changeset
|
649 if ((display->display_modes[it].w == mode->w) && |
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3465
diff
changeset
|
650 (display->display_modes[it].h == mode->h) && |
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3465
diff
changeset
|
651 (display->display_modes[it].format == mode->format)) |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
652 { |
3139 | 653 /* Find the lowest refresh rate available */ |
654 if (tempmode.refresh_rate > | |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3465
diff
changeset
|
655 display->display_modes[it].refresh_rate) { |
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3465
diff
changeset
|
656 tempmode = display->display_modes[it]; |
3139 | 657 } |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
658 } |
3139 | 659 } |
660 if (tempmode.refresh_rate != 0x0000FFFF) { | |
661 refresh_rate = tempmode.refresh_rate; | |
662 } else { | |
663 /* Let video driver decide what to do with this */ | |
664 refresh_rate = 0; | |
665 } | |
666 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
667 |
3139 | 668 /* Check if SDL GF driver needs to check custom refresh rate */ |
669 if (didata->custom_refresh != 0) { | |
670 SDL_DisplayMode tempmode; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
671 |
3139 | 672 /* Clear display mode structure */ |
673 SDL_memset(&tempmode, 0x00, sizeof(SDL_DisplayMode)); | |
674 tempmode.refresh_rate = 0x0000FFFF; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
675 |
3139 | 676 /* Check if window width and height matches one of our modes */ |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3465
diff
changeset
|
677 for (it = 0; it < display->num_display_modes; it++) { |
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3465
diff
changeset
|
678 if ((display->display_modes[it].w == mode->w) && |
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3465
diff
changeset
|
679 (display->display_modes[it].h == mode->h) && |
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3465
diff
changeset
|
680 (display->display_modes[it].format == mode->format)) |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
681 { |
3139 | 682 /* Find the lowest refresh rate available */ |
683 if (tempmode.refresh_rate > | |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3465
diff
changeset
|
684 display->display_modes[it].refresh_rate) { |
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3465
diff
changeset
|
685 tempmode = display->display_modes[it]; |
3139 | 686 } |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
687 |
3139 | 688 /* Check if requested refresh rate found */ |
689 if (refresh_rate == | |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3465
diff
changeset
|
690 display->display_modes[it].refresh_rate) { |
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3465
diff
changeset
|
691 tempmode = display->display_modes[it]; |
3139 | 692 break; |
693 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
694 } |
3139 | 695 } |
696 if (tempmode.refresh_rate != 0x0000FFFF) { | |
697 refresh_rate = tempmode.refresh_rate; | |
698 } else { | |
699 /* Let video driver decide what to do with this */ | |
700 refresh_rate = 0; | |
701 } | |
702 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
703 |
3139 | 704 /* Find photon's video mode number */ |
705 for (it = 0; it < modes.num_modes; it++) { | |
706 uint32_t jt; | |
707 uint32_t foundrefresh; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
708 |
3139 | 709 /* Get current video mode details */ |
710 status = PgGetVideoModeInfo(modes.modes[it], &modeinfo); | |
711 if (status != 0) { | |
712 /* Maybe something wrong with this particular mode, skip it */ | |
713 continue; | |
714 } | |
715 if ((modeinfo.width == mode->w) && (modeinfo.height == mode->h) && | |
716 (modeinfo.type == photon_sdl_to_image_pixelformat(mode->format))) | |
717 { | |
718 /* Mode is found, find requested refresh rate, this case is for */ | |
719 /* video drivers, which provide non-generic video modes. */ | |
720 jt = 0; | |
721 foundrefresh = 0; | |
722 do { | |
723 if (modeinfo.refresh_rates[jt] != 0) { | |
724 if (modeinfo.refresh_rates[jt] == refresh_rate) { | |
725 foundrefresh = 1; | |
726 break; | |
727 } | |
728 jt++; | |
729 } else { | |
730 break; | |
731 } | |
732 } while (1); | |
733 if (foundrefresh != 0) { | |
734 break; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
735 } |
3139 | 736 } |
737 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
738 |
3139 | 739 /* Check if video mode has not been found */ |
740 if (it == modes.num_modes) { | |
741 SDL_SetError("Photon: Can't find appropriate video mode"); | |
742 return -1; | |
743 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
744 |
3139 | 745 /* Fill mode settings */ |
746 modesettings.flags = 0x00000000; | |
747 modesettings.mode = modes.modes[it]; | |
748 modesettings.refresh = refresh_rate; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
749 |
3139 | 750 /* Finally set new video mode */ |
751 status = PgSetVideoMode(&modesettings); | |
752 if (status != 0) { | |
753 SDL_SetError("Photon: Can't set new video mode"); | |
754 return -1; | |
755 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
756 |
3139 | 757 /* Store new video mode parameters */ |
758 didata->current_mode = *mode; | |
759 didata->current_mode.refresh_rate = refresh_rate; | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
760 |
3399
f96615051c8c
Working on fullscreen video modes support
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
761 /* Get current video mode 2D capabilities for the renderer */ |
3384
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
762 didata->mode_2dcaps=0; |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
763 if ((modeinfo.mode_capabilities2 & PgVM_MODE_CAP2_ALPHA_BLEND)==PgVM_MODE_CAP2_ALPHA_BLEND) |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
764 { |
3386
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
765 didata->mode_2dcaps|=SDL_VIDEO_PHOTON_CAP_ALPHA_BLEND; |
3384
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
766 } |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
767 if ((modeinfo.mode_capabilities2 & PgVM_MODE_CAP2_SCALED_BLIT)==PgVM_MODE_CAP2_SCALED_BLIT) |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
768 { |
3386
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
769 didata->mode_2dcaps|=SDL_VIDEO_PHOTON_CAP_SCALED_BLIT; |
3384
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
770 } |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
771 |
3139 | 772 return 0; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
773 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
774 |
3139 | 775 int |
776 photon_createwindow(_THIS, SDL_Window * window) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
777 { |
3139 | 778 SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; |
779 SDL_DisplayData *didata = | |
3685
64ce267332c6
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents:
3500
diff
changeset
|
780 (SDL_DisplayData *) window->display->driverdata; |
3139 | 781 SDL_WindowData *wdata; |
782 PhDim_t winsize; | |
783 PhPoint_t winpos; | |
784 PtArg_t winargs[32]; | |
785 uint32_t winargc = 0; | |
786 int32_t status; | |
787 PhRegion_t wregion; | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
788 |
3139 | 789 /* Allocate window internal data */ |
790 wdata = (SDL_WindowData *) SDL_calloc(1, sizeof(SDL_WindowData)); | |
791 if (wdata == NULL) { | |
792 SDL_OutOfMemory(); | |
793 return -1; | |
794 } | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
795 |
3139 | 796 /* Setup driver data for this window */ |
797 window->driverdata = wdata; | |
798 | |
799 /* Set initial window title */ | |
800 if (window->title != NULL) { | |
801 PtSetArg(&winargs[winargc++], Pt_ARG_WINDOW_TITLE, window->title, 0); | |
802 } else { | |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
803 PtSetArg(&winargs[winargc++], Pt_ARG_WINDOW_TITLE, "SDL unnamed application", 0); |
3139 | 804 } |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
805 |
3139 | 806 /* TODO: handle SDL_WINDOW_INPUT_GRABBED */ |
807 | |
808 /* Disable default window filling on redraw */ | |
809 PtSetArg(&winargs[winargc++], Pt_ARG_BASIC_FLAGS, Pt_TRUE, | |
810 Pt_BASIC_PREVENT_FILL); | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
811 |
3139 | 812 /* Reset default managed flags to disabled state */ |
813 PtSetArg(&winargs[winargc++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_FALSE, | |
814 Ph_WM_APP_DEF_MANAGED); | |
815 /* Set which events we will not handle, let WM to handle them */ | |
816 PtSetArg(&winargs[winargc++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_TRUE, | |
817 Ph_WM_BACKDROP | Ph_WM_TOFRONT | Ph_WM_COLLAPSE | Ph_WM_FFRONT | | |
818 Ph_WM_FOCUS | Ph_WM_HELP | Ph_WM_HIDE | Ph_WM_MAX | | |
819 Ph_WM_MENU | Ph_WM_MOVE | Ph_WM_RESTORE | Ph_WM_TASKBAR | | |
820 Ph_WM_TOBACK | Ph_WM_RESIZE); | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
821 |
3139 | 822 /* Reset default notify events to disable */ |
823 PtSetArg(&winargs[winargc++], Pt_ARG_WINDOW_NOTIFY_FLAGS, Pt_FALSE, | |
824 Ph_WM_RESIZE | Ph_WM_CLOSE | Ph_WM_HELP); | |
825 /* Set which events we will handle */ | |
826 PtSetArg(&winargs[winargc++], Pt_ARG_WINDOW_NOTIFY_FLAGS, Pt_TRUE, | |
827 Ph_WM_CLOSE | Ph_WM_COLLAPSE | Ph_WM_FOCUS | Ph_WM_MAX | | |
828 Ph_WM_MOVE | Ph_WM_RESIZE | Ph_WM_RESTORE | Ph_WM_HIDE); | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
829 |
3139 | 830 /* Borderless window can't be resizeable */ |
831 if ((window->flags & SDL_WINDOW_BORDERLESS) == SDL_WINDOW_BORDERLESS) { | |
832 window->flags &= ~(SDL_WINDOW_RESIZABLE); | |
833 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
834 |
3139 | 835 /* Reset all default decorations */ |
836 PtSetArg(&winargs[winargc++], Pt_ARG_WINDOW_RENDER_FLAGS, Pt_FALSE, | |
837 Ph_WM_APP_DEF_RENDER); | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
838 |
3139 | 839 /* Fullscreen window has its own decorations */ |
840 if ((window->flags & SDL_WINDOW_FULLSCREEN) == SDL_WINDOW_FULLSCREEN) { | |
841 window->flags |= SDL_WINDOW_BORDERLESS; | |
842 window->flags &= ~(SDL_WINDOW_RESIZABLE); | |
843 PtSetArg(&winargs[winargc++], Pt_ARG_WINDOW_RENDER_FLAGS, Pt_TRUE, | |
844 Ph_WM_RENDER_CLOSE | Ph_WM_RENDER_TITLE); | |
845 } else { | |
846 uint32_t decorations = | |
847 Ph_WM_RENDER_CLOSE | Ph_WM_RENDER_MENU | Ph_WM_RENDER_MIN | | |
848 Ph_WM_RENDER_TITLE | Ph_WM_RENDER_MOVE; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
849 |
3139 | 850 if ((window->flags & SDL_WINDOW_RESIZABLE) == SDL_WINDOW_RESIZABLE) { |
851 decorations |= | |
852 Ph_WM_RENDER_BORDER | Ph_WM_RENDER_RESIZE | Ph_WM_RENDER_MAX; | |
853 PtSetArg(&winargs[winargc++], Pt_ARG_RESIZE_FLAGS, Pt_TRUE, | |
854 Pt_RESIZE_XY_AS_REQUIRED); | |
855 } | |
856 if ((window->flags & SDL_WINDOW_BORDERLESS) != SDL_WINDOW_BORDERLESS) { | |
857 decorations |= Ph_WM_RENDER_BORDER; | |
858 } | |
859 PtSetArg(&winargs[winargc++], Pt_ARG_WINDOW_RENDER_FLAGS, Pt_TRUE, | |
860 decorations); | |
861 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
862 |
3139 | 863 /* Set initial window state */ |
864 PtSetArg(&winargs[winargc++], Pt_ARG_WINDOW_STATE, Pt_FALSE, | |
865 Ph_WM_STATE_ISFOCUS); | |
866 PtSetArg(&winargs[winargc++], Pt_ARG_WINDOW_STATE, Pt_TRUE, | |
867 Ph_WM_STATE_ISALTKEY); | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
868 |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
869 /* Special case, do not handle maximize events, if window can't be resized */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
870 if ((window->flags & SDL_WINDOW_RESIZABLE) != SDL_WINDOW_RESIZABLE) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
871 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
872 PtSetArg(&winargs[winargc++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_FALSE, |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
873 Ph_WM_MAX | Ph_WM_RESTORE | Ph_WM_RESIZE); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
874 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
875 |
3139 | 876 /* Set window dimension */ |
877 winsize.w = window->w; | |
878 winsize.h = window->h; | |
879 PtSetArg(&winargs[winargc++], Pt_ARG_DIM, &winsize, 0); | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
880 |
3139 | 881 /* Check if upper level requests WM to position window */ |
882 if ((window->x == SDL_WINDOWPOS_UNDEFINED) | |
883 && (window->y == SDL_WINDOWPOS_UNDEFINED)) { | |
884 /* Do not set widget position, let WM to set it */ | |
885 } else { | |
886 if (window->x == SDL_WINDOWPOS_UNDEFINED) { | |
887 window->x = 0; | |
888 } | |
889 if (window->y == SDL_WINDOWPOS_UNDEFINED) { | |
890 window->y = 0; | |
891 } | |
892 if (window->x == SDL_WINDOWPOS_CENTERED) { | |
893 window->x = (didata->current_mode.w - window->w) / 2; | |
894 } | |
895 if (window->y == SDL_WINDOWPOS_CENTERED) { | |
896 window->y = (didata->current_mode.h - window->h) / 2; | |
897 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
898 |
3139 | 899 /* Now set window position */ |
900 winpos.x = window->x; | |
901 winpos.y = window->y; | |
902 PtSetArg(&winargs[winargc++], Pt_ARG_POS, &winpos, 0); | |
903 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
904 |
3139 | 905 /* Check if window must support OpenGL ES rendering */ |
906 if ((window->flags & SDL_WINDOW_OPENGL) == SDL_WINDOW_OPENGL) { | |
907 #if defined(SDL_VIDEO_OPENGL_ES) | |
908 EGLBoolean initstatus; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
909 |
3139 | 910 /* Check if GF was initialized correctly */ |
911 if (phdata->gfinitialized == SDL_FALSE) { | |
912 SDL_SetError | |
913 ("Photon: GF initialization failed, no OpenGL ES support"); | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
914 return -1; |
3139 | 915 } |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
916 |
3139 | 917 /* Mark this window as OpenGL ES compatible */ |
918 wdata->uses_gles = SDL_TRUE; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
919 |
3139 | 920 /* Create connection to OpenGL ES */ |
921 if (phdata->egldisplay == EGL_NO_DISPLAY) { | |
922 phdata->egldisplay = eglGetDisplay(phdata->gfdev); | |
923 if (phdata->egldisplay == EGL_NO_DISPLAY) { | |
924 SDL_SetError("Photon: Can't get connection to OpenGL ES"); | |
925 return -1; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
926 } |
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
927 |
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
928 /* Initialize OpenGL ES library, ignore EGL version */ |
3139 | 929 initstatus = eglInitialize(phdata->egldisplay, NULL, NULL); |
930 if (initstatus != EGL_TRUE) { | |
931 SDL_SetError("Photon: Can't init OpenGL ES library"); | |
932 return -1; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
933 } |
3139 | 934 } |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
935 |
3139 | 936 /* Increment GL ES reference count usage */ |
937 phdata->egl_refcount++; | |
938 #else | |
939 SDL_SetError("Photon: OpenGL ES support is not compiled in"); | |
940 return -1; | |
941 #endif /* SDL_VIDEO_OPENGL_ES */ | |
942 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
943 |
3139 | 944 /* Finally create the window */ |
945 wdata->window = PtCreateWidget(PtWindow, Pt_NO_PARENT, winargc, winargs); | |
946 if (wdata->window == NULL) { | |
947 SDL_SetError("Photon: Can't create window widget"); | |
948 SDL_free(wdata); | |
949 return -1; | |
950 } | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
951 |
3139 | 952 /* Show widget */ |
953 status = PtRealizeWidget(wdata->window); | |
954 if (status != 0) { | |
955 SDL_SetError("Photon: Can't realize window widget"); | |
956 PtDestroyWidget(wdata->window); | |
957 SDL_free(wdata); | |
958 return; | |
959 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
960 |
3139 | 961 /* Just created SDL window always gets focus */ |
962 window->flags |= SDL_WINDOW_INPUT_FOCUS; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
963 |
3139 | 964 /* Create window-specific cursor after creation */ |
965 if (didata->cursor_visible == SDL_TRUE) { | |
966 /* Setup cursor type. shape and default color */ | |
967 PtSetResource(wdata->window, Pt_ARG_CURSOR_COLOR, | |
968 Ph_CURSOR_DEFAULT_COLOR, 0); | |
969 PtSetResource(wdata->window, Pt_ARG_CURSOR_TYPE, Ph_CURSOR_BITMAP, 0); | |
970 PtSetResource(wdata->window, Pt_ARG_BITMAP_CURSOR, didata->cursor, | |
971 didata->cursor->hdr.len + sizeof(PhRegionDataHdr_t)); | |
972 } else { | |
973 PtSetResource(wdata->window, Pt_ARG_CURSOR_TYPE, Ph_CURSOR_NONE, 0); | |
974 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
975 |
3139 | 976 /* Set window region sensible to mouse motion events */ |
977 status = | |
978 PhRegionQuery(PtWidgetRid(wdata->window), &wregion, NULL, NULL, 0); | |
979 if (status != 0) { | |
980 SDL_SetError | |
981 ("Photon: Can't set region sensivity to mouse motion events"); | |
982 PtDestroyWidget(wdata->window); | |
983 SDL_free(wdata); | |
984 return -1; | |
985 } | |
986 wregion.events_sense |= | |
987 Ph_EV_PTR_MOTION_BUTTON | Ph_EV_PTR_MOTION_NOBUTTON; | |
988 status = PhRegionChange(Ph_REGION_EV_SENSE, 0, &wregion, NULL, NULL); | |
989 if (status < 0) { | |
990 SDL_SetError("Photon: Can't change region sensivity"); | |
991 PtDestroyWidget(wdata->window); | |
992 SDL_free(wdata); | |
993 return -1; | |
994 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
995 |
3139 | 996 /* Flush all widget operations again */ |
997 PtFlush(); | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
998 |
3139 | 999 /* By default last created window got a input focus */ |
3685
64ce267332c6
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents:
3500
diff
changeset
|
1000 SDL_SetKeyboardFocus(0, window); |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1001 |
3399
f96615051c8c
Working on fullscreen video modes support
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1002 /* Emit focus gained event, because photon is not sending it */ |
f96615051c8c
Working on fullscreen video modes support
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1003 SDL_OnWindowFocusGained(window); |
f96615051c8c
Working on fullscreen video modes support
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1004 |
3139 | 1005 /* Window has been successfully created */ |
1006 return 0; | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1007 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1008 |
3139 | 1009 int |
1010 photon_createwindowfrom(_THIS, SDL_Window * window, const void *data) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1011 { |
3139 | 1012 /* TODO: it is possible */ |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1013 |
3139 | 1014 /* Failed to create window from another window */ |
1015 return -1; | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1016 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1017 |
3139 | 1018 void |
1019 photon_setwindowtitle(_THIS, SDL_Window * window) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1020 { |
3139 | 1021 SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; |
1022 int32_t status; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1023 |
3139 | 1024 /* Set window title */ |
1025 if (window->title != NULL) { | |
1026 status = | |
1027 PtSetResource(wdata->window, Pt_ARG_WINDOW_TITLE, window->title, | |
1028 0); | |
1029 } else { | |
1030 status = PtSetResource(wdata->window, Pt_ARG_WINDOW_TITLE, "", 0); | |
1031 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1032 |
3139 | 1033 if (status != 0) { |
1034 SDL_SetError("Photon: Can't set window title"); | |
1035 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1036 |
3139 | 1037 /* Flush all widget operations */ |
1038 PtFlush(); | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1039 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1040 |
3139 | 1041 void |
1042 photon_setwindowicon(_THIS, SDL_Window * window, SDL_Surface * icon) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1043 { |
3139 | 1044 SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; |
1045 int32_t status; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1046 |
3139 | 1047 /* TODO: Use iconify ? */ |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1048 |
3139 | 1049 /* Flush all widget operations */ |
1050 PtFlush(); | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1051 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1052 |
3139 | 1053 void |
1054 photon_setwindowposition(_THIS, SDL_Window * window) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1055 { |
3139 | 1056 SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; |
1057 SDL_DisplayData *didata = | |
3685
64ce267332c6
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents:
3500
diff
changeset
|
1058 (SDL_DisplayData *) window->display->driverdata; |
3139 | 1059 PhPoint_t winpos; |
1060 int32_t status; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1061 |
3139 | 1062 /* Check if upper level requests WM to position window */ |
1063 if ((window->x == SDL_WINDOWPOS_UNDEFINED) | |
1064 && (window->y == SDL_WINDOWPOS_UNDEFINED)) { | |
1065 /* Do not set widget position, let WM to set it */ | |
1066 } else { | |
1067 if (window->x == SDL_WINDOWPOS_UNDEFINED) { | |
1068 window->x = 0; | |
1069 } | |
1070 if (window->y == SDL_WINDOWPOS_UNDEFINED) { | |
1071 window->y = 0; | |
1072 } | |
1073 if (window->x == SDL_WINDOWPOS_CENTERED) { | |
1074 window->x = (didata->current_mode.w - window->w) / 2; | |
1075 } | |
1076 if (window->y == SDL_WINDOWPOS_CENTERED) { | |
1077 window->y = (didata->current_mode.h - window->h) / 2; | |
1078 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1079 |
3139 | 1080 /* Now set window position */ |
1081 winpos.x = window->x; | |
1082 winpos.y = window->y; | |
1083 status = PtSetResource(wdata->window, Pt_ARG_POS, &winpos, 0); | |
1084 if (status != 0) { | |
1085 SDL_SetError("Photon: Can't set window position"); | |
1086 } | |
1087 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1088 |
3139 | 1089 /* Flush all widget operations */ |
1090 PtFlush(); | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1091 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1092 |
3139 | 1093 void |
1094 photon_setwindowsize(_THIS, SDL_Window * window) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1095 { |
3139 | 1096 SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; |
1097 PhDim_t winsize; | |
1098 int32_t status; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1099 |
3139 | 1100 winsize.w = window->w; |
1101 winsize.h = window->h; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1102 |
3139 | 1103 status = PtSetResource(wdata->window, Pt_ARG_DIM, &winsize, 0); |
1104 if (status != 0) { | |
1105 SDL_SetError("Photon: Can't set window size"); | |
1106 } | |
1107 | |
1108 /* Flush all widget operations */ | |
1109 PtFlush(); | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1110 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1111 |
3139 | 1112 void |
1113 photon_showwindow(_THIS, SDL_Window * window) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1114 { |
3139 | 1115 SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; |
1116 int32_t status; | |
1117 | |
1118 /* Bring focus to window and put it in front of others */ | |
1119 PtWindowToFront(wdata->window); | |
1120 | |
1121 /* Flush all widget operations */ | |
1122 PtFlush(); | |
1123 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1124 |
3139 | 1125 void |
1126 photon_hidewindow(_THIS, SDL_Window * window) | |
1127 { | |
1128 SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; | |
1129 PhWindowEvent_t winevent; | |
1130 int32_t status; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1131 |
3139 | 1132 SDL_memset(&winevent, 0x00, sizeof(PhWindowEvent_t)); |
1133 winevent.event_f = Ph_WM_HIDE; | |
1134 winevent.rid = PtWidgetRid(wdata->window); | |
1135 winevent.event_state = Ph_WM_EVSTATE_HIDE; | |
1136 | |
1137 status = PtForwardWindowEvent(&winevent); | |
1138 if (status != 0) { | |
1139 SDL_SetError("Photon: Can't hide window"); | |
1140 } | |
1141 | |
1142 /* Flush all widget operations */ | |
1143 PtFlush(); | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1144 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1145 |
3139 | 1146 void |
1147 photon_raisewindow(_THIS, SDL_Window * window) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1148 { |
3139 | 1149 SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; |
1150 PhWindowEvent_t winevent; | |
1151 int32_t status; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1152 |
3139 | 1153 SDL_memset(&winevent, 0x00, sizeof(PhWindowEvent_t)); |
1154 winevent.event_f = Ph_WM_HIDE; | |
1155 winevent.rid = PtWidgetRid(wdata->window); | |
1156 winevent.event_state = Ph_WM_EVSTATE_UNHIDE; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1157 |
3139 | 1158 status = PtForwardWindowEvent(&winevent); |
1159 if (status != 0) { | |
1160 SDL_SetError("Photon: Can't hide window"); | |
1161 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1162 |
3139 | 1163 /* Flush all widget operations */ |
1164 PtFlush(); | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1165 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1166 |
3139 | 1167 void |
1168 photon_maximizewindow(_THIS, SDL_Window * window) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1169 { |
3139 | 1170 SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; |
1171 PhWindowEvent_t winevent; | |
1172 int32_t status; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1173 |
3139 | 1174 /* Flush all widget operations */ |
1175 PtFlush(); | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1176 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1177 |
3139 | 1178 void |
1179 photon_minimizewindow(_THIS, SDL_Window * window) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1180 { |
3139 | 1181 SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; |
1182 PhWindowEvent_t winevent; | |
1183 int32_t status; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1184 |
3139 | 1185 SDL_memset(&winevent, 0x00, sizeof(PhWindowEvent_t)); |
1186 winevent.event_f = Ph_WM_HIDE; | |
1187 winevent.rid = PtWidgetRid(wdata->window); | |
1188 winevent.event_state = Ph_WM_EVSTATE_HIDE; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1189 |
3139 | 1190 status = PtForwardWindowEvent(&winevent); |
1191 if (status != 0) { | |
1192 SDL_SetError("Photon: Can't hide window"); | |
1193 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1194 |
3139 | 1195 /* Flush all widget operations */ |
1196 PtFlush(); | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1197 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1198 |
3139 | 1199 void |
1200 photon_restorewindow(_THIS, SDL_Window * window) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1201 { |
3139 | 1202 SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; |
1203 PhWindowEvent_t winevent; | |
1204 int32_t status; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1205 |
3139 | 1206 /* Flush all widget operations */ |
1207 PtFlush(); | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1208 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1209 |
3139 | 1210 void |
1211 photon_setwindowgrab(_THIS, SDL_Window * window) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1212 { |
3139 | 1213 SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; |
1214 PhWindowEvent_t winevent; | |
1215 int32_t status; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1216 |
3139 | 1217 /* Flush all widget operations */ |
1218 PtFlush(); | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1219 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1220 |
3139 | 1221 void |
1222 photon_destroywindow(_THIS, SDL_Window * window) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1223 { |
3139 | 1224 SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; |
1225 SDL_DisplayData *didata = | |
3685
64ce267332c6
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents:
3500
diff
changeset
|
1226 (SDL_DisplayData *) window->display->driverdata; |
3139 | 1227 SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; |
1228 int32_t status; | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1229 |
3139 | 1230 if (wdata != NULL) { |
1231 status = PtDestroyWidget(wdata->window); | |
1232 if (status != 0) { | |
1233 SDL_SetError("Photon: Can't destroy window widget"); | |
1234 } | |
1235 wdata->window = NULL; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1236 |
3139 | 1237 #if defined(SDL_VIDEO_OPENGL_ES) |
1238 if (phdata->gfinitialized == SDL_TRUE) { | |
3193
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1239 /* Destroy photon handle to GF surface */ |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1240 if (wdata->phsurface != NULL) { |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1241 PhDCRelease(wdata->phsurface); |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1242 wdata->phsurface=NULL; |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1243 } |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1244 |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1245 /* Destroy OpenGL ES surface if it was created */ |
3139 | 1246 if (wdata->gles_surface != EGL_NO_SURFACE) { |
1247 eglDestroySurface(phdata->egldisplay, wdata->gles_surface); | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1248 } |
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1249 |
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1250 /* Free OpenGL ES target surface */ |
3139 | 1251 if (wdata->gfsurface != NULL) { |
1252 gf_surface_free(wdata->gfsurface); | |
3399
f96615051c8c
Working on fullscreen video modes support
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1253 wdata->gfsurface=NULL; |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1254 } |
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1255 |
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1256 phdata->egl_refcount--; |
3139 | 1257 if (phdata->egl_refcount == 0) { |
1258 /* Terminate connection to OpenGL ES */ | |
1259 if (phdata->egldisplay != EGL_NO_DISPLAY) { | |
1260 eglTerminate(phdata->egldisplay); | |
1261 phdata->egldisplay = EGL_NO_DISPLAY; | |
1262 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1263 } |
3139 | 1264 } |
1265 #endif /* SDL_VIDEO_OPENGL_ES */ | |
1266 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1267 |
3139 | 1268 /* Flush all widget operations */ |
1269 PtFlush(); | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1270 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1271 |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1272 /*****************************************************************************/ |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1273 /* SDL Window Manager function */ |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1274 /*****************************************************************************/ |
3139 | 1275 SDL_bool |
1276 photon_getwindowwminfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1277 { |
3139 | 1278 if (info->version.major <= SDL_MAJOR_VERSION) { |
1279 return SDL_TRUE; | |
1280 } else { | |
1281 SDL_SetError("application not compiled with SDL %d.%d\n", | |
1282 SDL_MAJOR_VERSION, SDL_MINOR_VERSION); | |
1283 return SDL_FALSE; | |
1284 } | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1285 |
3139 | 1286 /* Failed to get window manager information */ |
1287 return SDL_FALSE; | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1288 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1289 |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1290 /*****************************************************************************/ |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1291 /* SDL OpenGL/OpenGL ES functions */ |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1292 /*****************************************************************************/ |
3139 | 1293 int |
1294 photon_gl_loadlibrary(_THIS, const char *path) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1295 { |
3139 | 1296 #if defined(SDL_VIDEO_OPENGL_ES) |
1297 SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1298 |
3139 | 1299 if (phdata->gfinitialized != SDL_TRUE) { |
1300 SDL_SetError | |
1301 ("Photon: GF initialization failed, no OpenGL ES support"); | |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
1302 return -1; |
3139 | 1303 } |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1304 |
3139 | 1305 /* Check if OpenGL ES library is specified for GF driver */ |
1306 if (path == NULL) { | |
1307 path = SDL_getenv("SDL_OPENGL_LIBRARY"); | |
1308 if (path == NULL) { | |
1309 path = SDL_getenv("SDL_OPENGLES_LIBRARY"); | |
1310 } | |
1311 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1312 |
3139 | 1313 /* Check if default library loading requested */ |
1314 if (path == NULL) { | |
1315 /* Already linked with GF library which provides egl* subset of */ | |
1316 /* functions, use Common profile of OpenGL ES library by default */ | |
1317 path = "/usr/lib/libGLES_CM.so.1"; | |
1318 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1319 |
3139 | 1320 /* Load dynamic library */ |
1321 _this->gl_config.dll_handle = SDL_LoadObject(path); | |
1322 if (!_this->gl_config.dll_handle) { | |
1323 /* Failed to load new GL ES library */ | |
1324 SDL_SetError("Photon: Failed to locate OpenGL ES library"); | |
1325 return -1; | |
1326 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1327 |
3139 | 1328 /* Store OpenGL ES library path and name */ |
1329 SDL_strlcpy(_this->gl_config.driver_path, path, | |
1330 SDL_arraysize(_this->gl_config.driver_path)); | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1331 |
3139 | 1332 /* New OpenGL ES library is loaded */ |
1333 return 0; | |
1334 #else | |
1335 SDL_SetError("Photon: OpenGL ES support is not compiled in"); | |
1336 return -1; | |
1337 #endif /* SDL_VIDEO_OPENGL_ES */ | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1338 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1339 |
3139 | 1340 void * |
1341 photon_gl_getprocaddres(_THIS, const char *proc) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1342 { |
3139 | 1343 #if defined(SDL_VIDEO_OPENGL_ES) |
1344 SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; | |
1345 void *function_address; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1346 |
3139 | 1347 if (phdata->gfinitialized != SDL_TRUE) { |
1348 SDL_SetError | |
1349 ("Photon: GF initialization failed, no OpenGL ES support"); | |
1350 return NULL; | |
1351 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1352 |
3139 | 1353 /* Try to get function address through the egl interface */ |
1354 function_address = eglGetProcAddress(proc); | |
1355 if (function_address != NULL) { | |
1356 return function_address; | |
1357 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1358 |
3139 | 1359 /* Then try to get function in the OpenGL ES library */ |
1360 if (_this->gl_config.dll_handle) { | |
1361 function_address = | |
1362 SDL_LoadFunction(_this->gl_config.dll_handle, proc); | |
1363 if (function_address != NULL) { | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1364 return function_address; |
3139 | 1365 } |
1366 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1367 |
3139 | 1368 /* Add emulated OpenGL ES 1.1 functions */ |
1369 if (SDL_strcmp(proc, "glTexParameteri") == 0) { | |
1370 return glTexParameteri; | |
1371 } | |
1372 if (SDL_strcmp(proc, "glTexParameteriv") == 0) { | |
1373 return glTexParameteriv; | |
1374 } | |
1375 if (SDL_strcmp(proc, "glColor4ub") == 0) { | |
1376 return glColor4ub; | |
1377 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1378 |
3139 | 1379 /* Failed to get GL ES function address pointer */ |
1380 SDL_SetError("Photon: Cannot locate OpenGL ES function name"); | |
1381 return NULL; | |
1382 #else | |
1383 SDL_SetError("Photon: OpenGL ES support is not compiled in"); | |
1384 return NULL; | |
1385 #endif /* SDL_VIDEO_OPENGL_ES */ | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1386 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1387 |
3139 | 1388 void |
1389 photon_gl_unloadlibrary(_THIS) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1390 { |
3139 | 1391 #if defined(SDL_VIDEO_OPENGL_ES) |
1392 SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1393 |
3139 | 1394 if (phdata->gfinitialized == SDL_TRUE) { |
1395 /* Unload OpenGL ES library */ | |
1396 if (_this->gl_config.dll_handle) { | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1397 SDL_UnloadObject(_this->gl_config.dll_handle); |
3139 | 1398 _this->gl_config.dll_handle = NULL; |
1399 } | |
1400 } else { | |
1401 SDL_SetError | |
1402 ("Photon: GF initialization failed, no OpenGL ES support"); | |
1403 } | |
1404 #else | |
1405 SDL_SetError("Photon: OpenGL ES support is not compiled in"); | |
1406 return; | |
1407 #endif /* SDL_VIDEO_OPENGL_ES */ | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1408 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1409 |
3139 | 1410 SDL_GLContext |
1411 photon_gl_createcontext(_THIS, SDL_Window * window) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1412 { |
3139 | 1413 #if defined(SDL_VIDEO_OPENGL_ES) |
1414 SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; | |
1415 SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; | |
1416 SDL_DisplayData *didata = | |
3685
64ce267332c6
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents:
3500
diff
changeset
|
1417 (SDL_DisplayData *) window->display->driverdata; |
3139 | 1418 EGLBoolean status; |
1419 int32_t gfstatus; | |
1420 EGLint configs; | |
1421 uint32_t attr_pos; | |
1422 EGLint attr_value; | |
1423 EGLint cit; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1424 |
3139 | 1425 /* Check if GF was initialized */ |
1426 if (phdata->gfinitialized != SDL_TRUE) { | |
1427 SDL_SetError | |
1428 ("Photon: GF initialization failed, no OpenGL ES support"); | |
1429 return NULL; | |
1430 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1431 |
3411
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
1432 /* Prepare attributes list to pass them to OpenGL ES egl interface */ |
3139 | 1433 attr_pos = 0; |
1434 wdata->gles_attributes[attr_pos++] = EGL_NATIVE_VISUAL_ID; | |
1435 wdata->gles_attributes[attr_pos++] = | |
1436 qnxgf_sdl_to_gf_pixelformat(didata->current_mode.format); | |
1437 wdata->gles_attributes[attr_pos++] = EGL_RED_SIZE; | |
1438 wdata->gles_attributes[attr_pos++] = _this->gl_config.red_size; | |
1439 wdata->gles_attributes[attr_pos++] = EGL_GREEN_SIZE; | |
1440 wdata->gles_attributes[attr_pos++] = _this->gl_config.green_size; | |
1441 wdata->gles_attributes[attr_pos++] = EGL_BLUE_SIZE; | |
1442 wdata->gles_attributes[attr_pos++] = _this->gl_config.blue_size; | |
1443 wdata->gles_attributes[attr_pos++] = EGL_ALPHA_SIZE; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1444 |
3139 | 1445 /* Setup alpha size in bits */ |
1446 if (_this->gl_config.alpha_size) { | |
1447 wdata->gles_attributes[attr_pos++] = _this->gl_config.alpha_size; | |
1448 } else { | |
1449 wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE; | |
1450 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1451 |
3139 | 1452 /* Setup color buffer size */ |
1453 if (_this->gl_config.buffer_size) { | |
1454 wdata->gles_attributes[attr_pos++] = EGL_BUFFER_SIZE; | |
1455 wdata->gles_attributes[attr_pos++] = _this->gl_config.buffer_size; | |
1456 } else { | |
1457 wdata->gles_attributes[attr_pos++] = EGL_BUFFER_SIZE; | |
1458 wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE; | |
1459 } | |
1460 | |
1461 /* Setup depth buffer bits */ | |
1462 wdata->gles_attributes[attr_pos++] = EGL_DEPTH_SIZE; | |
3411
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
1463 if (_this->gl_config.depth_size) |
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
1464 { |
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
1465 wdata->gles_attributes[attr_pos++] = _this->gl_config.depth_size; |
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
1466 } |
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
1467 else |
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
1468 { |
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
1469 wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE; |
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
1470 } |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1471 |
3139 | 1472 /* Setup stencil bits */ |
1473 if (_this->gl_config.stencil_size) { | |
1474 wdata->gles_attributes[attr_pos++] = EGL_STENCIL_SIZE; | |
3411
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
1475 wdata->gles_attributes[attr_pos++] = _this->gl_config.stencil_size; |
3139 | 1476 } else { |
1477 wdata->gles_attributes[attr_pos++] = EGL_STENCIL_SIZE; | |
1478 wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE; | |
1479 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1480 |
3139 | 1481 /* Set number of samples in multisampling */ |
1482 if (_this->gl_config.multisamplesamples) { | |
1483 wdata->gles_attributes[attr_pos++] = EGL_SAMPLES; | |
1484 wdata->gles_attributes[attr_pos++] = | |
1485 _this->gl_config.multisamplesamples; | |
1486 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1487 |
3139 | 1488 /* Multisample buffers, OpenGL ES 1.0 spec defines 0 or 1 buffer */ |
1489 if (_this->gl_config.multisamplebuffers) { | |
1490 wdata->gles_attributes[attr_pos++] = EGL_SAMPLE_BUFFERS; | |
1491 wdata->gles_attributes[attr_pos++] = | |
1492 _this->gl_config.multisamplebuffers; | |
1493 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1494 |
3139 | 1495 /* Finish attributes list */ |
1496 wdata->gles_attributes[attr_pos] = EGL_NONE; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1497 |
3139 | 1498 /* Request first suitable framebuffer configuration */ |
1499 status = eglChooseConfig(phdata->egldisplay, wdata->gles_attributes, | |
1500 wdata->gles_configs, SDL_VIDEO_GF_OPENGLES_CONFS, | |
1501 &configs); | |
1502 if (status != EGL_TRUE) { | |
1503 SDL_SetError | |
1504 ("Photon: Can't find closest configuration for OpenGL ES"); | |
1505 return NULL; | |
1506 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1507 |
3139 | 1508 /* Check if nothing has been found, try "don't care" settings */ |
1509 if (configs == 0) { | |
1510 int32_t it; | |
1511 int32_t jt; | |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1512 static const GLint depthbits[4] = { 32, 24, 16, EGL_DONT_CARE }; |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1513 |
3139 | 1514 for (it = 0; it < 4; it++) { |
1515 for (jt = 16; jt >= 0; jt--) { | |
1516 /* Don't care about color buffer bits, use what exist */ | |
1517 /* Replace previous set data with EGL_DONT_CARE */ | |
1518 attr_pos = 0; | |
1519 wdata->gles_attributes[attr_pos++] = EGL_NATIVE_VISUAL_ID; | |
1520 wdata->gles_attributes[attr_pos++] = | |
1521 qnxgf_sdl_to_gf_pixelformat(didata->current_mode.format); | |
1522 wdata->gles_attributes[attr_pos++] = EGL_RED_SIZE; | |
1523 wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE; | |
1524 wdata->gles_attributes[attr_pos++] = EGL_GREEN_SIZE; | |
1525 wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE; | |
1526 wdata->gles_attributes[attr_pos++] = EGL_BLUE_SIZE; | |
1527 wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE; | |
1528 wdata->gles_attributes[attr_pos++] = EGL_ALPHA_SIZE; | |
1529 wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE; | |
1530 wdata->gles_attributes[attr_pos++] = EGL_BUFFER_SIZE; | |
1531 wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1532 |
3139 | 1533 /* Try to find requested or smallest depth */ |
1534 if (_this->gl_config.depth_size) { | |
1535 wdata->gles_attributes[attr_pos++] = EGL_DEPTH_SIZE; | |
1536 wdata->gles_attributes[attr_pos++] = depthbits[it]; | |
1537 } else { | |
1538 wdata->gles_attributes[attr_pos++] = EGL_DEPTH_SIZE; | |
1539 wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE; | |
1540 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1541 |
3139 | 1542 if (_this->gl_config.stencil_size) { |
1543 wdata->gles_attributes[attr_pos++] = EGL_STENCIL_SIZE; | |
1544 wdata->gles_attributes[attr_pos++] = jt; | |
1545 } else { | |
1546 wdata->gles_attributes[attr_pos++] = EGL_STENCIL_SIZE; | |
1547 wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE; | |
1548 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1549 |
3139 | 1550 wdata->gles_attributes[attr_pos++] = EGL_SAMPLES; |
1551 wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE; | |
1552 wdata->gles_attributes[attr_pos++] = EGL_SAMPLE_BUFFERS; | |
1553 wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE; | |
1554 wdata->gles_attributes[attr_pos] = EGL_NONE; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1555 |
3139 | 1556 /* Request first suitable framebuffer configuration */ |
1557 status = | |
1558 eglChooseConfig(phdata->egldisplay, | |
1559 wdata->gles_attributes, | |
1560 wdata->gles_configs, | |
1561 SDL_VIDEO_GF_OPENGLES_CONFS, &configs); | |
1562 if (status != EGL_TRUE) { | |
1563 SDL_SetError | |
1564 ("Photon: Can't find closest configuration for OpenGL ES"); | |
1565 return NULL; | |
1566 } | |
1567 if (configs != 0) { | |
1568 break; | |
1569 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1570 } |
3139 | 1571 if (configs != 0) { |
1572 break; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1573 } |
3139 | 1574 } |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1575 |
3139 | 1576 /* No available configs */ |
1577 if (configs == 0) { | |
1578 SDL_SetError | |
1579 ("Photon: Can't find any configuration for OpenGL ES"); | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1580 return NULL; |
3139 | 1581 } |
1582 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1583 |
3139 | 1584 /* Initialize config index */ |
1585 wdata->gles_config = 0; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1586 |
3139 | 1587 /* Now check each configuration to find out the best */ |
1588 for (cit = 0; cit < configs; cit++) { | |
1589 uint32_t stencil_found; | |
1590 uint32_t depth_found; | |
3411
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
1591 EGLint cur_depth; |
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
1592 EGLint cur_stencil; |
3139 | 1593 |
1594 stencil_found = 0; | |
1595 depth_found = 0; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1596 |
3139 | 1597 if (_this->gl_config.stencil_size) { |
1598 status = | |
1599 eglGetConfigAttrib(phdata->egldisplay, | |
1600 wdata->gles_configs[cit], EGL_STENCIL_SIZE, | |
3411
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
1601 &cur_stencil); |
3139 | 1602 if (status == EGL_TRUE) { |
3411
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
1603 if (cur_stencil != 0) { |
3139 | 1604 stencil_found = 1; |
1605 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1606 } |
3139 | 1607 } else { |
1608 stencil_found = 1; | |
1609 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1610 |
3139 | 1611 if (_this->gl_config.depth_size) { |
1612 status = | |
1613 eglGetConfigAttrib(phdata->egldisplay, | |
1614 wdata->gles_configs[cit], EGL_DEPTH_SIZE, | |
3411
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
1615 &cur_depth); |
3139 | 1616 if (status == EGL_TRUE) { |
3411
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
1617 if (cur_depth != 0) { |
3139 | 1618 depth_found = 1; |
1619 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1620 } |
3139 | 1621 } else { |
1622 depth_found = 1; | |
1623 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1624 |
3139 | 1625 /* Exit from loop if found appropriate configuration */ |
1626 if ((depth_found != 0) && (stencil_found != 0)) { | |
3411
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
1627 /* Store last satisfied configuration id */ |
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
1628 wdata->gles_config = cit; |
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
1629 |
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
1630 if (cur_depth==_this->gl_config.depth_size) |
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
1631 { |
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
1632 /* Exact match on depth bits */ |
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
1633 if (!_this->gl_config.stencil_size) |
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
1634 { |
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
1635 /* Stencil is not required */ |
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
1636 break; |
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
1637 } |
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
1638 else |
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
1639 { |
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
1640 if (cur_stencil==_this->gl_config.stencil_size) |
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
1641 { |
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
1642 /* Exact match on stencil bits */ |
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
1643 break; |
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
1644 } |
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
1645 } |
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
1646 } |
3139 | 1647 } |
1648 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1649 |
3411
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
1650 /* If best could not be found, use first or last satisfied */ |
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
1651 if ((cit == configs) && (wdata->gles_config==0)) { |
3139 | 1652 cit = 0; |
3411
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
1653 wdata->gles_config = cit; |
3139 | 1654 } |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1655 |
3139 | 1656 /* Create OpenGL ES context */ |
1657 wdata->gles_context = | |
1658 eglCreateContext(phdata->egldisplay, | |
1659 wdata->gles_configs[wdata->gles_config], | |
1660 EGL_NO_CONTEXT, NULL); | |
1661 if (wdata->gles_context == EGL_NO_CONTEXT) { | |
1662 SDL_SetError("Photon: OpenGL ES context creation has been failed"); | |
1663 return NULL; | |
1664 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1665 |
3139 | 1666 /* Check if surface is exist */ |
1667 if (wdata->gfsurface != NULL) { | |
1668 gf_surface_free(wdata->gfsurface); | |
1669 wdata->gfsurface = NULL; | |
1670 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1671 |
3139 | 1672 /* Create GF surface */ |
1673 gfstatus = | |
1674 gf_surface_create(&wdata->gfsurface, phdata->gfdev, window->w, | |
1675 window->h, | |
1676 qnxgf_sdl_to_gf_pixelformat(didata->current_mode. | |
1677 format), NULL, | |
1678 GF_SURFACE_CREATE_2D_ACCESSIBLE | | |
1679 GF_SURFACE_CREATE_3D_ACCESSIBLE | | |
1680 GF_SURFACE_CREATE_SHAREABLE); | |
1681 if (gfstatus != GF_ERR_OK) { | |
1682 eglDestroyContext(phdata->egldisplay, wdata->gles_context); | |
1683 wdata->gles_context = EGL_NO_CONTEXT; | |
1684 SDL_SetError("Photon: Can't create GF 3D surface (%08X)", gfstatus); | |
1685 return NULL; | |
1686 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1687 |
3139 | 1688 /* Create pixmap 3D target surface */ |
1689 wdata->gles_surface = | |
1690 eglCreatePixmapSurface(phdata->egldisplay, | |
1691 wdata->gles_configs[wdata->gles_config], | |
1692 wdata->gfsurface, NULL); | |
1693 if (wdata->gles_surface == EGL_NO_SURFACE) { | |
1694 gf_surface_free(wdata->gfsurface); | |
3399
f96615051c8c
Working on fullscreen video modes support
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1695 wdata->gfsurface=NULL; |
3139 | 1696 eglDestroyContext(phdata->egldisplay, wdata->gles_context); |
1697 wdata->gles_context = EGL_NO_CONTEXT; | |
1698 SDL_SetError("Photon: Can't create EGL pixmap surface"); | |
1699 return NULL; | |
1700 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1701 |
3193
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1702 /* Store last used context and surface */ |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1703 phdata->lgles_surface=wdata->gles_surface; |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1704 phdata->lgles_context=wdata->gles_context; |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1705 |
3139 | 1706 /* Make just created context current */ |
1707 status = | |
1708 eglMakeCurrent(phdata->egldisplay, wdata->gles_surface, | |
1709 wdata->gles_surface, wdata->gles_context); | |
1710 if (status != EGL_TRUE) { | |
3193
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1711 /* Reset last used context and surface */ |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1712 phdata->lgles_surface=EGL_NO_SURFACE; |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1713 phdata->lgles_context=EGL_NO_CONTEXT; |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1714 |
3139 | 1715 /* Destroy OpenGL ES surface */ |
1716 eglDestroySurface(phdata->egldisplay, wdata->gles_surface); | |
3193
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1717 wdata->gles_surface=EGL_NO_SURFACE; |
3139 | 1718 gf_surface_free(wdata->gfsurface); |
3399
f96615051c8c
Working on fullscreen video modes support
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1719 wdata->gfsurface=NULL; |
3139 | 1720 eglDestroyContext(phdata->egldisplay, wdata->gles_context); |
1721 wdata->gles_context = EGL_NO_CONTEXT; | |
1722 SDL_SetError("Photon: Can't set OpenGL ES context on creation"); | |
1723 return NULL; | |
1724 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1725 |
3139 | 1726 /* Setup into SDL internals state of OpenGL ES: */ |
1727 /* it is accelerated or not */ | |
1728 if ((didata->caps & SDL_PHOTON_ACCELERATED_3D) == | |
1729 SDL_PHOTON_ACCELERATED_3D) { | |
1730 _this->gl_config.accelerated = 1; | |
1731 } else { | |
1732 _this->gl_config.accelerated = 0; | |
1733 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1734 |
3139 | 1735 /* Always clear stereo enable, since OpenGL ES do not supports stereo */ |
1736 _this->gl_config.stereo = 0; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1737 |
3139 | 1738 /* Get back samples and samplebuffers configurations. Rest framebuffer */ |
1739 /* parameters could be obtained through the OpenGL ES API */ | |
1740 status = | |
1741 eglGetConfigAttrib(phdata->egldisplay, | |
1742 wdata->gles_configs[wdata->gles_config], | |
1743 EGL_SAMPLES, &attr_value); | |
1744 if (status == EGL_TRUE) { | |
1745 _this->gl_config.multisamplesamples = attr_value; | |
1746 } | |
1747 status = | |
1748 eglGetConfigAttrib(phdata->egldisplay, | |
1749 wdata->gles_configs[wdata->gles_config], | |
1750 EGL_SAMPLE_BUFFERS, &attr_value); | |
1751 if (status == EGL_TRUE) { | |
1752 _this->gl_config.multisamplebuffers = attr_value; | |
1753 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1754 |
3139 | 1755 /* Get back stencil and depth buffer sizes */ |
1756 status = | |
1757 eglGetConfigAttrib(phdata->egldisplay, | |
1758 wdata->gles_configs[wdata->gles_config], | |
1759 EGL_DEPTH_SIZE, &attr_value); | |
1760 if (status == EGL_TRUE) { | |
1761 _this->gl_config.depth_size = attr_value; | |
1762 } | |
1763 status = | |
1764 eglGetConfigAttrib(phdata->egldisplay, | |
1765 wdata->gles_configs[wdata->gles_config], | |
1766 EGL_STENCIL_SIZE, &attr_value); | |
1767 if (status == EGL_TRUE) { | |
1768 _this->gl_config.stencil_size = attr_value; | |
1769 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1770 |
3139 | 1771 /* Under Photon OpenGL ES output can't be double buffered */ |
1772 _this->gl_config.double_buffer = 0; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1773 |
3139 | 1774 /* Check if current device is not the same as target */ |
1775 if (phdata->current_device_id != didata->device_id) { | |
1776 /* Set target device as default for Pd and Pg functions */ | |
1777 status = PdSetTargetDevice(NULL, phdata->rid[didata->device_id]); | |
1778 if (status != 0) { | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1779 /* Destroy OpenGL ES surface */ |
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1780 eglDestroySurface(phdata->egldisplay, wdata->gles_surface); |
3193
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1781 wdata->gles_surface=EGL_NO_SURFACE; |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1782 gf_surface_free(wdata->gfsurface); |
3399
f96615051c8c
Working on fullscreen video modes support
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1783 wdata->gfsurface=NULL; |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1784 eglDestroyContext(phdata->egldisplay, wdata->gles_context); |
3139 | 1785 wdata->gles_context = EGL_NO_CONTEXT; |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1786 SDL_SetError("Photon: Can't set default target device\n"); |
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1787 return NULL; |
3139 | 1788 } |
1789 phdata->current_device_id = didata->device_id; | |
1790 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1791 |
3139 | 1792 wdata->phsurface = PdCreateOffscreenContextGF(wdata->gfsurface); |
1793 if (wdata->phsurface == NULL) { | |
1794 /* Destroy OpenGL ES surface */ | |
1795 eglDestroySurface(phdata->egldisplay, wdata->gles_surface); | |
3193
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1796 wdata->gles_surface=EGL_NO_SURFACE; |
3139 | 1797 gf_surface_free(wdata->gfsurface); |
3399
f96615051c8c
Working on fullscreen video modes support
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1798 wdata->gfsurface=NULL; |
3139 | 1799 eglDestroyContext(phdata->egldisplay, wdata->gles_context); |
1800 wdata->gles_context = EGL_NO_CONTEXT; | |
1801 SDL_SetError("Photon: Can't bind GF surface to Photon\n"); | |
1802 return NULL; | |
1803 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1804 |
3139 | 1805 /* GL ES context was successfully created */ |
1806 return wdata->gles_context; | |
1807 #else | |
1808 SDL_SetError("Photon: OpenGL ES support is not compiled in"); | |
1809 return NULL; | |
1810 #endif /* SDL_VIDEO_OPENGL_ES */ | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1811 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1812 |
3139 | 1813 int |
1814 photon_gl_makecurrent(_THIS, SDL_Window * window, SDL_GLContext context) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1815 { |
3139 | 1816 #if defined(SDL_VIDEO_OPENGL_ES) |
1817 SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; | |
1818 SDL_WindowData *wdata; | |
1819 EGLBoolean status; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1820 |
3139 | 1821 if (phdata->gfinitialized != SDL_TRUE) { |
1822 SDL_SetError | |
1823 ("Photon: GF initialization failed, no OpenGL ES support"); | |
1824 return -1; | |
1825 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1826 |
3139 | 1827 if ((window == NULL) && (context == NULL)) { |
3193
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1828 /* Reset last used context and surface */ |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1829 phdata->lgles_surface=EGL_NO_SURFACE; |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1830 phdata->lgles_context=EGL_NO_CONTEXT; |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1831 |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1832 /* Unset current context */ |
3139 | 1833 status = |
1834 eglMakeCurrent(phdata->egldisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, | |
1835 EGL_NO_CONTEXT); | |
1836 if (status != EGL_TRUE) { | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1837 /* Failed to set current GL ES context */ |
3193
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1838 SDL_SetError("Photon: Can't empty current OpenGL ES context"); |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1839 return -1; |
3139 | 1840 } |
1841 } else { | |
1842 wdata = (SDL_WindowData *) window->driverdata; | |
1843 if (wdata->gles_surface == EGL_NO_SURFACE) { | |
1844 SDL_SetError | |
1845 ("Photon: OpenGL ES surface is not initialized for this window"); | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1846 return -1; |
3139 | 1847 } |
1848 if (wdata->gles_context == EGL_NO_CONTEXT) { | |
1849 SDL_SetError | |
1850 ("Photon: OpenGL ES context is not initialized for this window"); | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1851 return -1; |
3139 | 1852 } |
1853 if (wdata->gles_context != context) { | |
1854 SDL_SetError | |
1855 ("Photon: OpenGL ES context is not belong to this window"); | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1856 return -1; |
3139 | 1857 } |
3193
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1858 |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1859 /* Store last set surface and context */ |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1860 phdata->lgles_surface=wdata->gles_surface; |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1861 phdata->lgles_context=wdata->gles_context; |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1862 |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1863 /* Set new current context */ |
3139 | 1864 status = |
1865 eglMakeCurrent(phdata->egldisplay, wdata->gles_surface, | |
1866 wdata->gles_surface, wdata->gles_context); | |
1867 if (status != EGL_TRUE) { | |
3193
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1868 /* Reset last used context and surface */ |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1869 phdata->lgles_surface=EGL_NO_SURFACE; |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1870 phdata->lgles_context=EGL_NO_CONTEXT; |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1871 /* Failed to set current GL ES context */ |
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1872 SDL_SetError("Photon: Can't set OpenGL ES context"); |
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1873 return -1; |
3139 | 1874 } |
1875 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1876 |
3139 | 1877 return 0; |
1878 #else | |
1879 SDL_SetError("Photon: OpenGL ES support is not compiled in"); | |
1880 return -1; | |
1881 #endif /* SDL_VIDEO_OPENGL_ES */ | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1882 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1883 |
3139 | 1884 int |
1885 photon_gl_setswapinterval(_THIS, int interval) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1886 { |
3139 | 1887 #if defined(SDL_VIDEO_OPENGL_ES) |
1888 SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; | |
1889 EGLBoolean status; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1890 |
3139 | 1891 if (phdata->gfinitialized != SDL_TRUE) { |
1892 SDL_SetError | |
1893 ("Photon: GF initialization failed, no OpenGL ES support"); | |
1894 return -1; | |
1895 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1896 |
3139 | 1897 /* Check if OpenGL ES connection has been initialized */ |
1898 if (phdata->egldisplay != EGL_NO_DISPLAY) { | |
1899 /* Set swap OpenGL ES interval */ | |
1900 status = eglSwapInterval(phdata->egldisplay, interval); | |
1901 if (status == EGL_TRUE) { | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1902 /* Return success to upper level */ |
3139 | 1903 phdata->swapinterval = interval; |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1904 return 0; |
3139 | 1905 } |
1906 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1907 |
3139 | 1908 /* Failed to set swap interval */ |
1909 SDL_SetError("Photon: Cannot set swap interval"); | |
1910 return -1; | |
1911 #else | |
1912 SDL_SetError("Photon: OpenGL ES support is not compiled in"); | |
1913 return -1; | |
1914 #endif /* SDL_VIDEO_OPENGL_ES */ | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1915 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1916 |
3139 | 1917 int |
1918 photon_gl_getswapinterval(_THIS) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1919 { |
3139 | 1920 #if defined(SDL_VIDEO_OPENGL_ES) |
1921 SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1922 |
3139 | 1923 if (phdata->gfinitialized != SDL_TRUE) { |
1924 SDL_SetError | |
1925 ("Photon: GF initialization failed, no OpenGL ES support"); | |
1926 return -1; | |
1927 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1928 |
3139 | 1929 /* Return default swap interval value */ |
1930 return phdata->swapinterval; | |
1931 #else | |
1932 SDL_SetError("Photon: OpenGL ES support is not compiled in"); | |
1933 return -1; | |
1934 #endif /* SDL_VIDEO_OPENGL_ES */ | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1935 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1936 |
3139 | 1937 void |
1938 photon_gl_swapwindow(_THIS, SDL_Window * window) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
1939 { |
3139 | 1940 #if defined(SDL_VIDEO_OPENGL_ES) |
1941 SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; | |
1942 SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; | |
1943 SDL_DisplayData *didata = | |
3685
64ce267332c6
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents:
3500
diff
changeset
|
1944 (SDL_DisplayData *) window->display->driverdata; |
3139 | 1945 PhRect_t dst_rect; |
1946 PhRect_t src_rect; | |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
1947 int32_t status; |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1948 |
3139 | 1949 if (phdata->gfinitialized != SDL_TRUE) { |
1950 SDL_SetError | |
1951 ("Photon: GF initialization failed, no OpenGL ES support"); | |
1952 return; | |
1953 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1954 |
3193
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1955 if (wdata->phsurface==NULL) { |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1956 SDL_SetError |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1957 ("Photon: Photon OpenGL ES surface is not initialized"); |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1958 return; |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1959 } |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
1960 |
3139 | 1961 /* Many applications do not uses glFinish(), so we call it for them */ |
1962 glFinish(); | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1963 |
3139 | 1964 /* Wait until OpenGL ES rendering is completed */ |
1965 eglWaitGL(); | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1966 |
3139 | 1967 /* Wait for VSYNC manually, if it was enabled */ |
1968 if (phdata->swapinterval != 0) { | |
1969 /* Wait for VSYNC, we use GF function, since Photon requires */ | |
1970 /* to enter to the Direct mode to call PgWaitVSync() */ | |
1971 gf_display_wait_vsync(didata->display); | |
1972 } | |
1973 | |
1974 /* Set blit area */ | |
1975 dst_rect = *PtGetCanvas(wdata->window); | |
1976 src_rect.ul.x = 0; | |
1977 src_rect.ul.y = 0; | |
1978 src_rect.lr.x = window->w - 1; | |
1979 src_rect.lr.y = window->h - 1; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1980 |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
1981 /* Check if current device is not the same as target */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
1982 if (phdata->current_device_id != didata->device_id) { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
1983 /* Set target device as default for Pd and Pg functions */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
1984 status = PdSetTargetDevice(NULL, phdata->rid[didata->device_id]); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
1985 if (status != 0) { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
1986 SDL_SetError("Photon: Can't set default target device\n"); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
1987 return; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
1988 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
1989 phdata->current_device_id = didata->device_id; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
1990 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
1991 |
3139 | 1992 /* Blit OpenGL ES pixmap surface directly to window region */ |
1993 PgFFlush(Ph_START_DRAW); | |
1994 PgSetRegionCx(PhDCGetCurrent(), PtWidgetRid(wdata->window)); | |
1995 PgClearTranslationCx(PgGetGCCx(PhDCGetCurrent())); | |
1996 PgContextBlit(wdata->phsurface, &src_rect, NULL, &dst_rect); | |
1997 PgFFlush(Ph_DONE_DRAW); | |
1998 PgWaitHWIdle(); | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
1999 |
3139 | 2000 eglSwapBuffers(phdata->egldisplay, wdata->gles_surface); |
2001 #else | |
2002 SDL_SetError("Photon: OpenGL ES support is not compiled in"); | |
2003 return; | |
2004 #endif /* SDL_VIDEO_OPENGL_ES */ | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
2005 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
2006 |
3139 | 2007 void |
2008 photon_gl_deletecontext(_THIS, SDL_GLContext context) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
2009 { |
3139 | 2010 #if defined(SDL_VIDEO_OPENGL_ES) |
2011 SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; | |
2012 EGLBoolean status; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
2013 |
3139 | 2014 if (phdata->gfinitialized != SDL_TRUE) { |
2015 SDL_SetError | |
2016 ("Photon: GF initialization failed, no OpenGL ES support"); | |
2017 return; | |
2018 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
2019 |
3139 | 2020 /* Check if OpenGL ES connection has been initialized */ |
2021 if (phdata->egldisplay != EGL_NO_DISPLAY) { | |
2022 if (context != EGL_NO_CONTEXT) { | |
3193
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2023 /* Check if we are destroying current active context */ |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2024 if (phdata->lgles_context==context) { |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2025 /* Release current context */ |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2026 eglMakeCurrent(phdata->egldisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2027 phdata->lgles_context=EGL_NO_CONTEXT; |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2028 phdata->lgles_surface=EGL_NO_SURFACE; |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2029 } |
3139 | 2030 status = eglDestroyContext(phdata->egldisplay, context); |
2031 if (status != EGL_TRUE) { | |
2032 /* Error during OpenGL ES context destroying */ | |
2033 SDL_SetError("Photon: OpenGL ES context destroy error"); | |
2034 return; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
2035 } |
3139 | 2036 } |
2037 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
2038 |
3139 | 2039 return; |
2040 #else | |
2041 SDL_SetError("Photon: OpenGL ES support is not compiled in"); | |
2042 return; | |
2043 #endif /* SDL_VIDEO_OPENGL_ES */ | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
2044 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
2045 |
3193
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2046 /* Helper function, which re-creates surface, not an API */ |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2047 int photon_gl_recreatesurface(_THIS, SDL_Window * window, uint32_t width, uint32_t height) |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2048 { |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2049 #if defined(SDL_VIDEO_OPENGL_ES) |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2050 SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2051 SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2052 SDL_DisplayData *didata = |
3685
64ce267332c6
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents:
3500
diff
changeset
|
2053 (SDL_DisplayData *) window->display->driverdata; |
3193
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2054 SDL_bool makecurrent=SDL_FALSE; |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2055 int32_t gfstatus; |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2056 |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2057 /* Check if context has been initialized */ |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2058 if (wdata->gles_context == EGL_NO_CONTEXT) { |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2059 /* If no, abort surface re-creating */ |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2060 return -1; |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2061 } |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2062 |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2063 /* Check if last used surface the same as one which must be re-created */ |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2064 if (phdata->lgles_surface == wdata->gles_surface) { |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2065 makecurrent=SDL_TRUE; |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2066 /* Flush all current drawings */ |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2067 glFinish(); |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2068 /* Wait until OpenGL ES rendering is completed */ |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2069 eglWaitGL(); |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2070 /* Release current context */ |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2071 eglMakeCurrent(phdata->egldisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2072 phdata->lgles_surface=EGL_NO_SURFACE; |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2073 } |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2074 |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2075 /* Check if we need to destroy previous surface */ |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2076 if (wdata->gles_surface != EGL_NO_SURFACE) { |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2077 /* Destroy photon handle to GF surface */ |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2078 if (wdata->phsurface != NULL) { |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2079 PhDCRelease(wdata->phsurface); |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2080 wdata->phsurface=NULL; |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2081 } |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2082 |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2083 /* Destroy previous surface */ |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2084 eglDestroySurface(phdata->egldisplay, wdata->gles_surface); |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2085 |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2086 /* Set surface to uninitialized */ |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2087 wdata->gles_surface = EGL_NO_SURFACE; |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2088 |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2089 if (wdata->gfsurface!=NULL) { |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2090 gf_surface_free(wdata->gfsurface); |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2091 wdata->gfsurface=NULL; |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2092 } |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2093 } |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2094 |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2095 /* Create new GF surface */ |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2096 gfstatus = |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2097 gf_surface_create(&wdata->gfsurface, phdata->gfdev, width, |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2098 height, |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2099 qnxgf_sdl_to_gf_pixelformat(didata->current_mode. |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2100 format), NULL, |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2101 GF_SURFACE_CREATE_2D_ACCESSIBLE | |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2102 GF_SURFACE_CREATE_3D_ACCESSIBLE | |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2103 GF_SURFACE_CREATE_SHAREABLE); |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2104 if (gfstatus != GF_ERR_OK) { |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2105 SDL_SetError("Photon: Can't create GF 3D surface (%08X)", gfstatus); |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2106 return -1; |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2107 } |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2108 |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2109 /* Create new pixmap 3D target surface */ |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2110 wdata->gles_surface = |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2111 eglCreatePixmapSurface(phdata->egldisplay, |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2112 wdata->gles_configs[wdata->gles_config], |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2113 wdata->gfsurface, NULL); |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2114 if (wdata->gles_surface == EGL_NO_SURFACE) { |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2115 gf_surface_free(wdata->gfsurface); |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2116 wdata->gfsurface=NULL; |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2117 SDL_SetError("Photon: Can't create EGL pixmap surface"); |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2118 return -1; |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2119 } |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2120 |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2121 wdata->phsurface = PdCreateOffscreenContextGF(wdata->gfsurface); |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2122 if (wdata->phsurface == NULL) { |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2123 /* Destroy OpenGL ES surface */ |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2124 eglDestroySurface(phdata->egldisplay, wdata->gles_surface); |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2125 wdata->gles_surface=EGL_NO_SURFACE; |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2126 gf_surface_free(wdata->gfsurface); |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2127 wdata->gfsurface=NULL; |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2128 SDL_SetError("Photon: Can't bind GF surface to Photon\n"); |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2129 return -1; |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2130 } |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2131 |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2132 /* Check if we need to set this surface and context as current */ |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2133 if (makecurrent == SDL_TRUE) { |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2134 return photon_gl_makecurrent(_this, window, wdata->gles_context); |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2135 } else { |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2136 return 0; |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2137 } |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2138 #else |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2139 /* Do nothing, if OpenGL ES support is not compiled in */ |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2140 return 0; |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2141 #endif /* SDL_VIDEO_OPENGL_ES */ |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2142 } |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2143 |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
2144 /*****************************************************************************/ |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
2145 /* SDL Event handling function */ |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
2146 /*****************************************************************************/ |
3139 | 2147 void |
2148 photon_pumpevents(_THIS) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
2149 { |
3139 | 2150 uint8_t eventbuffer[SDL_VIDEO_PHOTON_EVENT_SIZE]; |
2151 PhEvent_t *event = (PhEvent_t *) eventbuffer; | |
2152 int32_t status; | |
2153 uint32_t finish = 0; | |
2154 SDL_Window *window; | |
2155 SDL_WindowData *wdata; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
2156 |
3139 | 2157 do { |
2158 status = PhEventPeek(event, SDL_VIDEO_PHOTON_EVENT_SIZE); | |
2159 switch (status) { | |
2160 case Ph_RESIZE_MSG: | |
2161 { | |
2162 SDL_SetError("Photon: Event size too much for buffer"); | |
2163 return; | |
2164 } | |
2165 break; | |
2166 case Ph_EVENT_MSG: | |
2167 { | |
2168 /* Find a window, to which this handle destinated */ | |
2169 status = 0; | |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3465
diff
changeset
|
2170 for (i = 0; i < SDL_GetNumVideoDisplays(); ++i) { |
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3465
diff
changeset
|
2171 SDL_VideoDisplay *display = SDL_GetVideoDisplay(i); |
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3465
diff
changeset
|
2172 for (j = 0; j < display->num_windows; ++j) { |
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3465
diff
changeset
|
2173 wdata = (SDL_WindowData *) display->windows[j].driverdata; |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
2174 |
3500
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3465
diff
changeset
|
2175 /* Find the proper window */ |
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3465
diff
changeset
|
2176 if (wdata->window != NULL) { |
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3465
diff
changeset
|
2177 if (PtWidgetRid(wdata->window) == |
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3465
diff
changeset
|
2178 event->collector.rid) { |
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3465
diff
changeset
|
2179 window = (SDL_Window *) &display->windows[it]; |
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3465
diff
changeset
|
2180 status = 1; |
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3465
diff
changeset
|
2181 break; |
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3465
diff
changeset
|
2182 } |
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3465
diff
changeset
|
2183 } else { |
4b594623401b
Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents:
3465
diff
changeset
|
2184 continue; |
3139 | 2185 } |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
2186 } |
3139 | 2187 } |
2188 if (status == 0) { | |
2189 window = NULL; | |
2190 wdata = NULL; | |
2191 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
2192 |
3139 | 2193 /* Event is ready */ |
2194 switch (event->type) { | |
2195 case Ph_EV_BOUNDARY: | |
2196 { | |
2197 switch (event->subtype) { | |
2198 case Ph_EV_PTR_ENTER: | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
2199 { |
3139 | 2200 /* Mouse cursor over handled window */ |
2201 if (window != NULL) { | |
3685
64ce267332c6
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents:
3500
diff
changeset
|
2202 SDL_SendWindowEvent(window, |
3139 | 2203 SDL_WINDOWEVENT_ENTER, |
2204 0, 0); | |
3685
64ce267332c6
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents:
3500
diff
changeset
|
2205 SDL_SetMouseFocus(0, window); |
3139 | 2206 } |
2207 } | |
2208 break; | |
2209 case Ph_EV_PTR_LEAVE: | |
2210 { | |
2211 /* Mouse cursor out of handled window */ | |
2212 if (window != NULL) { | |
3685
64ce267332c6
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents:
3500
diff
changeset
|
2213 SDL_SendWindowEvent(window, |
3139 | 2214 SDL_WINDOWEVENT_LEAVE, |
2215 0, 0); | |
2216 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
2217 } |
3139 | 2218 break; |
2219 } | |
2220 } | |
2221 break; | |
2222 case Ph_EV_PTR_MOTION_BUTTON: | |
2223 case Ph_EV_PTR_MOTION_NOBUTTON: | |
2224 { | |
2225 PhPointerEvent_t *pevent = NULL; | |
2226 PhRect_t *prects = NULL; | |
2227 | |
2228 /* Get event data */ | |
2229 pevent = PhGetData(event); | |
2230 /* Get associated event rectangles */ | |
2231 prects = PhGetRects(event); | |
2232 if ((pevent != NULL) && (prects != NULL)) { | |
2233 SDL_SendMouseMotion(0, 0, prects->ul.x, | |
2234 prects->ul.y, 0); | |
2235 } | |
2236 } | |
2237 break; | |
2238 case Ph_EV_BUT_PRESS: | |
2239 { | |
2240 /* Button press event */ | |
2241 PhPointerEvent_t *pevent = NULL; | |
2242 uint32_t sdlbutton = 0x00000000; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
2243 |
3139 | 2244 /* Get event data */ |
2245 pevent = PhGetData(event); | |
2246 if (pevent != NULL) { | |
2247 for (it = 0; it < sizeof(pevent->buttons) * 8; | |
2248 it++) { | |
2249 if ((pevent->buttons & (0x0001 << it)) == | |
2250 (0x0001 << it)) { | |
2251 switch (it) { | |
2252 case 0: | |
2253 { | |
2254 sdlbutton = SDL_BUTTON_RIGHT; | |
2255 } | |
2256 break; | |
2257 case 1: | |
2258 { | |
2259 sdlbutton = SDL_BUTTON_MIDDLE; | |
2260 } | |
2261 break; | |
2262 case 2: | |
2263 { | |
2264 sdlbutton = SDL_BUTTON_LEFT; | |
2265 } | |
2266 break; | |
2267 default: | |
2268 { | |
2269 sdlbutton = it + 1; | |
2270 } | |
2271 break; | |
2272 } | |
2273 SDL_SendMouseButton(0, SDL_PRESSED, | |
2274 sdlbutton); | |
2275 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
2276 } |
3139 | 2277 } |
2278 } | |
2279 break; | |
2280 case Ph_EV_BUT_RELEASE: | |
2281 { | |
2282 /* Button press event */ | |
2283 PhPointerEvent_t *pevent = NULL; | |
2284 uint32_t sdlbutton = 0x00000000; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
2285 |
3139 | 2286 /* Get event data */ |
2287 pevent = PhGetData(event); | |
2288 if (pevent != NULL) { | |
2289 for (it = 0; it < sizeof(pevent->buttons) * 8; | |
2290 it++) { | |
2291 if ((pevent->buttons & (0x0001 << it)) == | |
2292 (0x0001 << it)) { | |
2293 switch (it) { | |
2294 case 0: | |
2295 { | |
2296 sdlbutton = SDL_BUTTON_RIGHT; | |
2297 } | |
2298 break; | |
2299 case 1: | |
2300 { | |
2301 sdlbutton = SDL_BUTTON_MIDDLE; | |
2302 } | |
2303 break; | |
2304 case 2: | |
2305 { | |
2306 sdlbutton = SDL_BUTTON_LEFT; | |
2307 } | |
2308 break; | |
2309 default: | |
2310 { | |
2311 sdlbutton = it + 1; | |
2312 } | |
2313 break; | |
2314 } | |
2315 } | |
2316 } | |
2317 } | |
2318 | |
2319 switch (event->subtype) { | |
2320 case Ph_EV_RELEASE_REAL: | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
2321 { |
3139 | 2322 /* Real release button event */ |
2323 SDL_SendMouseButton(0, SDL_RELEASED, | |
2324 sdlbutton); | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
2325 } |
3139 | 2326 break; |
2327 case Ph_EV_RELEASE_PHANTOM: | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
2328 { |
3139 | 2329 /* We will get phantom button release */ |
2330 /* event in case if it was unpressed */ | |
2331 /* outside of window */ | |
2332 if (window != NULL) { | |
2333 if ((window-> | |
2334 flags & SDL_WINDOW_MOUSE_FOCUS) != | |
2335 SDL_WINDOW_MOUSE_FOCUS) { | |
2336 /* Send phantom button release */ | |
2337 SDL_SendMouseButton(0, SDL_RELEASED, | |
2338 sdlbutton); | |
2339 } | |
2340 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
2341 } |
3139 | 2342 break; |
2343 } | |
2344 } | |
2345 break; | |
2346 case Ph_EV_EXPOSE: | |
2347 { | |
2348 switch (event->subtype) { | |
2349 case Ph_NORMAL_EXPOSE: | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
2350 { |
3139 | 2351 PhRect_t *rects = NULL; |
2352 | |
2353 /* Get array of rectangles to be updated */ | |
2354 rects = PhGetRects(event); | |
2355 if (rects == NULL) { | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
2356 break; |
3139 | 2357 } |
2358 | |
2359 /* Check if expose come to one of the our windows */ | |
2360 if ((wdata != NULL) && (window != NULL)) { | |
2361 /* Check if window uses OpenGL ES */ | |
2362 if (wdata->uses_gles == SDL_TRUE) { | |
3411
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
2363 #if defined(SDL_VIDEO_OPENGL_ES) |
3139 | 2364 /* Cycle through each rectangle */ |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
2365 for (it = 0; it < event->num_rects; it++) { |
3139 | 2366 /* Blit OpenGL ES pixmap surface directly to window region */ |
2367 PgFFlush(Ph_START_DRAW); | |
2368 PgSetRegionCx(PhDCGetCurrent(), | |
2369 PtWidgetRid(wdata-> | |
2370 window)); | |
2371 PgClearTranslationCx(PgGetGCCx | |
2372 (PhDCGetCurrent | |
2373 ())); | |
2374 PgContextBlit(wdata->phsurface, | |
2375 &rects[it], NULL, | |
2376 &rects[it]); | |
2377 PgFFlush(Ph_DONE_DRAW); | |
2378 PgWaitHWIdle(); | |
2379 } | |
3411
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
2380 #endif /* SDL_VIDEO_OPENGL_ES */ |
3139 | 2381 } else { |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
2382 /* Cycle through each rectangle */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
2383 for (it = 0; it < event->num_rects; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
2384 it++) { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
2385 /* Blit 2D pixmap surface directly to window region */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
2386 _photon_update_rectangles(window->renderer, &rects[it]); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
2387 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
2388 PgFlush(); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
2389 PgWaitHWIdle(); |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
2390 } |
3139 | 2391 } |
2392 | |
2393 /* Flush all blittings */ | |
2394 PgFlush(); | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
2395 } |
3139 | 2396 break; |
2397 case Ph_CAPTURE_EXPOSE: | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
2398 { |
3139 | 2399 /* Check if expose come to one of the our windows */ |
2400 if ((wdata != NULL) && (window != NULL)) { | |
2401 /* Check if window uses OpenGL ES */ | |
2402 if (wdata->uses_gles == SDL_TRUE) { | |
2403 PhRect_t dst_rect; | |
2404 PhRect_t src_rect; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
2405 |
3139 | 2406 /* Set blit area */ |
2407 dst_rect = | |
2408 *PtGetCanvas(wdata->window); | |
2409 src_rect.ul.x = 0; | |
2410 src_rect.ul.y = 0; | |
2411 src_rect.lr.x = window->w - 1; | |
2412 src_rect.lr.y = window->h - 1; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
2413 |
3411
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
2414 #if defined(SDL_VIDEO_OPENGL_ES) |
3139 | 2415 /* We need to redraw entire window */ |
2416 PgFFlush(Ph_START_DRAW); | |
2417 PgSetRegionCx(PhDCGetCurrent(), | |
2418 PtWidgetRid(wdata-> | |
2419 window)); | |
2420 PgClearTranslationCx(PgGetGCCx | |
2421 (PhDCGetCurrent | |
2422 ())); | |
2423 PgContextBlit(wdata->phsurface, | |
2424 &src_rect, NULL, | |
2425 &dst_rect); | |
2426 PgFFlush(Ph_DONE_DRAW); | |
2427 PgWaitHWIdle(); | |
3411
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
2428 #endif /* SDL_VIDEO_OPENGL_ES */ |
3139 | 2429 } else { |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
2430 PhRect_t rect; |
3115
1102a3305928
Added handler for all window events.
Mike Gorchak <lestat@i.com.ua>
parents:
3108
diff
changeset
|
2431 |
3139 | 2432 /* We need to redraw entire window */ |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
2433 rect.ul.x = 0; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
2434 rect.ul.y = 0; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
2435 rect.lr.x = window->w - 1; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
2436 rect.lr.y = window->h - 1; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
2437 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
2438 /* Blit 2D pixmap surface directly to window region */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
2439 PgFFlush(Ph_START_DRAW); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
2440 _photon_update_rectangles(window->renderer, &rect); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
2441 PgFFlush(Ph_DONE_DRAW); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
2442 PgWaitHWIdle(); |
3139 | 2443 } |
2444 } | |
2445 } | |
2446 break; | |
2447 case Ph_GRAPHIC_EXPOSE: | |
2448 { | |
2449 /* TODO: What this event means ? */ | |
2450 } | |
2451 break; | |
2452 } | |
2453 } | |
2454 break; | |
2455 case Ph_EV_INFO: | |
2456 { | |
3387
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
2457 switch (event->subtype) |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
2458 { |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
2459 case Ph_OFFSCREEN_INVALID: |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
2460 { |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
2461 uint32_t* type; |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
2462 |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
2463 type = PhGetData(event); |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
2464 switch (*type) |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
2465 { |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
2466 case Pg_VIDEO_MODE_SWITCHED: |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
2467 case Pg_ENTERED_DIRECT: |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
2468 case Pg_EXITED_DIRECT: |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
2469 case Pg_DRIVER_STARTED: |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
2470 { |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
2471 /* TODO: */ |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
2472 /* We must tell the renderer, that it have */ |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
2473 /* to recreate all surfaces */ |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
2474 } |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
2475 break; |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
2476 default: |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
2477 { |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
2478 } |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
2479 break; |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
2480 } |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
2481 } |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
2482 break; |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
2483 default: |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
2484 break; |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
2485 } |
3139 | 2486 } |
2487 break; | |
2488 case Ph_EV_KEY: | |
2489 { | |
2490 PhKeyEvent_t *keyevent = NULL; | |
2491 SDL_scancode scancode = SDL_SCANCODE_UNKNOWN; | |
2492 SDL_bool pressed = SDL_FALSE; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
2493 |
3139 | 2494 keyevent = PhGetData(event); |
2495 if (keyevent == NULL) { | |
2496 break; | |
2497 } | |
2498 | |
2499 /* Check if key is repeated */ | |
2500 if ((keyevent->key_flags & Pk_KF_Key_Repeat) == | |
2501 Pk_KF_Key_Repeat) { | |
2502 /* Ignore such events */ | |
2503 break; | |
2504 } | |
2505 | |
2506 /* Check if key has its own scancode */ | |
2507 if ((keyevent->key_flags & Pk_KF_Scan_Valid) == | |
2508 Pk_KF_Scan_Valid) { | |
2509 if ((keyevent->key_flags & Pk_KF_Key_Down) == | |
2510 Pk_KF_Key_Down) { | |
2511 pressed = SDL_TRUE; | |
2512 } else { | |
2513 pressed = SDL_FALSE; | |
2514 } | |
2515 scancode = | |
2516 photon_to_sdl_keymap(keyevent->key_scan); | |
2517 | |
2518 /* Add details for the pressed key */ | |
2519 if ((keyevent->key_flags & Pk_KF_Cap_Valid) == | |
2520 Pk_KF_Cap_Valid) { | |
2521 switch (keyevent->key_cap) { | |
2522 case Pk_Hyper_R: /* Right windows flag key */ | |
2523 scancode = SDL_SCANCODE_RGUI; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
2524 break; |
3139 | 2525 case Pk_Control_R: /* Right Ctrl key */ |
2526 scancode = SDL_SCANCODE_RCTRL; | |
2527 break; | |
2528 case Pk_Alt_R: /* Right Alt key */ | |
2529 scancode = SDL_SCANCODE_RALT; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
2530 break; |
3139 | 2531 case Pk_Up: /* Up key but with invalid scan */ |
2532 if (scancode != SDL_SCANCODE_UP) { | |
2533 /* This is a mouse wheel event */ | |
2534 SDL_SendMouseWheel(0, 0, 1); | |
2535 return; | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
2536 } |
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
2537 break; |
3139 | 2538 case Pk_KP_8: /* Up arrow or 8 on keypad */ |
2539 scancode = SDL_SCANCODE_KP_8; | |
2540 break; | |
2541 case Pk_Down: /* Down key but with invalid scan */ | |
2542 if (scancode != SDL_SCANCODE_DOWN) { | |
2543 /* This is a mouse wheel event */ | |
2544 SDL_SendMouseWheel(0, 0, -1); | |
2545 return; | |
2546 } | |
2547 break; | |
2548 case Pk_KP_2: /* Down arrow or 2 on keypad */ | |
2549 scancode = SDL_SCANCODE_KP_2; | |
2550 break; | |
2551 case Pk_Left: /* Left arrow key */ | |
2552 scancode = SDL_SCANCODE_LEFT; | |
2553 break; | |
2554 case Pk_KP_4: /* Left arrow or 4 on keypad */ | |
2555 scancode = SDL_SCANCODE_KP_4; | |
2556 break; | |
2557 case Pk_Right: /* Right arrow key */ | |
2558 scancode = SDL_SCANCODE_RIGHT; | |
2559 break; | |
2560 case Pk_KP_6: /* Right arrow or 6 on keypad */ | |
2561 scancode = SDL_SCANCODE_KP_6; | |
2562 break; | |
2563 case Pk_Insert: /* Insert key */ | |
2564 scancode = SDL_SCANCODE_INSERT; | |
2565 break; | |
2566 case Pk_KP_0: /* Insert or 0 on keypad */ | |
2567 scancode = SDL_SCANCODE_KP_0; | |
2568 break; | |
2569 case Pk_Home: /* Home key */ | |
2570 scancode = SDL_SCANCODE_HOME; | |
2571 break; | |
2572 case Pk_KP_7: /* Home or 7 on keypad */ | |
2573 scancode = SDL_SCANCODE_KP_7; | |
2574 break; | |
2575 case Pk_Pg_Up: /* PageUp key */ | |
2576 scancode = SDL_SCANCODE_PAGEUP; | |
2577 break; | |
2578 case Pk_KP_9: /* PgUp or 9 on keypad */ | |
2579 scancode = SDL_SCANCODE_KP_9; | |
2580 break; | |
2581 case Pk_Delete: /* Delete key */ | |
2582 scancode = SDL_SCANCODE_DELETE; | |
2583 break; | |
2584 case Pk_KP_Decimal: /* Del or . on keypad */ | |
2585 scancode = SDL_SCANCODE_KP_PERIOD; | |
2586 break; | |
2587 case Pk_End: /* End key */ | |
2588 scancode = SDL_SCANCODE_END; | |
2589 break; | |
2590 case Pk_KP_1: /* End or 1 on keypad */ | |
2591 scancode = SDL_SCANCODE_KP_1; | |
2592 break; | |
2593 case Pk_Pg_Down: /* PageDown key */ | |
2594 scancode = SDL_SCANCODE_PAGEDOWN; | |
2595 break; | |
2596 case Pk_KP_3: /* PgDn or 3 on keypad */ | |
2597 scancode = SDL_SCANCODE_KP_3; | |
2598 break; | |
2599 case Pk_KP_5: /* 5 on keypad */ | |
2600 scancode = SDL_SCANCODE_KP_5; | |
2601 break; | |
2602 case Pk_KP_Enter: | |
2603 scancode = SDL_SCANCODE_KP_ENTER; | |
2604 break; | |
2605 case Pk_KP_Add: | |
2606 scancode = SDL_SCANCODE_KP_PLUS; | |
2607 break; | |
2608 case Pk_KP_Subtract: | |
2609 scancode = SDL_SCANCODE_KP_MINUS; | |
2610 break; | |
2611 case Pk_KP_Multiply: | |
2612 scancode = SDL_SCANCODE_KP_MULTIPLY; | |
2613 break; | |
2614 case Pk_KP_Divide: | |
2615 scancode = SDL_SCANCODE_KP_DIVIDE; | |
2616 break; | |
2617 case Pk_Pause: | |
2618 scancode = SDL_SCANCODE_PAUSE; | |
2619 break; | |
2620 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
2621 } |
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
2622 |
3139 | 2623 /* Finally check if scancode has been decoded */ |
2624 if (scancode == SDL_SCANCODE_UNKNOWN) { | |
2625 /* Something was pressed, which is not supported */ | |
2626 break; | |
2627 } | |
2628 | |
2629 /* Report pressed/released key to SDL */ | |
2630 if (pressed == SDL_TRUE) { | |
2631 SDL_SendKeyboardKey(0, SDL_PRESSED, scancode); | |
2632 } else { | |
2633 SDL_SendKeyboardKey(0, SDL_RELEASED, | |
2634 scancode); | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
2635 } |
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
2636 |
3139 | 2637 /* Photon doesn't send a release event for PrnScr key */ |
2638 if ((scancode == SDL_SCANCODE_PRINTSCREEN) | |
2639 && (pressed)) { | |
2640 SDL_SendKeyboardKey(0, SDL_RELEASED, | |
2641 scancode); | |
2642 } | |
3465
0cbfec87e4f1
Support for UTF-8 text input has been added.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
2643 |
0cbfec87e4f1
Support for UTF-8 text input has been added.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
2644 } |
0cbfec87e4f1
Support for UTF-8 text input has been added.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
2645 |
0cbfec87e4f1
Support for UTF-8 text input has been added.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
2646 /* Handle UTF-8 text input if requested by caller */ |
0cbfec87e4f1
Support for UTF-8 text input has been added.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
2647 if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) |
0cbfec87e4f1
Support for UTF-8 text input has been added.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
2648 { |
0cbfec87e4f1
Support for UTF-8 text input has been added.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
2649 char text[5]; |
0cbfec87e4f1
Support for UTF-8 text input has been added.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
2650 |
0cbfec87e4f1
Support for UTF-8 text input has been added.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
2651 SDL_memset(text, 0x00, 5); |
0cbfec87e4f1
Support for UTF-8 text input has been added.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
2652 if (PhKeyToMb(text, keyevent)!=-1) |
0cbfec87e4f1
Support for UTF-8 text input has been added.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
2653 { |
0cbfec87e4f1
Support for UTF-8 text input has been added.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
2654 SDL_SendKeyboardText(0, text); |
0cbfec87e4f1
Support for UTF-8 text input has been added.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
2655 } |
0cbfec87e4f1
Support for UTF-8 text input has been added.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
2656 else |
0cbfec87e4f1
Support for UTF-8 text input has been added.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
2657 { |
0cbfec87e4f1
Support for UTF-8 text input has been added.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
2658 /* Just do nothing if it is not a UTF-8 character */ |
0cbfec87e4f1
Support for UTF-8 text input has been added.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
2659 } |
3139 | 2660 } |
2661 } | |
2662 break; | |
2663 case Ph_EV_SERVICE: | |
2664 { | |
2665 } | |
2666 break; | |
2667 case Ph_EV_SYSTEM: | |
2668 { | |
2669 } | |
2670 break; | |
2671 case Ph_EV_WM: | |
2672 { | |
2673 PhWindowEvent_t *wmevent = NULL; | |
2674 | |
2675 /* Get associated event data */ | |
2676 wmevent = PhGetData(event); | |
2677 if (wmevent == NULL) { | |
2678 break; | |
2679 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
2680 |
3139 | 2681 switch (wmevent->event_f) { |
2682 case Ph_WM_CLOSE: | |
2683 { | |
2684 if (window != NULL) { | |
3685
64ce267332c6
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents:
3500
diff
changeset
|
2685 SDL_SendWindowEvent(window, |
3139 | 2686 SDL_WINDOWEVENT_CLOSE, |
2687 0, 0); | |
2688 } | |
2689 } | |
2690 break; | |
2691 case Ph_WM_FOCUS: | |
2692 { | |
2693 if (wmevent->event_state == | |
2694 Ph_WM_EVSTATE_FOCUS) { | |
2695 if (window != NULL) { | |
2696 PhRegion_t wregion; | |
2697 | |
3685
64ce267332c6
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents:
3500
diff
changeset
|
2698 SDL_SendWindowEvent(window, |
3139 | 2699 SDL_WINDOWEVENT_FOCUS_GAINED, |
2700 0, 0); | |
3685
64ce267332c6
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents:
3500
diff
changeset
|
2701 SDL_SetKeyboardFocus(0, window); |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
2702 |
3139 | 2703 /* Set window region sensible to mouse motion events */ |
2704 PhRegionQuery(PtWidgetRid | |
2705 (wdata->window), | |
2706 &wregion, NULL, NULL, | |
2707 0); | |
2708 wregion.events_sense |= | |
2709 Ph_EV_PTR_MOTION_BUTTON | | |
2710 Ph_EV_PTR_MOTION_NOBUTTON; | |
2711 PhRegionChange(Ph_REGION_EV_SENSE, 0, | |
2712 &wregion, NULL, NULL); | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
2713 |
3411
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3399
diff
changeset
|
2714 /* If window got a focus, then it is visible */ |
3685
64ce267332c6
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents:
3500
diff
changeset
|
2715 SDL_SendWindowEvent(window, |
3139 | 2716 SDL_WINDOWEVENT_SHOWN, |
2717 0, 0); | |
2718 } | |
2719 } | |
2720 if (wmevent->event_state == | |
2721 Ph_WM_EVSTATE_FOCUSLOST) { | |
2722 if (window != NULL) { | |
2723 PhRegion_t wregion; | |
2724 | |
3685
64ce267332c6
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents:
3500
diff
changeset
|
2725 SDL_SendWindowEvent(window, |
3139 | 2726 SDL_WINDOWEVENT_FOCUS_LOST, |
2727 0, 0); | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
2728 |
3139 | 2729 /* Set window region ignore mouse motion events */ |
2730 PhRegionQuery(PtWidgetRid | |
2731 (wdata->window), | |
2732 &wregion, NULL, NULL, | |
2733 0); | |
2734 wregion.events_sense &= | |
2735 ~(Ph_EV_PTR_MOTION_BUTTON | | |
2736 Ph_EV_PTR_MOTION_NOBUTTON); | |
2737 PhRegionChange(Ph_REGION_EV_SENSE, 0, | |
2738 &wregion, NULL, NULL); | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
2739 } |
3139 | 2740 } |
2741 } | |
2742 break; | |
2743 case Ph_WM_MOVE: | |
2744 { | |
2745 if (window != NULL) { | |
3685
64ce267332c6
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents:
3500
diff
changeset
|
2746 SDL_SendWindowEvent(window, |
3139 | 2747 SDL_WINDOWEVENT_MOVED, |
2748 wmevent->pos.x, | |
2749 wmevent->pos.y); | |
2750 } | |
2751 } | |
2752 break; | |
2753 case Ph_WM_RESIZE: | |
2754 { | |
2755 if (window != NULL) { | |
2756 /* Set new window position after resize */ | |
3685
64ce267332c6
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents:
3500
diff
changeset
|
2757 SDL_SendWindowEvent(window, |
3139 | 2758 SDL_WINDOWEVENT_MOVED, |
2759 wmevent->pos.x, | |
2760 wmevent->pos.y); | |
3193
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2761 |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2762 /* Check if this window uses OpenGL ES */ |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2763 if (wdata->uses_gles == SDL_TRUE) { |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2764 /* If so, recreate surface with new dimensions */ |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2765 photon_gl_recreatesurface(_this, window, wmevent->size.w, wmevent->size.h); |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2766 } |
64e4442676a6
Fixed problems with OpenGL ES window resizing.
Mike Gorchak <lestat@i.com.ua>
parents:
3186
diff
changeset
|
2767 |
3139 | 2768 /* Set new window size after resize */ |
3685
64ce267332c6
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents:
3500
diff
changeset
|
2769 SDL_SendWindowEvent(window, |
3139 | 2770 SDL_WINDOWEVENT_RESIZED, |
2771 wmevent->size.w, | |
2772 wmevent->size.h); | |
2773 } | |
2774 } | |
2775 break; | |
2776 case Ph_WM_HIDE: | |
2777 { | |
2778 if (window != NULL) { | |
2779 /* Send new window state: minimized */ | |
3685
64ce267332c6
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents:
3500
diff
changeset
|
2780 SDL_SendWindowEvent(window, |
3139 | 2781 SDL_WINDOWEVENT_MINIMIZED, |
2782 0, 0); | |
2783 /* In case window is minimized, then it is hidden */ | |
3685
64ce267332c6
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents:
3500
diff
changeset
|
2784 SDL_SendWindowEvent(window, |
3139 | 2785 SDL_WINDOWEVENT_HIDDEN, |
2786 0, 0); | |
2787 } | |
3108
aa1897bee1e9
Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents:
3092
diff
changeset
|
2788 } |
3139 | 2789 break; |
2790 case Ph_WM_MAX: | |
2791 { | |
2792 if (window != NULL) { | |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
2793 if ((window->flags & SDL_WINDOW_RESIZABLE)==SDL_WINDOW_RESIZABLE) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
2794 { |
3685
64ce267332c6
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents:
3500
diff
changeset
|
2795 SDL_SendWindowEvent(window, |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
2796 SDL_WINDOWEVENT_MAXIMIZED, |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
2797 0, 0); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
2798 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
2799 else |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
2800 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
2801 /* otherwise ignor the resize events */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3193
diff
changeset
|
2802 } |
3139 | 2803 } |
2804 } | |
2805 break; | |
2806 case Ph_WM_RESTORE: | |
2807 { | |
2808 if (window != NULL) { | |
3685
64ce267332c6
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents:
3500
diff
changeset
|
2809 SDL_SendWindowEvent(window, |
3139 | 2810 SDL_WINDOWEVENT_RESTORED, |
2811 0, 0); | |
2812 } | |
2813 } | |
2814 break; | |
2815 } | |
2816 } | |
2817 break; | |
2818 } | |
2819 PtEventHandler(event); | |
2820 } | |
2821 break; | |
2822 case 0: | |
2823 { | |
2824 /* All events are read */ | |
2825 finish = 1; | |
2826 break; | |
2827 } | |
2828 case -1: | |
2829 { | |
2830 /* Error occured in event reading */ | |
2831 SDL_SetError("Photon: Can't read event"); | |
2832 return; | |
2833 } | |
2834 break; | |
2835 } | |
2836 if (finish != 0) { | |
2837 break; | |
2838 } | |
2839 } while (1); | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
2840 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
2841 |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
2842 /*****************************************************************************/ |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
2843 /* SDL screen saver related functions */ |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
2844 /*****************************************************************************/ |
3139 | 2845 void |
2846 photon_suspendscreensaver(_THIS) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
2847 { |
3139 | 2848 /* There is no screensaver in pure console, it may exist when running */ |
2849 /* GF under Photon, but I do not know, how to disable screensaver */ | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
2850 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
2851 |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2852 /* vi: set ts=4 sw=4 expandtab: */ |