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