#
# patch -p1 < contrib/supertux-nogl.diff
#
-# This patch works for revision 3294. It may break for later revisions.
+# This patch works for revision 3321. It may break for later revisions.
#
# -----------------------------------------------------------------------------
diff -Naur supertux/INSTALL supertux-nogl/INSTALL
AC_CONFIG_SRCDIR([src/main.cpp])
AC_CONFIG_AUX_DIR([mk/autoconf])
AC_CANONICAL_TARGET
-@@ -105,6 +105,14 @@
+@@ -112,6 +105,14 @@
[AC_MSG_ERROR([Please install SDLImage >= 1.2.1])],
[$SDL_CFLAGS], [$SDL_LIBS])
NP_FINDLIB([PHYSFS], [physfs], [physfs >= 1.0.0],
NP_LANG_PROGRAM([
#include <stdio.h>
-@@ -124,11 +132,6 @@
+@@ -131,11 +132,6 @@
[AC_MSG_ERROR([Please intall OpenAL])],
[], [])
#include <physfs.h>
#include <SDL.h>
#include <SDL_image.h>
--#include <SDL_opengl.h>
+-#include <GL/gl.h>
#include "gameconfig.hpp"
#include "resources.hpp"
-@@ -266,44 +265,6 @@
- ;
- }
-
--static void check_gl_error()
--{
-- GLenum glerror = glGetError();
-- std::string errormsg;
--
-- if(glerror != GL_NO_ERROR) {
-- switch(glerror) {
-- case GL_INVALID_ENUM:
-- errormsg = "Invalid enumeration value";
-- break;
-- case GL_INVALID_VALUE:
-- errormsg = "Numeric argzment out of range";
-- break;
-- case GL_INVALID_OPERATION:
-- errormsg = "Invalid operation";
-- break;
-- case GL_STACK_OVERFLOW:
-- errormsg = "stack overflow";
-- break;
-- case GL_STACK_UNDERFLOW:
-- errormsg = "stack underflow";
-- break;
-- case GL_OUT_OF_MEMORY:
-- errormsg = "out of memory";
-- break;
-- case GL_TABLE_TOO_LARGE:
-- errormsg = "table too large";
-- break;
-- default:
-- errormsg = "unknown error number";
-- break;
-- }
-- std::stringstream msg;
-- msg << "OpenGL Error: " << errormsg;
-- throw std::runtime_error(msg.str());
-- }
--}
--
- void init_video()
- {
- if(texture_manager != NULL)
-@@ -314,7 +275,7 @@
+@@ -317,7 +275,7 @@
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
if(config->use_fullscreen)
flags |= SDL_FULLSCREEN;
int width = config->screenwidth;
-@@ -344,24 +305,6 @@
+@@ -347,24 +305,6 @@
}
#endif
- glLoadIdentity();
- glTranslatef(0, 0, 0);
-
-- check_gl_error();
+- check_gl_error("Setting up view matrices");
-
if(texture_manager != NULL)
texture_manager->reload_textures();
diff -Naur supertux/src/video/drawing_context.cpp supertux-nogl/src/video/drawing_context.cpp
--- supertux/src/video/drawing_context.cpp 2006-03-31 04:18:01.000000000 +0200
+++ supertux-nogl/src/video/drawing_context.cpp 2006-04-07 04:11:49.000000000 +0200
-@@ -22,8 +22,6 @@
+@@ -22,7 +22,6 @@
#include <cassert>
#include <iostream>
#include <SDL_image.h>
-#include <GL/gl.h>
--#include <GL/glu.h>
#include "drawing_context.hpp"
#include "surface.hpp"
-@@ -49,30 +47,20 @@
+@@ -48,30 +47,20 @@
{
screen = SDL_GetVideoSurface();
assert(surface != 0);
DrawingRequest request;
-@@ -97,6 +85,8 @@
+@@ -96,6 +85,8 @@
DrawingContext::draw_surface_part(const Surface* surface, const Vector& source,
const Vector& size, const Vector& dest, int layer)
{
assert(surface != 0);
DrawingRequest request;
-@@ -136,6 +126,8 @@
+@@ -135,6 +126,8 @@
DrawingContext::draw_text(const Font* font, const std::string& text,
const Vector& position, FontAlignment alignment, int layer)
{
DrawingRequest request;
request.type = TEXT;
-@@ -157,6 +149,8 @@
+@@ -156,6 +149,8 @@
DrawingContext::draw_center_text(const Font* font, const std::string& text,
const Vector& position, int layer)
{
draw_text(font, text, Vector(position.x + SCREEN_WIDTH/2, position.y),
CENTER_ALLIGN, layer);
}
-@@ -164,6 +158,8 @@
+@@ -163,6 +158,8 @@
void
DrawingContext::draw_gradient(const Color& top, const Color& bottom, int layer)
{
DrawingRequest request;
request.type = GRADIENT;
-@@ -185,6 +181,8 @@
+@@ -184,6 +181,8 @@
DrawingContext::draw_filled_rect(const Vector& topleft, const Vector& size,
const Color& color, int layer)
{
DrawingRequest request;
request.type = FILLRECT;
-@@ -218,23 +216,55 @@
+@@ -217,23 +216,55 @@
delete surfacepartrequest;
}
delete gradientrequest;
}
-@@ -260,17 +290,12 @@
+@@ -259,17 +290,12 @@
float w = fillrectrequest->size.x;
float h = fillrectrequest->size.y;
delete fillrectrequest;
}
-@@ -285,66 +310,10 @@
+@@ -284,66 +310,10 @@
transformstack.clear();
target_stack.clear();
}
void
-@@ -433,9 +402,5 @@
+@@ -432,9 +402,5 @@
DrawingContext::set_target(Target target)
{
this->target = target;
diff -Naur supertux/src/video/glutil.hpp supertux-nogl/src/video/glutil.hpp
--- supertux/src/video/glutil.hpp 2006-03-21 16:13:11.000000000 +0100
+++ supertux-nogl/src/video/glutil.hpp 2006-04-07 04:11:49.000000000 +0200
-@@ -21,45 +21,14 @@
-
- #include <sstream>
- #include <stdexcept>
+@@ -21,53 +21,6 @@
-#include <GL/gl.h>
--static inline void assert_gl(const char* message)
+-static inline void check_gl_error(const char* message)
-{
-#ifdef DEBUG
- GLenum error = glGetError();
- msg << "OUT_OF_MEMORY: There is not enough memory left to execute the "
- "command.";
- break;
+-#ifdef GL_TABLE_TOO_LARGE
+- case GL_TABLE_TOO_LARGE:
+- msg << "TABLE_TOO_LARGE: table is too large";
+- break;
+-#endif
- default:
- msg << "Unknown error (code " << error << ")";
- }
- }
-#endif
-}
+-
+-static inline void assert_gl(const char* message)
+-{
+-#ifdef DEBUG
+- check_gl_error(message);
+-#else
+- (void) message;
+-#endif
+-}
+#define GLenum int
+#define GLint int
+#define GL_SRC_ALPHA 0
+#define GL_ONE_MINUS_SRC_ALPHA 1
+#define GL_RGBA 2
-+
-+
-
- #endif
-
-diff -Naur supertux/src/video/screen.cpp supertux-nogl/src/video/screen.cpp
---- supertux/src/video/screen.cpp 2006-04-07 03:32:13.000000000 +0200
-+++ supertux-nogl/src/video/screen.cpp 2006-04-07 04:11:49.000000000 +0200
-@@ -38,61 +38,70 @@
-
- static const float LOOP_DELAY = 20.0;
-
--void fillrect(float x, float y, float w, float h, const Color& col)
--{
-- if(w < 0) {
-- x += w;
-- w = -w;
-- }
-- if(h < 0) {
-- y += h;
-- h = -h;
-- }
--
-- glColor4f(col.red, col.green, col.blue, col.alpha);
-
-- glDisable(GL_TEXTURE_2D);
-- glBegin(GL_POLYGON);
-- glVertex2f(x, y);
-- glVertex2f(x+w, y);
-- glVertex2f(x+w, y+h);
-- glVertex2f(x, y+h);
-- glEnd();
-- glEnable(GL_TEXTURE_2D);
--
-- glColor4f(0, 0, 0, 1);
-+void fillrect(float x, float y, float w, float h, int r, int g, int b, int a)
-+ {
-+ SDL_Surface* screen = SDL_GetVideoSurface();
-+
-+ if(w < 0) {
-+ x += w;
-+ w = -w;
-+ }
-+ if(h < 0) {
-+ y += h;
-+ h = -h;
-+ }
-+
-+ SDL_Rect src, rect;
-+ SDL_Surface *temp = NULL;
-+
-+ rect.x = (int)x;
-+ rect.y = (int)y;
-+ rect.w = (int)w;
-+ rect.h = (int)h;
-+
-+ if(a != 255) {
-+ temp = SDL_CreateRGBSurface(screen->flags, rect.w, rect.h, screen->format->BitsPerPixel, screen->format->Rmask, screen->format->Gmask, screen->format->Bmask, screen->format->Amask);
-+
-+ src.x = 0;
-+ src.y = 0;
-+ src.w = rect.w;
-+ src.h = rect.h;
-+
-+ SDL_FillRect(temp, &src, SDL_MapRGB(screen->format, r, g, b));
-+ SDL_SetAlpha(temp, SDL_SRCALPHA, a);
-+ SDL_BlitSurface(temp,0,screen,&rect);
-+ SDL_FreeSurface(temp);
-+ }
-+ else
-+ SDL_FillRect(screen, &rect, SDL_MapRGB(screen->format, r, g, b));
- }
-
- void fadeout(float fade_time)
- {
-- float alpha_inc = LOOP_DELAY / fade_time;
-- Color c(0, 0, 0, alpha_inc);
-- float alpha = 1.0;
-+ float alpha_inc = 256 / (fade_time / LOOP_DELAY);
-+ float alpha = 256;
-
-- while(alpha >= 0) {
-+ while(alpha > 0) {
- alpha -= alpha_inc;
-- fillrect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, c);
-- // left side
-+ fillrect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0,0,0, (int)alpha_inc); // left side
-
-- SDL_GL_SwapBuffers();
-+ SDL_Flip(SDL_GetVideoSurface());
- sound_manager->update();
-
- SDL_Delay(int(LOOP_DELAY));
-- alpha -= alpha_inc;
- }
--
-- fillrect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, Color());
-+ fillrect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0, 0, 255);
- }
-
- void shrink_fade(const Vector& point, float fade_time)
- {
-- float left_inc = point.x / (fade_time / LOOP_DELAY);
-- float right_inc = (SCREEN_WIDTH - point.x) / (fade_time / LOOP_DELAY);
-- float up_inc = point.y / (fade_time / LOOP_DELAY);
-- float down_inc = (SCREEN_HEIGHT - point.y) / (fade_time / LOOP_DELAY);
-+ float left_inc = point.x / ((float)fade_time / LOOP_DELAY);
-+ float right_inc = (SCREEN_WIDTH - point.x) / ((float)fade_time / LOOP_DELAY);
-+ float up_inc = point.y / ((float)fade_time / LOOP_DELAY);
-+ float down_inc = (SCREEN_HEIGHT - point.y) / ((float)fade_time / LOOP_DELAY);
-
- float left_cor = 0, right_cor = 0, up_cor = 0, down_cor = 0;
-- Color c;
-
- while(left_cor < point.x && right_cor < SCREEN_WIDTH - point.x &&
- up_cor < point.y && down_cor < SCREEN_HEIGHT - point.y) {
-@@ -101,15 +110,14 @@
- up_cor += up_inc;
- down_cor += down_inc;
-
-- fillrect(0, 0, left_cor, SCREEN_HEIGHT, c); // left side
-- fillrect(SCREEN_WIDTH - right_cor, 0, right_cor, SCREEN_HEIGHT, c); // right side
-- fillrect(0, 0, SCREEN_WIDTH, up_cor, c); // up side
-- fillrect(0, SCREEN_HEIGHT - down_cor, SCREEN_WIDTH, down_cor+1, c); // down side
-+ fillrect(0, 0, left_cor, SCREEN_HEIGHT, 0,0,0, 255); // left side
-+ fillrect(SCREEN_WIDTH - right_cor, 0, right_cor, SCREEN_HEIGHT, 0,0,0, 255); // right side
-+ fillrect(0, 0, SCREEN_WIDTH, up_cor, 0,0,0, 255); // up side
-+ fillrect(0, SCREEN_HEIGHT - down_cor, SCREEN_WIDTH, down_cor+1, 0,0,0, 255); // down side
-
-- SDL_GL_SwapBuffers();
-+ SDL_Flip(SDL_GetVideoSurface());
-
- sound_manager->update();
- SDL_Delay(int(LOOP_DELAY));
- }
- }
--
-diff -Naur supertux/src/video/screen.hpp supertux-nogl/src/video/screen.hpp
---- supertux/src/video/screen.hpp 2006-04-07 03:32:13.000000000 +0200
-+++ supertux-nogl/src/video/screen.hpp 2006-04-07 04:11:49.000000000 +0200
-@@ -20,7 +20,6 @@
- #define SUPERTUX_SCREEN_H
-
- #include <SDL.h>
--#include <GL/gl.h>
- #include <iostream>
-
- #include <vector>
diff -Naur supertux/src/video/surface.cpp supertux-nogl/src/video/surface.cpp
--- supertux/src/video/surface.cpp 2006-03-25 01:16:31.000000000 +0100
+++ supertux-nogl/src/video/surface.cpp 2006-04-07 04:11:49.000000000 +0200
#include <string>
#include <vector>
#include <map>
+