858474f6c91681e6b496c0c44afd183ea0edbbeb
[supertux.git] / contrib / supertux-nogl.diff
1 #
2 #  SuperTux -nogl patch
3 #  Copyright (C) 2006 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.de>
4 #
5 #  This program is free software; you can redistribute it and/or
6 #  modify it under the terms of the GNU General Public License
7 #  as published by the Free Software Foundation; either version 2
8 #  of the License, or (at your option) any later version.
9 #
10 #  This program is distributed in the hope that it will be useful,
11 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 #  GNU General Public License for more details.
14 #
15 #  You should have received a copy of the GNU General Public License
16 #  along with this program; if not, write to the Free Software
17 #  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18 #
19 # -----------------------------------------------------------------------------
20 #
21 #  This patch allows running the game on systems without OpenGL support. 
22 #
23 #  It modifies the video portion of the SuperTux engine to render all graphics
24 #  with SDL functions only. Many features are removed from the video engine,
25 #  so don't expect much.
26 #
27 #  Note that the patched sources will need an additional library, SDL_gfx, to 
28 #  compile.
29 #
30 #  Installing the patch should be pretty straightforward. Simply run the
31 #  following command prior to running autogen.sh and configure:
32 #
33 #  patch -p1 < contrib/supertux-nogl.diff
34 #
35 #  This patch works for revision 4186. It may break for later revisions.
36 #
37 # -----------------------------------------------------------------------------
38 diff -Naur supertux/INSTALL supertux-nogl/INSTALL
39 --- supertux/INSTALL    2006-03-03 21:49:07.000000000 +0100
40 +++ supertux-nogl/INSTALL       2006-04-07 04:13:00.000000000 +0200
41 @@ -1,7 +1,7 @@
42  - Install instructions for SuperTux -
43  http://supertux.berlios.de/
44  
45 -Last update: October 11, 2005 by Ondra Hosek
46 +Last update: March 4, 2006 by Christoph Sommer
47  
48  BINARIES
49  --------
50 @@ -34,17 +34,15 @@
51      Download: ftp://ftp.perforce.com/pub/jam
52      Homepage: http://www.perforce.com/jam/jam.html
53  
54 -* OpenGL headers and libraries
55 -    opengl libraries and headers are specific to your graphics card. Make sure
56 -    that you have hardware accelerated opengl drivers installed. Software
57 -    renderers like Mesa will make supertux unplayable slow.
58 -
59  * SDL 1.2.5 or later (1.2.8 is recommended on MacOS/X)
60      http://www.libsdl.org
61  
62  * SDL_image (any version)
63      http://www.libsdl.org/projects/SDL_image
64  
65 +* SDL_gfx (2.0.13 or later)
66 +    http://www.ferzkopp.net/Software/SDL_gfx-2.0/
67 +
68  * PhysicsFS (1.0.0, the development branch 1.1.x is buggy and does not work,
69               1.2.0 and later should work when it is released)
70      http://www.icculus.org/physfs
71 diff -Naur supertux/README supertux-nogl/README
72 --- supertux/README     2006-03-03 20:43:38.000000000 +0100
73 +++ supertux-nogl/README        2006-04-07 04:13:00.000000000 +0200
74 @@ -2,7 +2,7 @@
75  - An introduction for SuperTux -
76  http://supertux.berlios.de/
77  
78 -Last update: October 13, 2005
79 +Last update: March 4, 2006 by Christoph Sommer
80  
81  DESCRIPTION
82  -----------
83 @@ -75,10 +75,9 @@
84    Also, notice that SuperTux saves the options, so it's often enough to
85    specify them once.
86  
87 -  The game uses OpenGL to render the graphics. You will either need a CPU
88 -  with about 10 GHz or an accelerated video card with the vendor's drivers.
89 -  (On Linux, the team recommends using cards from NVidia with the proprietary
90 -  drivers, but ATI or another verndor should do.)
91 +  The game uses SDL to render the graphics. You will either need a CPU
92 +  with about 1 GHz or go get the original version of SuperTux which uses
93 +  OpenGL.
94  
95  
96  PLAYING THE GAME
97 diff -Naur supertux/configure.ac supertux-nogl/configure.ac
98 --- supertux/configure.ac       2006-03-03 20:43:38.000000000 +0100
99 +++ supertux-nogl/configure.ac  2006-04-07 04:13:00.000000000 +0200
100 @@ -11,7 +11,7 @@
101  
102  dnl Process this file with autoconf to produce a configure script.
103  AC_PREREQ([2.54])
104 -AC_INIT(supertux, 0.2-svn)
105 +AC_INIT(supertux, 0.2-nogl-svn)
106  AC_CONFIG_SRCDIR([src/main.cpp])
107  AC_CONFIG_AUX_DIR([mk/autoconf])
108  AC_CANONICAL_TARGET
109 @@ -120,6 +120,14 @@
110          [AC_MSG_ERROR([Please install SDLImage >= 1.2.1])],
111          [$SDL_CFLAGS], [$SDL_LIBS])
112  
113 +dnl FIXME: This is far from perfect
114 +NP_FINDLIB([SDLGFX], [SDL_gfx], [SDL_gfx >= 2.0.13],
115 +        NP_LANG_PROGRAM([#include <SDL_rotozoom.h>], [0;]),
116 +        [], [-lSDL_gfx],
117 +        [],
118 +        [AC_MSG_ERROR([Please install SDL_gfx >= 2.0.13])],
119 +        [$SDL_CFLAGS], [$SDL_LIBS])
120 +
121  NP_FINDLIB([PHYSFS], [physfs], [physfs >= 1.0.0],
122          NP_LANG_PROGRAM([
123  #include <stdio.h>
124 @@ -139,11 +147,6 @@
125           [AC_MSG_ERROR([Please intall OpenAL])],
126           [], [])
127  
128 -AX_CHECK_GL
129 -if test "$no_gl" = "yes"; then
130 -  AC_MSG_ERROR([Please install opengl libraries and headers])
131 -fi
132 -
133  dnl Checks for library functions.
134  AC_CHECK_FUNCS(mkdir strdup strstr)
135  
136 diff -Naur supertux/src/Jamfile supertux-nogl/src/Jamfile
137 --- supertux/src/Jamfile        2006-03-03 20:34:49.000000000 +0100
138 +++ supertux-nogl/src/Jamfile   2006-04-07 04:11:50.000000000 +0200
139 @@ -26,7 +26,7 @@
140  Application supertux : $(sources) $(wrapper_objects) : linkerfile ;
141  C++Flags supertux : -DAPPDATADIR='\"$(appdatadir)\"' ;
142  LinkWith supertux : squirrel ;
143 -ExternalLibs supertux : SDL SDLIMAGE GL OPENAL VORBIS VORBISFILE OGG ICONV PHYSFS BINRELOC ;
144 +ExternalLibs supertux : SDL SDLIMAGE SDLGFX OPENAL VORBIS VORBISFILE OGG ICONV PHYSFS BINRELOC ;
145  Help supertux : "Build the supertux executable" ;
146  IncludeDir supertux : squirrel/include squirrel ;
147  
148 diff -Naur supertux/src/main.cpp supertux-nogl/src/main.cpp
149 --- supertux/src/main.cpp       2006-04-07 03:32:14.000000000 +0200
150 +++ supertux-nogl/src/main.cpp  2006-04-07 04:11:50.000000000 +0200
151 @@ -35,7 +35,6 @@
152  #include <physfs.h>
153  #include <SDL.h>
154  #include <SDL_image.h>
155 -#include <GL/gl.h>
156  
157  #include "gameconfig.hpp"
158  #include "resources.hpp"
159 @@ -308,7 +307,7 @@
160    SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
161    SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
162  
163 -  int flags = SDL_OPENGL;
164 +  int flags = SDL_SWSURFACE;
165    if(config->use_fullscreen)
166      flags |= SDL_FULLSCREEN;
167    int width = config->screenwidth;
168 @@ -338,24 +337,6 @@
169    }
170  #endif
171  
172 -  // setup opengl state and transform
173 -  glDisable(GL_DEPTH_TEST);
174 -  glDisable(GL_CULL_FACE);
175 -  glEnable(GL_TEXTURE_2D);
176 -  glEnable(GL_BLEND);
177 -  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
178 -
179 -  glViewport(0, 0, screen->w, screen->h);
180 -  glMatrixMode(GL_PROJECTION);
181 -  glLoadIdentity();
182 -  // logical resolution here not real monitor resolution
183 -  glOrtho(0, 800, 600, 0, -1.0, 1.0);
184 -  glMatrixMode(GL_MODELVIEW);
185 -  glLoadIdentity();
186 -  glTranslatef(0, 0, 0);
187 -
188 -  check_gl_error("Setting up view matrices");
189 -
190    if(texture_manager != NULL)
191      texture_manager->reload_textures();
192    else
193 diff -aur supertux/src/video/drawing_context.cpp supertux-nogl/src/video/drawing_context.cpp
194 --- supertux/src/video/drawing_context.cpp      2006-07-03 02:00:48.000000000 +0200
195 +++ supertux-nogl/src/video/drawing_context.cpp 2006-07-03 02:00:29.000000000 +0200
196 @@ -23,7 +23,6 @@
197  #include <cassert>
198  #include <iostream>
199  #include <SDL_image.h>
200 -#include <GL/gl.h>
201  
202  #include "drawing_context.hpp"
203  #include "surface.hpp"
204 @@ -49,24 +48,12 @@
205  {
206    screen = SDL_GetVideoSurface();
207  
208 -  lightmap_width = screen->w / LIGHTMAP_DIV;
209 -  lightmap_height = screen->h / LIGHTMAP_DIV;
210 -  unsigned int width = next_po2(lightmap_width);
211 -  unsigned int height = next_po2(lightmap_height);
212 -
213 -  lightmap = new Texture(width, height, GL_RGB);
214 -
215 -  lightmap_uv_right = static_cast<float>(lightmap_width) / static_cast<float>(width);
216 -  lightmap_uv_bottom = static_cast<float>(lightmap_height) / static_cast<float>(height);
217 -  texture_manager->register_texture(lightmap);
218 -
219 +  target = NORMAL;
220    requests = &drawing_requests;
221  }
222  
223  DrawingContext::~DrawingContext()
224  {
225 -  texture_manager->remove_texture(lightmap);
226 -  delete lightmap;
227  }
228  
229  void
230 @@ -74,6 +61,8 @@
231                               float angle, const Color& color, const Blend& blend,
232                               int layer)
233  {
234 +  if(target != NORMAL) return;
235 +
236    assert(surface != 0);
237  
238    DrawingRequest request;
239 @@ -109,6 +98,8 @@
240  DrawingContext::draw_surface_part(const Surface* surface, const Vector& source,
241      const Vector& size, const Vector& dest, int layer)
242  {
243 +  if(target != NORMAL) return;
244 +
245    assert(surface != 0);
246  
247    DrawingRequest request;
248 @@ -148,6 +139,8 @@
249  DrawingContext::draw_text(const Font* font, const std::string& text,
250      const Vector& position, FontAlignment alignment, int layer)
251  {
252 +  if(target != NORMAL) return;
253 +
254    DrawingRequest request;
255  
256    request.type = TEXT;
257 @@ -169,6 +162,8 @@
258  DrawingContext::draw_center_text(const Font* font, const std::string& text,
259      const Vector& position, int layer)
260  {
261 +  if(target != NORMAL) return;
262 +
263    draw_text(font, text, Vector(position.x + SCREEN_WIDTH/2, position.y),
264        CENTER_ALLIGN, layer);
265  }
266 @@ -176,6 +171,8 @@
267  void
268  DrawingContext::draw_gradient(const Color& top, const Color& bottom, int layer)
269  {
270 +  if(target != NORMAL) return;
271 +
272    DrawingRequest request;
273  
274    request.type = GRADIENT;
275 @@ -197,6 +194,8 @@
276  DrawingContext::draw_filled_rect(const Vector& topleft, const Vector& size,
277                                   const Color& color, int layer)
278  {
279 +  if(target != NORMAL) return;
280 +
281    DrawingRequest request;
282  
283    request.type = FILLRECT;
284 @@ -219,6 +218,8 @@
285  DrawingContext::draw_filled_rect(const Rect& rect, const Color& color,
286                                   int layer)
287  {
288 +  if(target != NORMAL) return;
289 +
290    DrawingRequest request;
291  
292    request.type = FILLRECT;
293 @@ -238,39 +239,14 @@
294  }
295  
296  void
297 -DrawingContext::get_light(const Vector& position, Color* color)
298 +DrawingContext::get_light(const Vector& , Color* color)
299  {
300 -  if( ambient_color.red == 1.0f && ambient_color.green == 1.0f
301 -      && ambient_color.blue  == 1.0f ) {
302 -    *color = Color( 1.0f, 1.0f, 1.0f);
303 -    return;
304 -  }
305 -  DrawingRequest request;
306 -  request.type = GETLIGHT;
307 -  request.pos = transform.apply(position);
308 -  request.layer = LAYER_GUI; //make sure all get_light requests are handled last.
309 -
310 -  GetLightRequest* getlightrequest = new GetLightRequest;
311 -  getlightrequest->color_ptr = color;
312 -  request.request_data = getlightrequest;
313 -  lightmap_requests.push_back(request);
314 +  *color = Color(1.0f, 1.0f, 1.0f);
315  }
316  
317  void
318 -DrawingContext::get_light(DrawingRequest& request)
319 +DrawingContext::get_light(DrawingRequest& )
320  {
321 -  GetLightRequest* getlightrequest = (GetLightRequest*) request.request_data;
322 -
323 -  float pixels[3];
324 -  for( int i = 0; i<3; i++)
325 -    pixels[i] = 0.0f; //set to black
326 -
327 -  //TODO: hacky. Make coordinate conversion more generic
328 -  glReadPixels((GLint) request.pos.x / 4, 600-(GLint)request.pos.y / 4, 1, 1, GL_RGB, GL_FLOAT, pixels);
329 -  *(getlightrequest->color_ptr) = Color( pixels[0], pixels[1], pixels[2]);
330 -  //printf("get_light %f/%f r%f g%f b%f\n", request.pos.x, request.pos.y, pixels[0], pixels[1], pixels[2]);
331 -
332 -  delete getlightrequest;
333  }
334  
335  void
336 @@ -288,6 +264,45 @@
337    delete surfacepartrequest;
338  }
339  
340 +namespace
341 +{
342 +  void fillrect(SDL_Surface* screen, float x, float y, float w, float h, int r, int g, int b, int a)
343 +  {
344 +    if(w < 0) {
345 +      x += w;
346 +      w = -w;
347 +    }
348 +    if(h < 0) {
349 +      y += h;
350 +      h = -h;
351 +    }
352 +
353 +    SDL_Rect src, rect;
354 +    SDL_Surface *temp = NULL;
355 +
356 +    rect.x = (int)x;
357 +    rect.y = (int)y;
358 +    rect.w = (int)w;
359 +    rect.h = (int)h;
360 +
361 +    if(a != 255) {
362 +      temp = SDL_CreateRGBSurface(screen->flags, rect.w, rect.h, screen->format->BitsPerPixel, screen->format->Rmask, screen->format->Gmask, screen->format->Bmask, screen->format->Amask);
363 +
364 +      src.x = 0;
365 +      src.y = 0;
366 +      src.w = rect.w;
367 +      src.h = rect.h;
368 +
369 +      SDL_FillRect(temp, &src, SDL_MapRGB(screen->format, r, g, b));
370 +      SDL_SetAlpha(temp, SDL_SRCALPHA, a);
371 +      SDL_BlitSurface(temp,0,screen,&rect);
372 +      SDL_FreeSurface(temp);
373 +    } else {
374 +      SDL_FillRect(screen, &rect, SDL_MapRGB(screen->format, r, g, b));
375 +    }
376 +  }
377 +}
378 +
379  void
380  DrawingContext::draw_gradient(DrawingRequest& request)
381  {
382 @@ -295,16 +310,9 @@
383    const Color& top = gradientrequest->top;
384    const Color& bottom = gradientrequest->bottom;
385  
386 -  glDisable(GL_TEXTURE_2D);
387 -  glBegin(GL_QUADS);
388 -  glColor4f(top.red, top.green, top.blue, top.alpha);
389 -  glVertex2f(0, 0);
390 -  glVertex2f(SCREEN_WIDTH, 0);
391 -  glColor4f(bottom.red, bottom.green, bottom.blue, bottom.alpha);
392 -  glVertex2f(SCREEN_WIDTH, SCREEN_HEIGHT);
393 -  glVertex2f(0, SCREEN_HEIGHT);
394 -  glEnd();
395 -  glEnable(GL_TEXTURE_2D);
396 +  int width = 800;
397 +  int height = 600;
398 +  for(float y = 0; y < height; y += 2) ::fillrect(screen, 0, (int)y, width, 2, (int)(((float)(top.red-bottom.red)/(0-height)) * y + top.red), (int)(((float)(top.green-bottom.green)/(0-height)) * y + top.green), (int)(((float)(top.blue-bottom.blue)/(0-height)) * y + top.blue), 255);
399  
400    delete gradientrequest;
401  }
402 @@ -330,47 +338,19 @@
403    float w = fillrectrequest->size.x;
404    float h = fillrectrequest->size.y;
405  
406 -  glDisable(GL_TEXTURE_2D);
407 -  glColor4f(fillrectrequest->color.red, fillrectrequest->color.green,
408 -            fillrectrequest->color.blue, fillrectrequest->color.alpha);
409 +  int r = static_cast<int>(fillrectrequest->color.red);
410 +  int g = static_cast<int>(fillrectrequest->color.green);
411 +  int b = static_cast<int>(fillrectrequest->color.blue);
412 +  int a = static_cast<int>(fillrectrequest->color.alpha);
413  
414 -  glBegin(GL_QUADS);
415 -  glVertex2f(x, y);
416 -  glVertex2f(x+w, y);
417 -  glVertex2f(x+w, y+h);
418 -  glVertex2f(x, y+h);
419 -  glEnd();
420 -  glEnable(GL_TEXTURE_2D);
421 +  ::fillrect(screen, x, y, w, h, r, g, b, a);
422  
423    delete fillrectrequest;
424  }
425  
426  void
427 -DrawingContext::draw_lightmap(DrawingRequest& request)
428 +DrawingContext::draw_lightmap(DrawingRequest& )
429  {
430 -  const Texture* texture = reinterpret_cast<Texture*> (request.request_data);
431 -
432 -  // multiple the lightmap with the framebuffer
433 -  glBlendFunc(GL_DST_COLOR, GL_ZERO);
434 -
435 -  glBindTexture(GL_TEXTURE_2D, texture->get_handle());
436 -  glBegin(GL_QUADS);
437 -
438 -  glTexCoord2f(0, lightmap_uv_bottom);
439 -  glVertex2f(0, 0);
440 -
441 -  glTexCoord2f(lightmap_uv_right, lightmap_uv_bottom);
442 -  glVertex2f(SCREEN_WIDTH, 0);
443 -
444 -  glTexCoord2f(lightmap_uv_right, 0);
445 -  glVertex2f(SCREEN_WIDTH, SCREEN_HEIGHT);
446 -
447 -  glTexCoord2f(0, 0);
448 -  glVertex2f(0, SCREEN_HEIGHT);
449 -
450 -  glEnd();
451 -
452 -  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
453  }
454  
455  void
456 @@ -383,50 +363,9 @@
457    transformstack.clear();
458    target_stack.clear();
459  
460 -  //Use Lightmap if ambient color is not white.
461 -  bool use_lightmap = ( ambient_color.red != 1.0f   || ambient_color.green != 1.0f ||
462 -                        ambient_color.blue  != 1.0f );
463 -
464 -  // PART1: create lightmap
465 -  if(use_lightmap) {
466 -    glViewport(0, screen->h - lightmap_height, lightmap_width, lightmap_height);
467 -    glMatrixMode(GL_PROJECTION);
468 -    glLoadIdentity();
469 -    glOrtho(0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, -1.0, 1.0);
470 -    glMatrixMode(GL_MODELVIEW);
471 -    glLoadIdentity();
472 -
473 -    glClearColor( ambient_color.red, ambient_color.green, ambient_color.blue, 1 );
474 -    glClear(GL_COLOR_BUFFER_BIT);
475 -    handle_drawing_requests(lightmap_requests);
476 -    lightmap_requests.clear();
477 -
478 -    glDisable(GL_BLEND);
479 -    glBindTexture(GL_TEXTURE_2D, lightmap->get_handle());
480 -    glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, screen->h - lightmap_height, lightmap_width, lightmap_height);
481 -
482 -    glViewport(0, 0, screen->w, screen->h);
483 -    glMatrixMode(GL_PROJECTION);
484 -    glLoadIdentity();
485 -    glOrtho(0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, -1.0, 1.0);
486 -    glMatrixMode(GL_MODELVIEW);
487 -    glLoadIdentity();
488 -    glEnable(GL_BLEND);
489 -
490 -    // add a lightmap drawing request into the queue
491 -    DrawingRequest request;
492 -    request.type = LIGHTMAPREQUEST;
493 -    request.layer = LAYER_HUD - 1;
494 -    request.request_data = lightmap;
495 -    requests->push_back(request);
496 -  }
497 -
498 -  //glClear(GL_COLOR_BUFFER_BIT);
499    handle_drawing_requests(drawing_requests);
500    drawing_requests.clear();
501 -  assert_gl("drawing");
502 -
503 -  SDL_GL_SwapBuffers();
504 +  SDL_Flip(screen);
505  }
506  
507  void
508 @@ -524,10 +463,6 @@
509  DrawingContext::set_target(Target target)
510  {
511    this->target = target;
512 -  if(target == LIGHTMAP)
513 -    requests = &lightmap_requests;
514 -  else
515 -    requests = &drawing_requests;
516  }
517  
518  void
519 diff -aur supertux/src/video/drawing_context.hpp supertux-nogl/src/video/drawing_context.hpp
520 --- supertux/src/video/drawing_context.hpp      2006-07-03 02:00:48.000000000 +0200
521 +++ supertux-nogl/src/video/drawing_context.hpp 2006-07-03 02:00:29.000000000 +0200
522 @@ -24,7 +24,6 @@
523  #include <string>
524  #include <stdint.h>
525  
526 -#include <GL/gl.h>
527  #include <SDL.h>
528  #include <stdint.h>
529  #include <memory>
530 @@ -35,8 +34,9 @@
531  #include "font.hpp"
532  #include "color.hpp"
533  
534 +#include "glutil.hpp"
535 +
536  class Surface;
537 -class Texture;
538  
539  // some constants for predefined layer values
540  enum {
541 @@ -225,18 +225,14 @@
542    void draw_filled_rect(DrawingRequest& request);
543    void draw_lightmap(DrawingRequest& request);
544  
545    DrawingRequests drawing_requests;
546 -  DrawingRequests lightmap_requests;
547  
548    DrawingRequests* requests;
549    Color ambient_color;
550  
551    SDL_Surface* screen;
552    Target target;
553    std::vector<Target> target_stack;
554 -  Texture* lightmap;
555 -  int lightmap_width, lightmap_height;
556 -  float lightmap_uv_right, lightmap_uv_bottom;
557  };
558  
559  #endif
560 diff -aur supertux/src/video/glutil.hpp supertux-nogl/src/video/glutil.hpp
561 --- supertux/src/video/glutil.hpp       2006-07-03 02:00:48.000000000 +0200
562 +++ supertux-nogl/src/video/glutil.hpp  2006-07-03 02:00:29.000000000 +0200
563 @@ -21,58 +21,12 @@
564  
565  #include <sstream>
566  #include <stdexcept>
567 -#include <GL/gl.h>
568  
569 -static inline void check_gl_error(const char* message)
570 -{
571 -#ifdef DEBUG
572 -  GLenum error = glGetError();
573 -  if(error != GL_NO_ERROR) {
574 -    std::ostringstream msg;
575 -    msg << "OpenGLError while '" << message << "': ";
576 -    switch(error) {
577 -      case GL_INVALID_ENUM:
578 -        msg << "INVALID_ENUM: An unacceptable value is specified for an "
579 -               "enumerated argument.";
580 -        break;
581 -      case GL_INVALID_VALUE:
582 -        msg << "INVALID_VALUE: A numeric argument is out of range.";
583 -        break;
584 -      case GL_INVALID_OPERATION:
585 -        msg << "INVALID_OPERATION: The specified operation is not allowed "
586 -               "in the current state.";
587 -        break;
588 -      case GL_STACK_OVERFLOW:
589 -        msg << "STACK_OVERFLOW: This command would cause a stack overflow.";
590 -        break;
591 -      case GL_STACK_UNDERFLOW:
592 -        msg << "STACK_UNDERFLOW: This command would cause a stack underflow.";
593 -        break;
594 -      case GL_OUT_OF_MEMORY:
595 -        msg << "OUT_OF_MEMORY: There is not enough memory left to execute the "
596 -               "command.";
597 -        break;
598 -#ifdef GL_TABLE_TOO_LARGE
599 -      case GL_TABLE_TOO_LARGE:
600 -        msg << "TABLE_TOO_LARGE: table is too large";
601 -        break;
602 -#endif
603 -      default:
604 -        msg << "Unknown error (code " << error << ")";
605 -    }
606 -
607 -    throw std::runtime_error(msg.str());
608 -  }
609 -#endif
610 -}
611 +#define GLenum int
612 +#define GLint int
613 +#define GL_SRC_ALPHA 0
614 +#define GL_ONE_MINUS_SRC_ALPHA 1
615 +#define GL_RGBA 2
616 +#define GL_ONE 3
617  
618 -static inline void assert_gl(const char* message)
619 -{
620 -#ifdef DEBUG
621 -  check_gl_error(message);
622 -#else
623 -  (void) message;
624  #endif
625 -}
626 -
627 -#endif
628 diff -aur supertux/src/video/surface.cpp supertux-nogl/src/video/surface.cpp
629 --- supertux/src/video/surface.cpp      2006-07-03 02:00:48.000000000 +0200
630 +++ supertux-nogl/src/video/surface.cpp 2006-07-03 02:00:29.000000000 +0200
631 @@ -28,6 +28,7 @@
632  
633  #include <SDL.h>
634  #include <SDL_image.h>
635 +#include <SDL_rotozoom.h>
636  
637  #include "gameconfig.hpp"
638  #include "physfs/physfs_sdl.hpp"
639 @@ -41,13 +42,13 @@
640  {
641    texture = texture_manager->get(file);
642    texture->ref();
643 -  uv_left = 0;
644 -  uv_top = 0;
645 -  uv_right = texture->get_uv_right();
646 -  uv_bottom = texture->get_uv_bottom();
647  
648 -  width = texture->get_image_width();
649 -  height = texture->get_image_height();
650 +  offsetx = 0;
651 +  offsety = 0;
652 +  width = static_cast<int>(texture->get_image_width());
653 +  height = static_cast<int>(texture->get_image_height());
654 +
655 +  flipx = false;
656  }
657  
658  Surface::Surface(const std::string& file, int x, int y, int w, int h)
659 @@ -55,15 +56,12 @@
660    texture = texture_manager->get(file);
661    texture->ref();
662  
663 -  float tex_w = static_cast<float> (texture->get_width());
664 -  float tex_h = static_cast<float> (texture->get_height());
665 -  uv_left = static_cast<float>(x) / tex_w;
666 -  uv_top = static_cast<float>(y) / tex_h;
667 -  uv_right = static_cast<float>(x+w) / tex_w;
668 -  uv_bottom = static_cast<float>(y+h) / tex_h;
669 -
670 +  offsetx = x;
671 +  offsety = y;
672    width = w;
673    height = h;
674 +
675 +  flipx = false;
676  }
677  
678  Surface::Surface(const Surface& other)
679 @@ -71,12 +69,12 @@
680    texture = other.texture;
681    texture->ref();
682  
683 -  uv_left = other.uv_left;
684 -  uv_top = other.uv_top;
685 -  uv_right = other.uv_right;
686 -  uv_bottom = other.uv_bottom;
687 +  offsetx = other.offsetx;
688 +  offsety = other.offsety;
689    width = other.width;
690    height = other.height;
691 +
692 +  flipx = other.flipx;
693  }
694  
695  const Surface&
696 @@ -86,52 +84,33 @@
697    texture->unref();
698    texture = other.texture;
699  
700 -  uv_left = other.uv_left;
701 -  uv_top = other.uv_top;
702 -  uv_right = other.uv_right;
703 -  uv_bottom = other.uv_bottom;
704 +  offsetx = other.offsetx;
705 +  offsety = other.offsety;
706    width = other.width;
707    height = other.height;
708  
709 +  flipx = other.flipx;
710 +
711    return *this;
712  }
713  
714  Surface::~Surface()
715  {
716    texture->unref();
717 +
718 +  for (std::list<TransformedSurface*>::iterator i = transformedSurfaces.begin(); i != transformedSurfaces.end(); i++) {
719 +    SDL_FreeSurface((*i)->surface);
720 +    delete (*i);
721 +  }
722  }
723  
724  void
725  Surface::hflip()
726  {
727 -  std::swap(uv_left, uv_right);
728 +  flipx = !flipx;
729  }
730  
731 -static inline void intern_draw(float left, float top, float right, float bottom,                               float uv_left, float uv_top,
732 -                               float uv_right, float uv_bottom,
733 -                               DrawingEffect effect)
734 -{
735 -  if(effect & HORIZONTAL_FLIP)
736 -    std::swap(uv_left, uv_right);
737 -  if(effect & VERTICAL_FLIP) {
738 -    std::swap(uv_top, uv_bottom);
739 -  }
740 -
741 -  glBegin(GL_QUADS);
742 -  glTexCoord2f(uv_left, uv_top);
743 -  glVertex2f(left, top);
744 -
745 -  glTexCoord2f(uv_right, uv_top);
746 -  glVertex2f(right, top);
747 -
748 -  glTexCoord2f(uv_right, uv_bottom);
749 -  glVertex2f(right, bottom);
750 -
751 -  glTexCoord2f(uv_left, uv_bottom);
752 -  glVertex2f(left, bottom);
753 -  glEnd();
754 -}
755 -
756 +/*
757  static inline void intern_draw2(float left, float top, float right, float bottom,
758                                  float uv_left, float uv_top,
759                                  float uv_right, float uv_bottom,
760 @@ -182,50 +161,76 @@
761    glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
762    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
763  }
764 +*/
765  
766  void
767 -Surface::draw(float x, float y, float alpha, float angle, const Color& color, const Blend& blend, DrawingEffect effect) const
768 +Surface::draw(float x, float y, float alpha, float, const Color&, const Blend&, DrawingEffect effect) const
769  {
770 -  glColor4f(1.0f, 1.0f, 1.0f, alpha);
771 -  glBindTexture(GL_TEXTURE_2D, texture->get_handle());
772 -
773 -  intern_draw2(x, y,
774 -               x + width, y + height,
775 -               uv_left, uv_top, uv_right, uv_bottom,
776 -               angle,
777 -               color,
778 -               blend,
779 -               effect);
780 +  draw_part(0, 0, x, y, width, height, alpha, effect);
781  }
782  
783  void
784  Surface::draw(float x, float y, float alpha, DrawingEffect effect) const
785  {
786 -  glColor4f(1.0f, 1.0f, 1.0f, alpha);
787 -  glBindTexture(GL_TEXTURE_2D, texture->get_handle());
788 -
789 -  intern_draw(x, y,
790 -              x + width, y + height,
791 -              uv_left, uv_top, uv_right, uv_bottom, effect);
792 +  draw_part(0, 0, x, y, width, height, alpha, effect);
793  }
794  
795  void
796  Surface::draw_part(float src_x, float src_y, float dst_x, float dst_y,
797 -                   float width, float height, float alpha,
798 +                   float width, float height, float ,
799                     DrawingEffect effect) const
800  {
801 -  float uv_width = uv_right - uv_left;
802 -  float uv_height = uv_bottom - uv_top;
803 +  //FIXME: support parameter "alpha"
804 +  SDL_Surface* surface = texture->getSurface();
805  
806 -  float uv_left = this->uv_left + (uv_width * src_x) / this->width;
807 -  float uv_top = this->uv_top + (uv_height * src_y) / this->height;
808 -  float uv_right = this->uv_left + (uv_width * (src_x + width)) / this->width;
809 -  float uv_bottom = this->uv_top + (uv_height * (src_y + height)) / this->height;
810 +  // get and check SDL_Surface
811 +  if (surface == 0) {
812 +    std::cerr << "Warning: Tried to draw NULL surface, skipped draw" << std::endl;
813 +    return;
814 +  }    
815  
816 -  glColor4f(1.0f, 1.0f, 1.0f, alpha);
817 -  glBindTexture(GL_TEXTURE_2D, texture->get_handle());
818 +  SDL_Surface* transformedSurface = surface;
819  
820 -  intern_draw(dst_x, dst_y,
821 -              dst_x + width, dst_y + height,
822 -              uv_left, uv_top, uv_right, uv_bottom, effect);
823 +  if (flipx) effect = HORIZONTAL_FLIP;
824 +
825 +  if (effect != NO_EFFECT) {
826 +    transformedSurface = 0;
827 +
828 +    // check if we have this effect buffered
829 +    for (std::list<TransformedSurface*>::const_iterator i = transformedSurfaces.begin(); i != transformedSurfaces.end(); i++) {
830 +      if ((*i)->effect == effect) transformedSurface = (*i)->surface;
831 +    }
832 +
833 +    // if not: transform and buffer
834 +    if (!transformedSurface) {
835 +      if (effect == HORIZONTAL_FLIP) transformedSurface = zoomSurface(surface, -1, 1, 0);
836 +      if (effect == VERTICAL_FLIP) transformedSurface = zoomSurface(surface, 1, -1, 0);
837 +      if (transformedSurface == 0) {
838 +        std::cerr << "Warning: No known transformation applies to surface, skipped draw" << std::endl;
839 +        return;
840 +      }        
841 +      TransformedSurface* su = new TransformedSurface();
842 +      su->surface = transformedSurface;
843 +      su->effect = effect;
844 +
845 +      transformedSurfaces.push_front(su);
846 +    }
847 +  }
848 +
849 +  int ox = offsetx; if (effect == HORIZONTAL_FLIP) ox = static_cast<int>(surface->w) - (ox+static_cast<int>(width));
850 +  int oy = offsety; if (effect == VERTICAL_FLIP) oy = static_cast<int>(surface->h) - (oy+static_cast<int>(height));
851 +  // draw surface to screen
852 +  SDL_Surface* screen = SDL_GetVideoSurface();
853 +
854 +  SDL_Rect srcRect;
855 +  srcRect.x = static_cast<int>(ox+src_x);
856 +  srcRect.y = static_cast<int>(oy+src_y);
857 +  srcRect.w = static_cast<int>(width);
858 +  srcRect.h = static_cast<int>(height);
859 +
860 +  SDL_Rect dstRect;
861 +  dstRect.x = static_cast<int>(dst_x);
862 +  dstRect.y = static_cast<int>(dst_y);
863 +
864 +  SDL_BlitSurface(transformedSurface, &srcRect, screen, &dstRect);
865  }
866 diff -aur supertux/src/video/surface.hpp supertux-nogl/src/video/surface.hpp
867 --- supertux/src/video/surface.hpp      2006-07-03 02:00:48.000000000 +0200
868 +++ supertux-nogl/src/video/surface.hpp 2006-07-03 02:00:29.000000000 +0200
869 @@ -20,7 +20,9 @@
870  #ifndef __SURFACE_HPP__
871  #define __SURFACE_HPP__
872  
873 +#include <SDL_image.h>
874  #include <string>
875 +#include <list>
876  #include "math/vector.hpp"
877  
878  class Color;
879 @@ -37,6 +39,15 @@
880  };
881  
882  /**
883 + * Helper class to buffer a pre-transformed SDL_Surface
884 + */
885 +class TransformedSurface {
886 +    public:
887 +       SDL_Surface* surface;
888 +       DrawingEffect effect;
889 +};
890 +
891 +/**
892   * A rectangular image.
893   * The class basically holds a reference to a texture with additional UV
894   * coordinates that specify a rectangular area on this texture
895 @@ -48,19 +59,26 @@
896    friend class Font;
897    ImageTexture* texture;
898  
899 -  float uv_left;
900 -  float uv_top;
901 -  float uv_right;
902 -  float uv_bottom;
903 +  bool flipx;
904  
905 +  /** draw the surface on the screen, applying a ::DrawingEffect on-the-fly. Transformed Surfaces will be cached in ::transformedSurfaces */
906    void draw(float x, float y, float alpha, float angle, const Color& color, const Blend& blend, DrawingEffect effect) const;
907 +  
908 +  /** draw the surface on the screen, applying a ::DrawingEffect on-the-fly. Transformed Surfaces will be cached in ::transformedSurfaces */
909    void draw(float x, float y, float alpha, DrawingEffect effect) const;
910 +  
911 +  /** draw the surface on the screen, applying a ::DrawingEffect on-the-fly. Transformed Surfaces will be cached in ::transformedSurfaces */
912    void draw_part(float src_x, float src_y, float dst_x, float dst_y,
913                   float width, float height,
914                   float alpha, DrawingEffect effect) const;
915  
916 -  float width;
917 -  float height;
918 +  int offsetx; /**< Region in ::surface to be used for blitting */
919 +  int offsety; /**< Region in ::surface to be used for blitting */
920 +  int width;   /**< Region in ::surface to be used for blitting */
921 +  int height;  /**< Region in ::surface to be used for blitting */
922 +
923 +  mutable std::list<TransformedSurface*> transformedSurfaces; /**< Cache for pre-transformed surfaces */
924 +
925  public:
926    Surface(const std::string& file);
927    Surface(const std::string& file, int x, int y, int w, int h);
928 diff -aur supertux/src/video/texture.cpp supertux-nogl/src/video/texture.cpp
929 --- supertux/src/video/texture.cpp      2006-07-03 02:00:48.000000000 +0200
930 +++ supertux-nogl/src/video/texture.cpp 2006-07-03 02:00:29.000000000 +0200
931 @@ -21,7 +21,6 @@
932  
933  #include "texture.hpp"
934  
935 -#include <GL/gl.h>
936  #include <assert.h>
937  #include "glutil.hpp"
938  
939 @@ -30,7 +29,7 @@
940    return (v & (v-1)) == 0;
941  }
942  
943 -Texture::Texture(unsigned int w, unsigned int h, GLenum glformat)
944 +Texture::Texture(unsigned int w, unsigned int h, GLenum)
945  {
946    assert(is_power_of_2(w));
947    assert(is_power_of_2(h));
948 @@ -38,23 +37,10 @@
949    this->width = w;
950    this->height = h;
951  
952 -  assert_gl("before creating texture");
953 -  glGenTextures(1, &handle);
954 -
955 -  try {
956 -    glBindTexture(GL_TEXTURE_2D, handle);
957 -
958 -    glTexImage2D(GL_TEXTURE_2D, 0, glformat, width, height, 0, GL_RGBA,
959 -                 GL_UNSIGNED_BYTE, 0);
960 -
961 -    set_texture_params();
962 -  } catch(...) {
963 -    glDeleteTextures(1, &handle);
964 -    throw;
965 -  }
966 +  surface = 0;
967  }
968  
969 -Texture::Texture(SDL_Surface* image, GLenum glformat)
970 +Texture::Texture(SDL_Surface* image, GLenum)
971  {
972    const SDL_PixelFormat* format = image->format;
973    if(!is_power_of_2(image->w) || !is_power_of_2(image->h))
974 @@ -65,45 +51,14 @@
975    this->width = image->w;
976    this->height = image->h;
977  
978 -  assert_gl("before creating texture");
979 -  glGenTextures(1, &handle);
980 -
981 -  try {
982 -    GLenum sdl_format;
983 -    if(format->BytesPerPixel == 3)
984 -      sdl_format = GL_RGB;
985 -    else if(format->BytesPerPixel == 4)
986 -      sdl_format = GL_RGBA;
987 -    else
988 -      assert(false);
989 -
990 -    glBindTexture(GL_TEXTURE_2D, handle);
991 -    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
992 -    glPixelStorei(GL_UNPACK_ROW_LENGTH, image->pitch/format->BytesPerPixel);
993 -    glTexImage2D(GL_TEXTURE_2D, 0, glformat, width, height, 0, sdl_format,
994 -            GL_UNSIGNED_BYTE, image->pixels);
995 -
996 -    assert_gl("creating texture");
997 -
998 -    set_texture_params();
999 -  } catch(...) {
1000 -    glDeleteTextures(1, &handle);
1001 -    throw;
1002 -  }
1003 +  surface = SDL_DisplayFormatAlpha(image);
1004  }
1005  
1006  Texture::~Texture()
1007  {
1008 -  glDeleteTextures(1, &handle);
1009  }
1010  
1011  void
1012  Texture::set_texture_params()
1013  {
1014 -  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
1015 -  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
1016 -  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
1017 -  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
1018 -
1019 -  assert_gl("set texture params");
1020  }
1021 diff -aur supertux/src/video/texture.hpp supertux-nogl/src/video/texture.hpp
1022 --- supertux/src/video/texture.hpp      2006-07-03 02:00:48.000000000 +0200
1023 +++ supertux-nogl/src/video/texture.hpp 2006-07-03 02:00:29.000000000 +0200
1024 @@ -21,7 +21,7 @@
1025  #define __TEXTURE_HPP__
1026  
1027  #include <SDL.h>
1028 -#include <GL/gl.h>
1029 +#include "glutil.hpp"
1030  
1031  /**
1032   * This class is a wrapper around a texture handle. It stores the texture width
1033 @@ -31,8 +31,9 @@
1034  class Texture
1035  {
1036  protected:
1037 +  SDL_Surface* surface; /**< non-GL branch stores optimized surface */
1038 +
1039    friend class TextureManager;
1040 -  GLuint handle;
1041    unsigned int width;
1042    unsigned int height;
1043  
1044 @@ -41,11 +42,6 @@
1045    Texture(SDL_Surface* surface, GLenum glformat);
1046    virtual ~Texture();
1047  
1048 -  GLuint get_handle() const
1049 -  {
1050 -    return handle;
1051 -  }
1052 -
1053    unsigned int get_width() const
1054    {
1055      return width;
1056 @@ -56,6 +52,14 @@
1057      return height;
1058    }
1059  
1060 +  SDL_Surface* getSurface() {
1061 +    return surface;
1062 +  }
1063 +
1064 +  void setSurface(SDL_Surface* surface) {
1065 +    this->surface = surface;
1066 +  }
1067 +
1068  private:
1069    void set_texture_params();
1070  };
1071 diff -aur supertux/src/video/texture_manager.cpp supertux-nogl/src/video/texture_manager.cpp
1072 --- supertux/src/video/texture_manager.cpp      2006-07-03 02:00:48.000000000 +0200
1073 +++ supertux-nogl/src/video/texture_manager.cpp 2006-07-03 02:00:29.000000000 +0200
1074 @@ -24,8 +24,6 @@
1075  #include <assert.h>
1076  #include <SDL.h>
1077  #include <SDL_image.h>
1078 -#include <GL/gl.h>
1079 -#include <GL/glext.h>
1080  #include <iostream>
1081  #include <sstream>
1082  #include <stdexcept>
1083 @@ -145,12 +143,6 @@
1084  void
1085  TextureManager::save_textures()
1086  {
1087 -  glPixelStorei(GL_PACK_ROW_LENGTH, 0);
1088 -  glPixelStorei(GL_PACK_IMAGE_HEIGHT, 0);
1089 -  glPixelStorei(GL_PACK_SKIP_PIXELS, 0);
1090 -  glPixelStorei(GL_PACK_SKIP_ROWS, 0);
1091 -  glPixelStorei(GL_PACK_SKIP_IMAGES, 0);
1092 -  glPixelStorei(GL_PACK_ALIGNMENT, 1);
1093    for(Textures::iterator i = textures.begin(); i != textures.end(); ++i) {
1094      save_texture(*i);
1095    }
1096 @@ -165,74 +157,15 @@
1097  {
1098    SavedTexture saved_texture;
1099    saved_texture.texture = texture;
1100 -  glBindTexture(GL_TEXTURE_2D, texture->get_handle());
1101 -  glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH,
1102 -                           &saved_texture.width);
1103 -  glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT,
1104 -                           &saved_texture.height);
1105 -  glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_BORDER,
1106 -                           &saved_texture.border);
1107 -  glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
1108 -                      &saved_texture.min_filter);
1109 -  glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
1110 -                      &saved_texture.mag_filter);
1111 -  glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,
1112 -                      &saved_texture.wrap_s);
1113 -  glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,
1114 -                      &saved_texture.wrap_t);
1115  
1116    size_t pixelssize = saved_texture.width * saved_texture.height * 4;
1117    saved_texture.pixels = new char[pixelssize];
1118 -
1119 -  glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE,
1120 -                saved_texture.pixels);
1121  
1122    saved_textures.push_back(saved_texture);
1123 -
1124 -  glDeleteTextures(1, &(texture->handle));
1125 -  texture->handle = 0;
1126 -
1127 -  assert_gl("retrieving texture for save");
1128  }
1129  
1130  void
1131  TextureManager::reload_textures()
1132  {
1133 -  glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
1134 -  glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, 0);
1135 -  glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
1136 -  glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
1137 -  glPixelStorei(GL_UNPACK_SKIP_IMAGES, 0);
1138 -  glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
1139 -
1140 -  for(std::vector<SavedTexture>::iterator i = saved_textures.begin();
1141 -      i != saved_textures.end(); ++i) {
1142 -    SavedTexture& saved_texture = *i;
1143 -
1144 -    GLuint handle;
1145 -    glGenTextures(1, &handle);
1146 -    assert_gl("creating texture handle");
1147 -
1148 -    glBindTexture(GL_TEXTURE_2D, handle);
1149 -    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
1150 -                 saved_texture.width, saved_texture.height,
1151 -                 saved_texture.border, GL_RGBA,
1152 -                 GL_UNSIGNED_BYTE, saved_texture.pixels);
1153 -    delete[] saved_texture.pixels;
1154 -    assert_gl("uploading texture pixel data");
1155 -
1156 -    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
1157 -                    saved_texture.min_filter);
1158 -    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
1159 -                    saved_texture.mag_filter);
1160 -    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,
1161 -                    saved_texture.wrap_s);
1162 -    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,
1163 -                    saved_texture.wrap_t);
1164 -
1165 -    assert_gl("setting texture_params");
1166 -    saved_texture.texture->handle = handle;
1167 -  }
1168 -
1169    saved_textures.clear();
1170  }
1171 diff -aur supertux/src/video/texture_manager.hpp supertux-nogl/src/video/texture_manager.hpp
1172 --- supertux/src/video/texture_manager.hpp      2006-07-03 02:00:48.000000000 +0200
1173 +++ supertux-nogl/src/video/texture_manager.hpp 2006-07-03 02:00:29.000000000 +0200
1174 @@ -20,7 +20,7 @@
1175  #ifndef __IMAGE_TEXTURE_MANAGER_HPP__
1176  #define __IMAGE_TEXTURE_MANAGER_HPP__
1177  
1178 -#include <GL/gl.h>
1179 +#include "video/glutil.hpp"
1180  #include <string>
1181  #include <vector>
1182  #include <map>