Mercurial > sdl-ios-xcode
annotate test/testgl.c @ 4393:9afe12fb4c41 SDL-1.2
Fixed bug #901
Tim Angus 2009-12-11 11:45:46 PST
Disable mouse event generation when state is not SDL_APPMOUSEFOCUS
If a Windows SDL application is minimised by using alt-tab, SDL_APPMOUSEFOCUS
is lost as part of the minimisation. Unfortunately, the directx driver doesn't
pay any attention to this state when generating mouse button events, so
clicking on the Desktop can cause mouse clicks in the SDL application, while
it's still minimised. The attached patch fixes this. It looks much more
complicated than it actually is due to indentation; here it is ignoring
whitespace:
tma@abraxas:~/sources/SDL-1.2-svn$ svn diff -x -b
Index: src/video/windx5/SDL_dx5events.c
===================================================================
--- src/video/windx5/SDL_dx5events.c (revision 5376)
+++ src/video/windx5/SDL_dx5events.c (working copy)
@@ -374,10 +374,9 @@
if ( !(SDL_GetAppState() & SDL_APPMOUSEFOCUS) ) {
mouse_lost = 1;
ClipCursor(NULL);
- }
-
+ } else {
/* If the mouse was lost, regain some sense of mouse state */
- if ( mouse_lost && (SDL_GetAppState() & SDL_APPMOUSEFOCUS) ) {
+ if ( mouse_lost ) {
POINT mouse_pos;
Uint8 old_state;
Uint8 new_state;
@@ -548,6 +547,7 @@
if ( xrel || yrel ) {
post_mouse_motion(1, xrel, yrel);
}
+ }
}
/* The main Win32 event handler */
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 14 Dec 2009 22:41:31 +0000 |
parents | 9d940db55a91 |
children | c121d94672cb |
rev | line source |
---|---|
0 | 1 #include <stdlib.h> |
2 #include <stdio.h> | |
3 #include <string.h> | |
4 #include <math.h> | |
5 | |
6 #include "SDL.h" | |
7 | |
1815
871090feb7ad
Fixed building with CodeWarrior on MacOS Classic
Sam Lantinga <slouken@libsdl.org>
parents:
1737
diff
changeset
|
8 #ifdef __MACOS__ |
871090feb7ad
Fixed building with CodeWarrior on MacOS Classic
Sam Lantinga <slouken@libsdl.org>
parents:
1737
diff
changeset
|
9 #define HAVE_OPENGL |
871090feb7ad
Fixed building with CodeWarrior on MacOS Classic
Sam Lantinga <slouken@libsdl.org>
parents:
1737
diff
changeset
|
10 #endif |
871090feb7ad
Fixed building with CodeWarrior on MacOS Classic
Sam Lantinga <slouken@libsdl.org>
parents:
1737
diff
changeset
|
11 |
0 | 12 #ifdef HAVE_OPENGL |
234
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
13 |
214
0e5d6dd77bda
Added platform independent OpenGL header - SDL_opengl.h
Sam Lantinga <slouken@libsdl.org>
parents:
0
diff
changeset
|
14 #include "SDL_opengl.h" |
0 | 15 |
234
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
16 /* Undefine this if you want a flat cube instead of a rainbow cube */ |
0 | 17 #define SHADED_CUBE |
18 | |
234
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
19 /* Define this to be the name of the logo image to use with -logo */ |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
20 #define LOGO_FILE "icon.bmp" |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
21 |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
22 /* The SDL_OPENGLBLIT interface is deprecated. |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
23 The code is still available for benchmark purposes though. |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
24 */ |
492
c59692dcdce0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
363
diff
changeset
|
25 |
233
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
26 static SDL_bool USE_DEPRECATED_OPENGLBLIT = SDL_FALSE; |
0 | 27 |
492
c59692dcdce0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
363
diff
changeset
|
28 static SDL_Surface *global_image = NULL; |
c59692dcdce0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
363
diff
changeset
|
29 static GLuint global_texture = 0; |
933
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
30 static GLuint cursor_texture = 0; |
492
c59692dcdce0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
363
diff
changeset
|
31 |
234
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
32 /**********************************************************************/ |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
33 |
0 | 34 void HotKey_ToggleFullScreen(void) |
35 { | |
36 SDL_Surface *screen; | |
37 | |
38 screen = SDL_GetVideoSurface(); | |
39 if ( SDL_WM_ToggleFullScreen(screen) ) { | |
40 printf("Toggled fullscreen mode - now %s\n", | |
41 (screen->flags&SDL_FULLSCREEN) ? "fullscreen" : "windowed"); | |
42 } else { | |
43 printf("Unable to toggle fullscreen mode\n"); | |
44 } | |
45 } | |
46 | |
47 void HotKey_ToggleGrab(void) | |
48 { | |
49 SDL_GrabMode mode; | |
50 | |
51 printf("Ctrl-G: toggling input grab!\n"); | |
52 mode = SDL_WM_GrabInput(SDL_GRAB_QUERY); | |
53 if ( mode == SDL_GRAB_ON ) { | |
54 printf("Grab was on\n"); | |
55 } else { | |
56 printf("Grab was off\n"); | |
57 } | |
58 mode = SDL_WM_GrabInput(!mode); | |
59 if ( mode == SDL_GRAB_ON ) { | |
60 printf("Grab is now on\n"); | |
61 } else { | |
62 printf("Grab is now off\n"); | |
63 } | |
64 } | |
65 | |
66 void HotKey_Iconify(void) | |
67 { | |
68 printf("Ctrl-Z: iconifying window!\n"); | |
69 SDL_WM_IconifyWindow(); | |
70 } | |
71 | |
72 int HandleEvent(SDL_Event *event) | |
73 { | |
74 int done; | |
75 | |
76 done = 0; | |
77 switch( event->type ) { | |
78 case SDL_ACTIVEEVENT: | |
79 /* See what happened */ | |
80 printf( "app %s ", event->active.gain ? "gained" : "lost" ); | |
81 if ( event->active.state & SDL_APPACTIVE ) { | |
82 printf( "active " ); | |
83 } else if ( event->active.state & SDL_APPMOUSEFOCUS ) { | |
84 printf( "mouse " ); | |
85 } else if ( event->active.state & SDL_APPINPUTFOCUS ) { | |
86 printf( "input " ); | |
87 } | |
88 printf( "focus\n" ); | |
89 break; | |
90 | |
91 | |
92 case SDL_KEYDOWN: | |
93 if ( event->key.keysym.sym == SDLK_ESCAPE ) { | |
94 done = 1; | |
95 } | |
96 if ( (event->key.keysym.sym == SDLK_g) && | |
97 (event->key.keysym.mod & KMOD_CTRL) ) { | |
98 HotKey_ToggleGrab(); | |
99 } | |
100 if ( (event->key.keysym.sym == SDLK_z) && | |
101 (event->key.keysym.mod & KMOD_CTRL) ) { | |
102 HotKey_Iconify(); | |
103 } | |
104 if ( (event->key.keysym.sym == SDLK_RETURN) && | |
105 (event->key.keysym.mod & KMOD_ALT) ) { | |
106 HotKey_ToggleFullScreen(); | |
107 } | |
108 printf("key '%s' pressed\n", | |
109 SDL_GetKeyName(event->key.keysym.sym)); | |
110 break; | |
111 case SDL_QUIT: | |
112 done = 1; | |
113 break; | |
114 } | |
115 return(done); | |
116 } | |
117 | |
233
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
118 void SDL_GL_Enter2DMode() |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
119 { |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
120 SDL_Surface *screen = SDL_GetVideoSurface(); |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
121 |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
122 /* Note, there may be other things you need to change, |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
123 depending on how you have your OpenGL state set up. |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
124 */ |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
125 glPushAttrib(GL_ENABLE_BIT); |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
126 glDisable(GL_DEPTH_TEST); |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
127 glDisable(GL_CULL_FACE); |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
128 glEnable(GL_TEXTURE_2D); |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
129 |
243
cf4944faad96
Fixed testgl so that SDL_GL_Enter2DMode() allows alpha blending
Sam Lantinga <slouken@libsdl.org>
parents:
234
diff
changeset
|
130 /* This allows alpha blending of 2D textures with the scene */ |
cf4944faad96
Fixed testgl so that SDL_GL_Enter2DMode() allows alpha blending
Sam Lantinga <slouken@libsdl.org>
parents:
234
diff
changeset
|
131 glEnable(GL_BLEND); |
cf4944faad96
Fixed testgl so that SDL_GL_Enter2DMode() allows alpha blending
Sam Lantinga <slouken@libsdl.org>
parents:
234
diff
changeset
|
132 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
cf4944faad96
Fixed testgl so that SDL_GL_Enter2DMode() allows alpha blending
Sam Lantinga <slouken@libsdl.org>
parents:
234
diff
changeset
|
133 |
233
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
134 glViewport(0, 0, screen->w, screen->h); |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
135 |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
136 glMatrixMode(GL_PROJECTION); |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
137 glPushMatrix(); |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
138 glLoadIdentity(); |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
139 |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
140 glOrtho(0.0, (GLdouble)screen->w, (GLdouble)screen->h, 0.0, 0.0, 1.0); |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
141 |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
142 glMatrixMode(GL_MODELVIEW); |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
143 glPushMatrix(); |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
144 glLoadIdentity(); |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
145 |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
146 glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
147 } |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
148 |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
149 void SDL_GL_Leave2DMode() |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
150 { |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
151 glMatrixMode(GL_MODELVIEW); |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
152 glPopMatrix(); |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
153 |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
154 glMatrixMode(GL_PROJECTION); |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
155 glPopMatrix(); |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
156 |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
157 glPopAttrib(); |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
158 } |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
159 |
234
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
160 /* Quick utility function for texture creation */ |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
161 static int power_of_two(int input) |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
162 { |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
163 int value = 1; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
164 |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
165 while ( value < input ) { |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
166 value <<= 1; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
167 } |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
168 return value; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
169 } |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
170 |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
171 GLuint SDL_GL_LoadTexture(SDL_Surface *surface, GLfloat *texcoord) |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
172 { |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
173 GLuint texture; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
174 int w, h; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
175 SDL_Surface *image; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
176 SDL_Rect area; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
177 Uint32 saved_flags; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
178 Uint8 saved_alpha; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
179 |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
180 /* Use the surface width and height expanded to powers of 2 */ |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
181 w = power_of_two(surface->w); |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
182 h = power_of_two(surface->h); |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
183 texcoord[0] = 0.0f; /* Min X */ |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
184 texcoord[1] = 0.0f; /* Min Y */ |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
185 texcoord[2] = (GLfloat)surface->w / w; /* Max X */ |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
186 texcoord[3] = (GLfloat)surface->h / h; /* Max Y */ |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
187 |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
188 image = SDL_CreateRGBSurface( |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
189 SDL_SWSURFACE, |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
190 w, h, |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
191 32, |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
192 #if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */ |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
193 0x000000FF, |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
194 0x0000FF00, |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
195 0x00FF0000, |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
196 0xFF000000 |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
197 #else |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
198 0xFF000000, |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
199 0x00FF0000, |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
200 0x0000FF00, |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
201 0x000000FF |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
202 #endif |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
203 ); |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
204 if ( image == NULL ) { |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
205 return 0; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
206 } |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
207 |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
208 /* Save the alpha blending attributes */ |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
209 saved_flags = surface->flags&(SDL_SRCALPHA|SDL_RLEACCELOK); |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
210 saved_alpha = surface->format->alpha; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
211 if ( (saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA ) { |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
212 SDL_SetAlpha(surface, 0, 0); |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
213 } |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
214 |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
215 /* Copy the surface into the GL texture image */ |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
216 area.x = 0; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
217 area.y = 0; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
218 area.w = surface->w; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
219 area.h = surface->h; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
220 SDL_BlitSurface(surface, &area, image, &area); |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
221 |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
222 /* Restore the alpha blending attributes */ |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
223 if ( (saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA ) { |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
224 SDL_SetAlpha(surface, saved_flags, saved_alpha); |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
225 } |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
226 |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
227 /* Create an OpenGL texture for the image */ |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
228 glGenTextures(1, &texture); |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
229 glBindTexture(GL_TEXTURE_2D, texture); |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
230 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
231 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
232 glTexImage2D(GL_TEXTURE_2D, |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
233 0, |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
234 GL_RGBA, |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
235 w, h, |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
236 0, |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
237 GL_RGBA, |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
238 GL_UNSIGNED_BYTE, |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
239 image->pixels); |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
240 SDL_FreeSurface(image); /* No longer needed */ |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
241 |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
242 return texture; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
243 } |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
244 |
933
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
245 void DrawLogoCursor(void) |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
246 { |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
247 static GLfloat texMinX, texMinY; |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
248 static GLfloat texMaxX, texMaxY; |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
249 static int w, h; |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
250 int x, y; |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
251 |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
252 if ( ! cursor_texture ) { |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
253 SDL_Surface *image; |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
254 GLfloat texcoord[4]; |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
255 |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
256 /* Load the image (could use SDL_image library here) */ |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
257 image = SDL_LoadBMP(LOGO_FILE); |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
258 if ( image == NULL ) { |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
259 return; |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
260 } |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
261 w = image->w; |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
262 h = image->h; |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
263 |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
264 /* Convert the image into an OpenGL texture */ |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
265 cursor_texture = SDL_GL_LoadTexture(image, texcoord); |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
266 |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
267 /* Make texture coordinates easy to understand */ |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
268 texMinX = texcoord[0]; |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
269 texMinY = texcoord[1]; |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
270 texMaxX = texcoord[2]; |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
271 texMaxY = texcoord[3]; |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
272 |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
273 /* We don't need the original image anymore */ |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
274 SDL_FreeSurface(image); |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
275 |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
276 /* Make sure that the texture conversion is okay */ |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
277 if ( ! cursor_texture ) { |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
278 return; |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
279 } |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
280 } |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
281 |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
282 /* Move the image around */ |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
283 SDL_GetMouseState(&x, &y); |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
284 x -= w/2; |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
285 y -= h/2; |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
286 |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
287 /* Show the image on the screen */ |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
288 SDL_GL_Enter2DMode(); |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
289 glBindTexture(GL_TEXTURE_2D, cursor_texture); |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
290 glBegin(GL_TRIANGLE_STRIP); |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
291 glTexCoord2f(texMinX, texMinY); glVertex2i(x, y ); |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
292 glTexCoord2f(texMaxX, texMinY); glVertex2i(x+w, y ); |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
293 glTexCoord2f(texMinX, texMaxY); glVertex2i(x, y+h); |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
294 glTexCoord2f(texMaxX, texMaxY); glVertex2i(x+w, y+h); |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
295 glEnd(); |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
296 SDL_GL_Leave2DMode(); |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
297 } |
492
c59692dcdce0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
363
diff
changeset
|
298 |
234
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
299 void DrawLogoTexture(void) |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
300 { |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
301 static GLfloat texMinX, texMinY; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
302 static GLfloat texMaxX, texMaxY; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
303 static int x = 0; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
304 static int y = 0; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
305 static int w, h; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
306 static int delta_x = 1; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
307 static int delta_y = 1; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
308 |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
309 SDL_Surface *screen = SDL_GetVideoSurface(); |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
310 |
492
c59692dcdce0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
363
diff
changeset
|
311 if ( ! global_texture ) { |
234
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
312 SDL_Surface *image; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
313 GLfloat texcoord[4]; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
314 |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
315 /* Load the image (could use SDL_image library here) */ |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
316 image = SDL_LoadBMP(LOGO_FILE); |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
317 if ( image == NULL ) { |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
318 return; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
319 } |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
320 w = image->w; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
321 h = image->h; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
322 |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
323 /* Convert the image into an OpenGL texture */ |
492
c59692dcdce0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
363
diff
changeset
|
324 global_texture = SDL_GL_LoadTexture(image, texcoord); |
234
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
325 |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
326 /* Make texture coordinates easy to understand */ |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
327 texMinX = texcoord[0]; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
328 texMinY = texcoord[1]; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
329 texMaxX = texcoord[2]; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
330 texMaxY = texcoord[3]; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
331 |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
332 /* We don't need the original image anymore */ |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
333 SDL_FreeSurface(image); |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
334 |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
335 /* Make sure that the texture conversion is okay */ |
492
c59692dcdce0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
363
diff
changeset
|
336 if ( ! global_texture ) { |
234
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
337 return; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
338 } |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
339 } |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
340 |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
341 /* Move the image around */ |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
342 x += delta_x; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
343 if ( x < 0 ) { |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
344 x = 0; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
345 delta_x = -delta_x; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
346 } else |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
347 if ( (x+w) > screen->w ) { |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
348 x = screen->w-w; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
349 delta_x = -delta_x; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
350 } |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
351 y += delta_y; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
352 if ( y < 0 ) { |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
353 y = 0; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
354 delta_y = -delta_y; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
355 } else |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
356 if ( (y+h) > screen->h ) { |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
357 y = screen->h-h; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
358 delta_y = -delta_y; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
359 } |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
360 |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
361 /* Show the image on the screen */ |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
362 SDL_GL_Enter2DMode(); |
492
c59692dcdce0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
363
diff
changeset
|
363 glBindTexture(GL_TEXTURE_2D, global_texture); |
234
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
364 glBegin(GL_TRIANGLE_STRIP); |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
365 glTexCoord2f(texMinX, texMinY); glVertex2i(x, y ); |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
366 glTexCoord2f(texMaxX, texMinY); glVertex2i(x+w, y ); |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
367 glTexCoord2f(texMinX, texMaxY); glVertex2i(x, y+h); |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
368 glTexCoord2f(texMaxX, texMaxY); glVertex2i(x+w, y+h); |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
369 glEnd(); |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
370 SDL_GL_Leave2DMode(); |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
371 } |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
372 |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
373 /* This code is deprecated, but available for speed comparisons */ |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
374 void DrawLogoBlit(void) |
0 | 375 { |
376 static int x = 0; | |
377 static int y = 0; | |
233
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
378 static int w, h; |
0 | 379 static int delta_x = 1; |
380 static int delta_y = 1; | |
381 | |
382 SDL_Rect dst; | |
234
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
383 SDL_Surface *screen = SDL_GetVideoSurface(); |
0 | 384 |
492
c59692dcdce0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
363
diff
changeset
|
385 if ( global_image == NULL ) { |
0 | 386 SDL_Surface *temp; |
387 | |
234
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
388 /* Load the image (could use SDL_image library here) */ |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
389 temp = SDL_LoadBMP(LOGO_FILE); |
0 | 390 if ( temp == NULL ) { |
391 return; | |
392 } | |
234
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
393 w = temp->w; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
394 h = temp->h; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
395 |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
396 /* Convert the image into the screen format */ |
492
c59692dcdce0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
363
diff
changeset
|
397 global_image = SDL_CreateRGBSurface( |
0 | 398 SDL_SWSURFACE, |
234
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
399 w, h, |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
400 screen->format->BitsPerPixel, |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
401 screen->format->Rmask, |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
402 screen->format->Gmask, |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
403 screen->format->Bmask, |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
404 screen->format->Amask); |
492
c59692dcdce0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
363
diff
changeset
|
405 if ( global_image ) { |
c59692dcdce0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
363
diff
changeset
|
406 SDL_BlitSurface(temp, NULL, global_image, NULL); |
0 | 407 } |
408 SDL_FreeSurface(temp); | |
234
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
409 |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
410 /* Make sure that the texture conversion is okay */ |
492
c59692dcdce0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
363
diff
changeset
|
411 if ( ! global_image ) { |
0 | 412 return; |
413 } | |
414 } | |
415 | |
234
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
416 /* Move the image around |
0 | 417 Note that we do not clear the old position. This is because we |
418 perform a glClear() which clears the framebuffer and then only | |
419 update the new area. | |
420 Note that you can also achieve interesting effects by modifying | |
421 the screen surface alpha channel. It's set to 255 by default.. | |
422 */ | |
234
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
423 x += delta_x; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
424 if ( x < 0 ) { |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
425 x = 0; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
426 delta_x = -delta_x; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
427 } else |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
428 if ( (x+w) > screen->w ) { |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
429 x = screen->w-w; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
430 delta_x = -delta_x; |
0 | 431 } |
234
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
432 y += delta_y; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
433 if ( y < 0 ) { |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
434 y = 0; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
435 delta_y = -delta_y; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
436 } else |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
437 if ( (y+h) > screen->h ) { |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
438 y = screen->h-h; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
439 delta_y = -delta_y; |
233
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
440 } |
234
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
441 dst.x = x; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
442 dst.y = y; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
443 dst.w = w; |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
444 dst.h = h; |
492
c59692dcdce0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
363
diff
changeset
|
445 SDL_BlitSurface(global_image, NULL, screen, &dst); |
234
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
446 |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
447 /* Show the image on the screen */ |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
448 SDL_UpdateRects(screen, 1, &dst); |
0 | 449 } |
450 | |
451 int RunGLTest( int argc, char* argv[], | |
1737 | 452 int logo, int logocursor, int slowly, int bpp, float gamma, int noframe, int fsaa, int sync, int accel ) |
0 | 453 { |
454 int i; | |
455 int rgb_size[3]; | |
456 int w = 640; | |
457 int h = 480; | |
458 int done = 0; | |
459 int frames; | |
460 Uint32 start_time, this_time; | |
461 float color[8][3]= {{ 1.0, 1.0, 0.0}, | |
462 { 1.0, 0.0, 0.0}, | |
463 { 0.0, 0.0, 0.0}, | |
464 { 0.0, 1.0, 0.0}, | |
465 { 0.0, 1.0, 1.0}, | |
466 { 1.0, 1.0, 1.0}, | |
467 { 1.0, 0.0, 1.0}, | |
468 { 0.0, 0.0, 1.0}}; | |
469 float cube[8][3]= {{ 0.5, 0.5, -0.5}, | |
470 { 0.5, -0.5, -0.5}, | |
471 {-0.5, -0.5, -0.5}, | |
472 {-0.5, 0.5, -0.5}, | |
473 {-0.5, 0.5, 0.5}, | |
474 { 0.5, 0.5, 0.5}, | |
475 { 0.5, -0.5, 0.5}, | |
476 {-0.5, -0.5, 0.5}}; | |
477 Uint32 video_flags; | |
478 int value; | |
479 | |
480 if( SDL_Init( SDL_INIT_VIDEO ) < 0 ) { | |
481 fprintf(stderr,"Couldn't initialize SDL: %s\n",SDL_GetError()); | |
482 exit( 1 ); | |
483 } | |
484 | |
485 /* See if we should detect the display depth */ | |
486 if ( bpp == 0 ) { | |
487 if ( SDL_GetVideoInfo()->vfmt->BitsPerPixel <= 8 ) { | |
488 bpp = 8; | |
489 } else { | |
490 bpp = 16; /* More doesn't seem to work */ | |
491 } | |
492 } | |
493 | |
494 /* Set the flags we want to use for setting the video mode */ | |
233
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
495 if ( logo && USE_DEPRECATED_OPENGLBLIT ) { |
0 | 496 video_flags = SDL_OPENGLBLIT; |
497 } else { | |
498 video_flags = SDL_OPENGL; | |
499 } | |
500 for ( i=1; argv[i]; ++i ) { | |
1265
670e74bf5cc8
Date: Mon, 22 Sep 2003 23:31:54 -0700 (PDT)
Sam Lantinga <slouken@libsdl.org>
parents:
933
diff
changeset
|
501 if ( strcmp(argv[i], "-fullscreen") == 0 ) { |
0 | 502 video_flags |= SDL_FULLSCREEN; |
503 } | |
504 } | |
505 | |
320
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
243
diff
changeset
|
506 if (noframe) { |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
243
diff
changeset
|
507 video_flags |= SDL_NOFRAME; |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
243
diff
changeset
|
508 } |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
243
diff
changeset
|
509 |
0 | 510 /* Initialize the display */ |
511 switch (bpp) { | |
512 case 8: | |
363
ca0b4ba5313e
Date: Thu, 18 Apr 2002 13:50:53 -0700
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
513 rgb_size[0] = 3; |
0 | 514 rgb_size[1] = 3; |
363
ca0b4ba5313e
Date: Thu, 18 Apr 2002 13:50:53 -0700
Sam Lantinga <slouken@libsdl.org>
parents:
320
diff
changeset
|
515 rgb_size[2] = 2; |
0 | 516 break; |
517 case 15: | |
518 case 16: | |
519 rgb_size[0] = 5; | |
520 rgb_size[1] = 5; | |
521 rgb_size[2] = 5; | |
522 break; | |
523 default: | |
524 rgb_size[0] = 8; | |
525 rgb_size[1] = 8; | |
526 rgb_size[2] = 8; | |
527 break; | |
528 } | |
529 SDL_GL_SetAttribute( SDL_GL_RED_SIZE, rgb_size[0] ); | |
530 SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, rgb_size[1] ); | |
531 SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, rgb_size[2] ); | |
532 SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 ); | |
533 SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); | |
655
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
492
diff
changeset
|
534 if ( fsaa ) { |
656
864e2d2a9a55
Merged in Ryan's multisample code for MacOS, and changed the constants to match.
Sam Lantinga <slouken@libsdl.org>
parents:
655
diff
changeset
|
535 SDL_GL_SetAttribute( SDL_GL_MULTISAMPLEBUFFERS, 1 ); |
864e2d2a9a55
Merged in Ryan's multisample code for MacOS, and changed the constants to match.
Sam Lantinga <slouken@libsdl.org>
parents:
655
diff
changeset
|
536 SDL_GL_SetAttribute( SDL_GL_MULTISAMPLESAMPLES, fsaa ); |
655
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
492
diff
changeset
|
537 } |
1737 | 538 if ( accel ) { |
539 SDL_GL_SetAttribute( SDL_GL_ACCELERATED_VISUAL, 1 ); | |
540 } | |
1736
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1439
diff
changeset
|
541 if ( sync ) { |
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1439
diff
changeset
|
542 SDL_GL_SetAttribute( SDL_GL_SWAP_CONTROL, 1 ); |
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1439
diff
changeset
|
543 } else { |
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1439
diff
changeset
|
544 SDL_GL_SetAttribute( SDL_GL_SWAP_CONTROL, 0 ); |
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1439
diff
changeset
|
545 } |
0 | 546 if ( SDL_SetVideoMode( w, h, bpp, video_flags ) == NULL ) { |
547 fprintf(stderr, "Couldn't set GL mode: %s\n", SDL_GetError()); | |
548 SDL_Quit(); | |
549 exit(1); | |
550 } | |
551 | |
552 printf("Screen BPP: %d\n", SDL_GetVideoSurface()->format->BitsPerPixel); | |
553 printf("\n"); | |
554 printf( "Vendor : %s\n", glGetString( GL_VENDOR ) ); | |
555 printf( "Renderer : %s\n", glGetString( GL_RENDERER ) ); | |
556 printf( "Version : %s\n", glGetString( GL_VERSION ) ); | |
557 printf( "Extensions : %s\n", glGetString( GL_EXTENSIONS ) ); | |
558 printf("\n"); | |
559 | |
560 SDL_GL_GetAttribute( SDL_GL_RED_SIZE, &value ); | |
561 printf( "SDL_GL_RED_SIZE: requested %d, got %d\n", rgb_size[0],value); | |
562 SDL_GL_GetAttribute( SDL_GL_GREEN_SIZE, &value ); | |
563 printf( "SDL_GL_GREEN_SIZE: requested %d, got %d\n", rgb_size[1],value); | |
564 SDL_GL_GetAttribute( SDL_GL_BLUE_SIZE, &value ); | |
565 printf( "SDL_GL_BLUE_SIZE: requested %d, got %d\n", rgb_size[2],value); | |
566 SDL_GL_GetAttribute( SDL_GL_DEPTH_SIZE, &value ); | |
567 printf( "SDL_GL_DEPTH_SIZE: requested %d, got %d\n", bpp, value ); | |
568 SDL_GL_GetAttribute( SDL_GL_DOUBLEBUFFER, &value ); | |
569 printf( "SDL_GL_DOUBLEBUFFER: requested 1, got %d\n", value ); | |
655
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
492
diff
changeset
|
570 if ( fsaa ) { |
656
864e2d2a9a55
Merged in Ryan's multisample code for MacOS, and changed the constants to match.
Sam Lantinga <slouken@libsdl.org>
parents:
655
diff
changeset
|
571 SDL_GL_GetAttribute( SDL_GL_MULTISAMPLEBUFFERS, &value ); |
1736
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1439
diff
changeset
|
572 printf("SDL_GL_MULTISAMPLEBUFFERS: requested 1, got %d\n", value ); |
656
864e2d2a9a55
Merged in Ryan's multisample code for MacOS, and changed the constants to match.
Sam Lantinga <slouken@libsdl.org>
parents:
655
diff
changeset
|
573 SDL_GL_GetAttribute( SDL_GL_MULTISAMPLESAMPLES, &value ); |
1736
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1439
diff
changeset
|
574 printf("SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d\n", fsaa, value ); |
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1439
diff
changeset
|
575 } |
1737 | 576 if ( accel ) { |
577 SDL_GL_GetAttribute( SDL_GL_ACCELERATED_VISUAL, &value ); | |
578 printf( "SDL_GL_ACCELERATED_VISUAL: requested 1, got %d\n", value ); | |
579 } | |
1736
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1439
diff
changeset
|
580 if ( sync ) { |
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1439
diff
changeset
|
581 SDL_GL_GetAttribute( SDL_GL_SWAP_CONTROL, &value ); |
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1439
diff
changeset
|
582 printf( "SDL_GL_SWAP_CONTROL: requested 1, got %d\n", value ); |
655
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
492
diff
changeset
|
583 } |
0 | 584 |
585 /* Set the window manager title bar */ | |
586 SDL_WM_SetCaption( "SDL GL test", "testgl" ); | |
587 | |
588 /* Set the gamma for the window */ | |
589 if ( gamma != 0.0 ) { | |
590 SDL_SetGamma(gamma, gamma, gamma); | |
591 } | |
592 | |
593 glViewport( 0, 0, w, h ); | |
594 glMatrixMode( GL_PROJECTION ); | |
595 glLoadIdentity( ); | |
596 | |
597 glOrtho( -2.0, 2.0, -2.0, 2.0, -20.0, 20.0 ); | |
598 | |
599 glMatrixMode( GL_MODELVIEW ); | |
600 glLoadIdentity( ); | |
601 | |
602 glEnable(GL_DEPTH_TEST); | |
603 | |
604 glDepthFunc(GL_LESS); | |
605 | |
606 glShadeModel(GL_SMOOTH); | |
607 | |
608 /* Loop until done. */ | |
609 start_time = SDL_GetTicks(); | |
610 frames = 0; | |
611 while( !done ) { | |
612 GLenum gl_error; | |
613 char* sdl_error; | |
614 SDL_Event event; | |
615 | |
616 /* Do our drawing, too. */ | |
617 glClearColor( 0.0, 0.0, 0.0, 1.0 ); | |
618 glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); | |
619 | |
620 glBegin( GL_QUADS ); | |
621 | |
622 #ifdef SHADED_CUBE | |
623 glColor3fv(color[0]); | |
624 glVertex3fv(cube[0]); | |
625 glColor3fv(color[1]); | |
626 glVertex3fv(cube[1]); | |
627 glColor3fv(color[2]); | |
628 glVertex3fv(cube[2]); | |
629 glColor3fv(color[3]); | |
630 glVertex3fv(cube[3]); | |
631 | |
632 glColor3fv(color[3]); | |
633 glVertex3fv(cube[3]); | |
634 glColor3fv(color[4]); | |
635 glVertex3fv(cube[4]); | |
636 glColor3fv(color[7]); | |
637 glVertex3fv(cube[7]); | |
638 glColor3fv(color[2]); | |
639 glVertex3fv(cube[2]); | |
640 | |
641 glColor3fv(color[0]); | |
642 glVertex3fv(cube[0]); | |
643 glColor3fv(color[5]); | |
644 glVertex3fv(cube[5]); | |
645 glColor3fv(color[6]); | |
646 glVertex3fv(cube[6]); | |
647 glColor3fv(color[1]); | |
648 glVertex3fv(cube[1]); | |
649 | |
650 glColor3fv(color[5]); | |
651 glVertex3fv(cube[5]); | |
652 glColor3fv(color[4]); | |
653 glVertex3fv(cube[4]); | |
654 glColor3fv(color[7]); | |
655 glVertex3fv(cube[7]); | |
656 glColor3fv(color[6]); | |
657 glVertex3fv(cube[6]); | |
658 | |
659 glColor3fv(color[5]); | |
660 glVertex3fv(cube[5]); | |
661 glColor3fv(color[0]); | |
662 glVertex3fv(cube[0]); | |
663 glColor3fv(color[3]); | |
664 glVertex3fv(cube[3]); | |
665 glColor3fv(color[4]); | |
666 glVertex3fv(cube[4]); | |
667 | |
668 glColor3fv(color[6]); | |
669 glVertex3fv(cube[6]); | |
670 glColor3fv(color[1]); | |
671 glVertex3fv(cube[1]); | |
672 glColor3fv(color[2]); | |
673 glVertex3fv(cube[2]); | |
674 glColor3fv(color[7]); | |
675 glVertex3fv(cube[7]); | |
1439
4d3bb026cd16
Fixed warnings in -pedantic mode
Sam Lantinga <slouken@libsdl.org>
parents:
1265
diff
changeset
|
676 #else /* flat cube */ |
0 | 677 glColor3f(1.0, 0.0, 0.0); |
678 glVertex3fv(cube[0]); | |
679 glVertex3fv(cube[1]); | |
680 glVertex3fv(cube[2]); | |
681 glVertex3fv(cube[3]); | |
682 | |
683 glColor3f(0.0, 1.0, 0.0); | |
684 glVertex3fv(cube[3]); | |
685 glVertex3fv(cube[4]); | |
686 glVertex3fv(cube[7]); | |
687 glVertex3fv(cube[2]); | |
688 | |
689 glColor3f(0.0, 0.0, 1.0); | |
690 glVertex3fv(cube[0]); | |
691 glVertex3fv(cube[5]); | |
692 glVertex3fv(cube[6]); | |
693 glVertex3fv(cube[1]); | |
694 | |
695 glColor3f(0.0, 1.0, 1.0); | |
696 glVertex3fv(cube[5]); | |
697 glVertex3fv(cube[4]); | |
698 glVertex3fv(cube[7]); | |
699 glVertex3fv(cube[6]); | |
700 | |
701 glColor3f(1.0, 1.0, 0.0); | |
702 glVertex3fv(cube[5]); | |
703 glVertex3fv(cube[0]); | |
704 glVertex3fv(cube[3]); | |
705 glVertex3fv(cube[4]); | |
706 | |
707 glColor3f(1.0, 0.0, 1.0); | |
708 glVertex3fv(cube[6]); | |
709 glVertex3fv(cube[1]); | |
710 glVertex3fv(cube[2]); | |
711 glVertex3fv(cube[7]); | |
712 #endif /* SHADED_CUBE */ | |
713 | |
714 glEnd( ); | |
715 | |
716 glMatrixMode(GL_MODELVIEW); | |
717 glRotatef(5.0, 1.0, 1.0, 1.0); | |
718 | |
719 /* Draw 2D logo onto the 3D display */ | |
720 if ( logo ) { | |
234
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
721 if ( USE_DEPRECATED_OPENGLBLIT ) { |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
722 DrawLogoBlit(); |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
723 } else { |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
724 DrawLogoTexture(); |
1af4be6a73cd
Modified the logo texture load to accept any width/height image
Sam Lantinga <slouken@libsdl.org>
parents:
233
diff
changeset
|
725 } |
0 | 726 } |
933
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
727 if ( logocursor ) { |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
728 DrawLogoCursor(); |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
729 } |
0 | 730 |
731 SDL_GL_SwapBuffers( ); | |
732 | |
733 /* Check for error conditions. */ | |
734 gl_error = glGetError( ); | |
735 | |
736 if( gl_error != GL_NO_ERROR ) { | |
737 fprintf( stderr, "testgl: OpenGL error: %d\n", gl_error ); | |
738 } | |
739 | |
740 sdl_error = SDL_GetError( ); | |
741 | |
742 if( sdl_error[0] != '\0' ) { | |
743 fprintf(stderr, "testgl: SDL error '%s'\n", sdl_error); | |
744 SDL_ClearError(); | |
745 } | |
746 | |
747 /* Allow the user to see what's happening */ | |
748 if ( slowly ) { | |
749 SDL_Delay( 20 ); | |
750 } | |
751 | |
752 /* Check if there's a pending event. */ | |
753 while( SDL_PollEvent( &event ) ) { | |
754 done = HandleEvent(&event); | |
755 } | |
756 ++frames; | |
757 } | |
758 | |
759 /* Print out the frames per second */ | |
760 this_time = SDL_GetTicks(); | |
761 if ( this_time != start_time ) { | |
762 printf("%2.2f FPS\n", | |
763 ((float)frames/(this_time-start_time))*1000.0); | |
764 } | |
765 | |
492
c59692dcdce0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
363
diff
changeset
|
766 if ( global_image ) { |
c59692dcdce0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
363
diff
changeset
|
767 SDL_FreeSurface(global_image); |
c59692dcdce0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
363
diff
changeset
|
768 global_image = NULL; |
c59692dcdce0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
363
diff
changeset
|
769 } |
c59692dcdce0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
363
diff
changeset
|
770 if ( global_texture ) { |
c59692dcdce0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
363
diff
changeset
|
771 glDeleteTextures( 1, &global_texture ); |
c59692dcdce0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
363
diff
changeset
|
772 global_texture = 0; |
c59692dcdce0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
363
diff
changeset
|
773 } |
933
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
774 if ( cursor_texture ) { |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
775 glDeleteTextures( 1, &cursor_texture ); |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
776 cursor_texture = 0; |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
777 } |
492
c59692dcdce0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
363
diff
changeset
|
778 |
0 | 779 /* Destroy our GL context, etc. */ |
780 SDL_Quit( ); | |
781 return(0); | |
782 } | |
783 | |
784 int main(int argc, char *argv[]) | |
785 { | |
1439
4d3bb026cd16
Fixed warnings in -pedantic mode
Sam Lantinga <slouken@libsdl.org>
parents:
1265
diff
changeset
|
786 int i, logo, logocursor = 0; |
0 | 787 int numtests; |
788 int bpp = 0; | |
789 int slowly; | |
790 float gamma = 0.0; | |
492
c59692dcdce0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
363
diff
changeset
|
791 int noframe = 0; |
655
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
492
diff
changeset
|
792 int fsaa = 0; |
1737 | 793 int accel = 0; |
1736
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1439
diff
changeset
|
794 int sync = 0; |
0 | 795 |
796 logo = 0; | |
797 slowly = 0; | |
798 numtests = 1; | |
799 for ( i=1; argv[i]; ++i ) { | |
800 if ( strcmp(argv[i], "-twice") == 0 ) { | |
801 ++numtests; | |
802 } | |
803 if ( strcmp(argv[i], "-logo") == 0 ) { | |
804 logo = 1; | |
233
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
805 USE_DEPRECATED_OPENGLBLIT = SDL_FALSE; |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
806 } |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
807 if ( strcmp(argv[i], "-logoblit") == 0 ) { |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
808 logo = 1; |
5b42a7f5fab3
SDL_OPENGLBLIT is deprecated, show the "right way" of doing things
Sam Lantinga <slouken@libsdl.org>
parents:
221
diff
changeset
|
809 USE_DEPRECATED_OPENGLBLIT = SDL_TRUE; |
0 | 810 } |
933
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
811 if ( strcmp(argv[i], "-logocursor") == 0 ) { |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
812 logocursor = 1; |
4272450dd8d0
Added an option to show the logo at the cursor position for debugging
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
813 } |
0 | 814 if ( strcmp(argv[i], "-slow") == 0 ) { |
815 slowly = 1; | |
816 } | |
817 if ( strcmp(argv[i], "-bpp") == 0 ) { | |
818 bpp = atoi(argv[++i]); | |
819 } | |
820 if ( strcmp(argv[i], "-gamma") == 0 ) { | |
821 gamma = (float)atof(argv[++i]); | |
822 } | |
320
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
243
diff
changeset
|
823 if ( strcmp(argv[i], "-noframe") == 0 ) { |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
243
diff
changeset
|
824 noframe = 1; |
66f815c147ed
Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
243
diff
changeset
|
825 } |
655
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
492
diff
changeset
|
826 if ( strcmp(argv[i], "-fsaa") == 0 ) { |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
492
diff
changeset
|
827 ++fsaa; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
492
diff
changeset
|
828 } |
1737 | 829 if ( strcmp(argv[i], "-accel") == 0 ) { |
830 ++accel; | |
831 } | |
1736
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1439
diff
changeset
|
832 if ( strcmp(argv[i], "-sync") == 0 ) { |
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1439
diff
changeset
|
833 ++sync; |
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1439
diff
changeset
|
834 } |
0 | 835 if ( strncmp(argv[i], "-h", 2) == 0 ) { |
836 printf( | |
1880 | 837 "Usage: %s [-twice] [-logo] [-logocursor] [-slow] [-bpp n] [-gamma n] [-noframe] [-fsaa] [-accel] [-sync] [-fullscreen]\n", |
0 | 838 argv[0]); |
839 exit(0); | |
840 } | |
841 } | |
842 for ( i=0; i<numtests; ++i ) { | |
1737 | 843 RunGLTest(argc, argv, logo, logocursor, slowly, bpp, gamma, noframe, fsaa, sync, accel); |
0 | 844 } |
845 return 0; | |
846 } | |
847 | |
848 #else /* HAVE_OPENGL */ | |
849 | |
850 int main(int argc, char *argv[]) | |
851 { | |
852 printf("No OpenGL support on this system\n"); | |
853 return 1; | |
854 } | |
855 | |
856 #endif /* HAVE_OPENGL */ |