Changeset 3458 in orxonox.OLD for orxonox/trunk
- Timestamp:
- Mar 5, 2005, 11:49:35 PM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 1 added
- 7 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/Makefile.am
r3457 r3458 40 40 light.cc \ 41 41 sfont/fontset.cc \ 42 sfont/glfont.c 42 sfont/glfont.cc 43 43 44 44 noinst_HEADERS = ability.h \ … … 84 84 skysphere.h \ 85 85 light.h \ 86 sfont/fontset.h 86 sfont/fontset.h \ 87 sfont/glfont.h 87 88 88 89 ## orxonox.conf will be used from home-dir instead. -
orxonox/trunk/src/Makefile.in
r3457 r3458 91 91 @AMDEP_TRUE@ ./$(DEPDIR)/track_manager.Po ./$(DEPDIR)/vector.Po \ 92 92 @AMDEP_TRUE@ ./$(DEPDIR)/world.Po ./$(DEPDIR)/world_entity.Po 93 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \94 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)95 CCLD = $(CC)96 LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@97 93 CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ 98 94 $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) … … 255 251 light.cc \ 256 252 sfont/fontset.cc \ 257 sfont/glfont.c 253 sfont/glfont.cc 258 254 259 255 noinst_HEADERS = ability.h \ … … 299 295 skysphere.h \ 300 296 light.h \ 301 sfont/fontset.h 297 sfont/fontset.h \ 298 sfont/glfont.h 302 299 303 300 EXTRA_DIST = orxonox.conf … … 317 314 318 315 .SUFFIXES: 319 .SUFFIXES: .c .cc .o .obj316 .SUFFIXES: .cc .o .obj 320 317 $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) 321 318 @for dep in $?; do \ … … 327 324 esac; \ 328 325 done; \ 329 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/Makefile'; \326 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ 330 327 cd $(top_srcdir) && \ 331 $(AUTOMAKE) -- foreignsrc/Makefile328 $(AUTOMAKE) --gnu src/Makefile 332 329 .PRECIOUS: Makefile 333 330 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status … … 415 412 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/world_entity.Po@am__quote@ 416 413 417 .c.o:418 @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \419 @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi420 @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@421 @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@422 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@423 @am__fastdepCC_FALSE@ $(COMPILE) -c $<424 425 .c.obj:426 @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \427 @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi428 @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@429 @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@430 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@431 @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`432 433 glfont.o: sfont/glfont.c434 @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT glfont.o -MD -MP -MF "$(DEPDIR)/glfont.Tpo" -c -o glfont.o `test -f 'sfont/glfont.c' || echo '$(srcdir)/'`sfont/glfont.c; \435 @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/glfont.Tpo" "$(DEPDIR)/glfont.Po"; else rm -f "$(DEPDIR)/glfont.Tpo"; exit 1; fi436 @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sfont/glfont.c' object='glfont.o' libtool=no @AMDEPBACKSLASH@437 @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/glfont.Po' tmpdepfile='$(DEPDIR)/glfont.TPo' @AMDEPBACKSLASH@438 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@439 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o glfont.o `test -f 'sfont/glfont.c' || echo '$(srcdir)/'`sfont/glfont.c440 441 glfont.obj: sfont/glfont.c442 @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT glfont.obj -MD -MP -MF "$(DEPDIR)/glfont.Tpo" -c -o glfont.obj `if test -f 'sfont/glfont.c'; then $(CYGPATH_W) 'sfont/glfont.c'; else $(CYGPATH_W) '$(srcdir)/sfont/glfont.c'; fi`; \443 @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/glfont.Tpo" "$(DEPDIR)/glfont.Po"; else rm -f "$(DEPDIR)/glfont.Tpo"; exit 1; fi444 @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sfont/glfont.c' object='glfont.obj' libtool=no @AMDEPBACKSLASH@445 @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/glfont.Po' tmpdepfile='$(DEPDIR)/glfont.TPo' @AMDEPBACKSLASH@446 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@447 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o glfont.obj `if test -f 'sfont/glfont.c'; then $(CYGPATH_W) 'sfont/glfont.c'; else $(CYGPATH_W) '$(srcdir)/sfont/glfont.c'; fi`448 449 414 .cc.o: 450 415 @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ … … 558 523 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 559 524 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o fontset.obj `if test -f 'sfont/fontset.cc'; then $(CYGPATH_W) 'sfont/fontset.cc'; else $(CYGPATH_W) '$(srcdir)/sfont/fontset.cc'; fi` 525 526 glfont.o: sfont/glfont.cc 527 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT glfont.o -MD -MP -MF "$(DEPDIR)/glfont.Tpo" -c -o glfont.o `test -f 'sfont/glfont.cc' || echo '$(srcdir)/'`sfont/glfont.cc; \ 528 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/glfont.Tpo" "$(DEPDIR)/glfont.Po"; else rm -f "$(DEPDIR)/glfont.Tpo"; exit 1; fi 529 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='sfont/glfont.cc' object='glfont.o' libtool=no @AMDEPBACKSLASH@ 530 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/glfont.Po' tmpdepfile='$(DEPDIR)/glfont.TPo' @AMDEPBACKSLASH@ 531 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 532 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o glfont.o `test -f 'sfont/glfont.cc' || echo '$(srcdir)/'`sfont/glfont.cc 533 534 glfont.obj: sfont/glfont.cc 535 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT glfont.obj -MD -MP -MF "$(DEPDIR)/glfont.Tpo" -c -o glfont.obj `if test -f 'sfont/glfont.cc'; then $(CYGPATH_W) 'sfont/glfont.cc'; else $(CYGPATH_W) '$(srcdir)/sfont/glfont.cc'; fi`; \ 536 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/glfont.Tpo" "$(DEPDIR)/glfont.Po"; else rm -f "$(DEPDIR)/glfont.Tpo"; exit 1; fi 537 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='sfont/glfont.cc' object='glfont.obj' libtool=no @AMDEPBACKSLASH@ 538 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/glfont.Po' tmpdepfile='$(DEPDIR)/glfont.TPo' @AMDEPBACKSLASH@ 539 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 540 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o glfont.obj `if test -f 'sfont/glfont.cc'; then $(CYGPATH_W) 'sfont/glfont.cc'; else $(CYGPATH_W) '$(srcdir)/sfont/glfont.cc'; fi` 560 541 uninstall-info-am: 561 542 -
orxonox/trunk/src/console/Makefile.in
r3436 r3458 203 203 esac; \ 204 204 done; \ 205 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/console/Makefile'; \205 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/console/Makefile'; \ 206 206 cd $(top_srcdir) && \ 207 $(AUTOMAKE) -- foreignsrc/console/Makefile207 $(AUTOMAKE) --gnu src/console/Makefile 208 208 .PRECIOUS: Makefile 209 209 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status -
orxonox/trunk/src/gui/Makefile.in
r3436 r3458 234 234 esac; \ 235 235 done; \ 236 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/gui/Makefile'; \236 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/gui/Makefile'; \ 237 237 cd $(top_srcdir) && \ 238 $(AUTOMAKE) -- foreignsrc/gui/Makefile238 $(AUTOMAKE) --gnu src/gui/Makefile 239 239 .PRECIOUS: Makefile 240 240 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status -
orxonox/trunk/src/importer/Makefile.in
r3436 r3458 215 215 esac; \ 216 216 done; \ 217 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/importer/Makefile'; \217 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/importer/Makefile'; \ 218 218 cd $(top_srcdir) && \ 219 $(AUTOMAKE) -- foreignsrc/importer/Makefile219 $(AUTOMAKE) --gnu src/importer/Makefile 220 220 .PRECIOUS: Makefile 221 221 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status -
orxonox/trunk/src/sfont/fontset.h
r3456 r3458 9 9 loaded by orxonox Texture-class 10 10 */ 11 12 #ifndef _FONTSET_H 13 #define _FONTSET_H 11 14 12 15 class Texture; … … 45 48 46 49 }; 50 51 52 #endif /* _FONTSET_H */ -
orxonox/trunk/src/sfont/glfont.cc
r3457 r3458 44 44 */ 45 45 46 /* $Id: glfont.c,v 1.6 2004/01/04 17:41:55 slouken Exp $ */ 47 48 /* A simple program to test the text rendering feature of the TTF library */ 46 #include "glfont.h" 47 48 49 49 50 50 #include <stdlib.h> … … 56 56 57 57 #include "../glincl.h" 58 #include "../debug.h" 59 58 60 59 61 #define DEFAULT_PTSIZE 18 … … 61 63 #define NUM_COLORS 256 62 64 63 static char *Usage = 64 "Usage: %s [-utf8|-unicode] [-b] [-i] [-u] [-fgcol r,g,b] [-bgcol r,g,b] \ 65 <font>.ttf [ptsize] [text]\n"; 66 65 66 67 GLFont::GLFont() 68 { 69 this->init(""); 70 71 } 72 GLFont::GLFont(const char* fontFile) 73 { 74 this->init(fontFile); 75 } 76 GLFont::~GLFont() 77 { 78 79 } 80 81 bool GLFont::init(const char* fontFile) 82 { 83 // setting default values. 84 renderStyle = TTF_STYLE_NORMAL; 85 86 87 // Initializing lib-TTF if necesary. 88 if (TTF_WasInit() && TTF_Init() < 0 ) 89 { 90 PRINTF(1)("Couldn't initialize TTF: %s\n", SDL_GetError()); 91 return false; 92 } 93 } 94 95 bool GLFont::ttfInitialized = false; 96 97 bool GLFont::setFont(const char* fonFile) 98 { 99 100 } 101 void GLFont::setText(const char* text) 102 { 103 104 } 105 106 void GLFont::setStyle(char* style) 107 { 108 renderStyle = TTF_STYLE_NORMAL; 109 110 for (int i = 0; i < strlen(style); i++) 111 if (strncmp(style+i, "b", 1) == 0) 112 this->renderStyle |= TTF_STYLE_BOLD; 113 else if (strncmp(style+i, "i", 1) == 0) 114 this->renderStyle |= TTF_STYLE_ITALIC; 115 else if (strncmp(style+i, "u", 1) == 0) 116 this->renderStyle |= TTF_STYLE_UNDERLINE; 117 118 // TTF_SetFontStyle(font, renderstyle); 119 120 } 121 void GLFont::setSize(void) 122 { 123 124 } 125 void GLFont::setPosition(int x, int y) 126 { 127 128 } 129 130 void GLFont::renderText(void) 131 { 132 133 } 134 void GLFont::renderText(const char* text, int x, int y) 135 { 136 // enter the 2D-Mode 137 138 SDL_Surface *screen = SDL_GetVideoSurface(); 139 140 /* Note, there may be other things you need to change, 141 depending on how you have your OpenGL state set up. 142 */ 143 glPushAttrib(GL_ENABLE_BIT); 144 glDisable(GL_DEPTH_TEST); 145 glDisable(GL_CULL_FACE); 146 glEnable(GL_TEXTURE_2D); 147 148 /* This allows alpha blending of 2D textures with the scene */ 149 glEnable(GL_BLEND); 150 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 151 152 glViewport(0, 0, screen->w, screen->h); 153 154 glMatrixMode(GL_PROJECTION); 155 glPushMatrix(); 156 glLoadIdentity(); 157 158 glOrtho(0.0, (GLdouble)screen->w, (GLdouble)screen->h, 0.0, 0.0, 1.0); 159 160 glMatrixMode(GL_MODELVIEW); 161 glPushMatrix(); 162 glLoadIdentity(); 163 164 glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); 165 166 167 168 169 170 // Leave the 2D-Mode 171 glMatrixMode(GL_MODELVIEW); 172 glPopMatrix(); 173 174 glMatrixMode(GL_PROJECTION); 175 glPopMatrix(); 176 177 glPopAttrib(); 178 } 179 180 181 bool GLFont::loadTexture() 182 { 183 int w, h; 184 SDL_Surface *image; 185 SDL_Rect area; 186 Uint32 saved_flags; 187 Uint8 saved_alpha; 188 189 /* Use the surface width and height expanded to powers of 2 */ 190 w = powerOfTwo(surface->w); 191 h = powerOfTwo(surface->h); 192 texcoord[0] = 0.0f; /* Min X */ 193 texcoord[1] = 0.0f; /* Min Y */ 194 texcoord[2] = (GLfloat)surface->w / w; /* Max X */ 195 texcoord[3] = (GLfloat)surface->h / h; /* Max Y */ 196 197 image = SDL_CreateRGBSurface( 198 SDL_SWSURFACE, 199 w, h, 200 32, 201 #if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */ 202 0x000000FF, 203 0x0000FF00, 204 0x00FF0000, 205 0xFF000000 206 #else 207 0xFF000000, 208 0x00FF0000, 209 0x0000FF00, 210 0x000000FF 211 #endif 212 ); 213 if ( image == NULL ) { 214 return 0; 215 } 216 217 /* Save the alpha blending attributes */ 218 saved_flags = surface->flags&(SDL_SRCALPHA|SDL_RLEACCELOK); 219 saved_alpha = surface->format->alpha; 220 if ( (saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA ) { 221 SDL_SetAlpha(surface, 0, 0); 222 } 223 224 /* Copy the surface into the GL texture image */ 225 area.x = 0; 226 area.y = 0; 227 area.w = surface->w; 228 area.h = surface->h; 229 SDL_BlitSurface(surface, &area, image, &area); 230 231 /* Restore the alpha blending attributes */ 232 if ( (saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA ) { 233 SDL_SetAlpha(surface, saved_flags, saved_alpha); 234 } 235 236 /* Create an OpenGL texture for the image */ 237 glGenTextures(1, &texture); 238 glBindTexture(GL_TEXTURE_2D, texture); 239 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 240 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 241 glTexImage2D(GL_TEXTURE_2D, 242 0, 243 GL_RGBA, 244 w, h, 245 0, 246 GL_RGBA, 247 GL_UNSIGNED_BYTE, 248 image->pixels); 249 SDL_FreeSurface(image); /* No longer needed */ 250 251 // return texture; 252 } 253 254 /* Quick utility function for texture creation */ 255 int GLFont::powerOfTwo(int input) 256 { 257 int value = 1; 258 259 while ( value < input ) { 260 value <<= 1; 261 } 262 return value; 263 } 264 265 266 /* 267 private: 268 char* fontFile; 269 char* text; 270 int positionX; 271 int positionY; 272 */ 273 274 275 276 277 char Usage[100] = "orxonox test" ; 67 278 void SDL_GL_Enter2DMode() 68 279 { 69 SDL_Surface *screen = SDL_GetVideoSurface();70 71 /* Note, there may be other things you need to change,72 depending on how you have your OpenGL state set up.73 */74 glPushAttrib(GL_ENABLE_BIT);75 glDisable(GL_DEPTH_TEST);76 glDisable(GL_CULL_FACE);77 glEnable(GL_TEXTURE_2D);78 79 /* This allows alpha blending of 2D textures with the scene */80 glEnable(GL_BLEND);81 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);82 83 glViewport(0, 0, screen->w, screen->h);84 85 glMatrixMode(GL_PROJECTION);86 glPushMatrix();87 glLoadIdentity();88 89 glOrtho(0.0, (GLdouble)screen->w, (GLdouble)screen->h, 0.0, 0.0, 1.0);90 91 glMatrixMode(GL_MODELVIEW);92 glPushMatrix();93 glLoadIdentity();94 95 glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);96 280 } 97 281 98 282 void SDL_GL_Leave2DMode() 99 283 { 100 glMatrixMode(GL_MODELVIEW);101 glPopMatrix();102 103 glMatrixMode(GL_PROJECTION);104 glPopMatrix();105 106 glPopAttrib();107 284 } 108 285 … … 110 287 static int power_of_two(int input) 111 288 { 112 int value = 1; 113 114 while ( value < input ) { 115 value <<= 1; 116 } 117 return value; 118 } 289 } 290 291 119 292 120 293 GLuint SDL_GL_LoadTexture(SDL_Surface *surface, GLfloat *texcoord) 121 294 { 122 GLuint texture; 123 int w, h; 124 SDL_Surface *image; 125 SDL_Rect area; 126 Uint32 saved_flags; 127 Uint8 saved_alpha; 128 129 /* Use the surface width and height expanded to powers of 2 */ 130 w = power_of_two(surface->w); 131 h = power_of_two(surface->h); 132 texcoord[0] = 0.0f; /* Min X */ 133 texcoord[1] = 0.0f; /* Min Y */ 134 texcoord[2] = (GLfloat)surface->w / w; /* Max X */ 135 texcoord[3] = (GLfloat)surface->h / h; /* Max Y */ 136 137 image = SDL_CreateRGBSurface( 138 SDL_SWSURFACE, 139 w, h, 140 32, 141 #if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */ 142 0x000000FF, 143 0x0000FF00, 144 0x00FF0000, 145 0xFF000000 146 #else 147 0xFF000000, 148 0x00FF0000, 149 0x0000FF00, 150 0x000000FF 151 #endif 152 ); 153 if ( image == NULL ) { 154 return 0; 155 } 156 157 /* Save the alpha blending attributes */ 158 saved_flags = surface->flags&(SDL_SRCALPHA|SDL_RLEACCELOK); 159 saved_alpha = surface->format->alpha; 160 if ( (saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA ) { 161 SDL_SetAlpha(surface, 0, 0); 162 } 163 164 /* Copy the surface into the GL texture image */ 165 area.x = 0; 166 area.y = 0; 167 area.w = surface->w; 168 area.h = surface->h; 169 SDL_BlitSurface(surface, &area, image, &area); 170 171 /* Restore the alpha blending attributes */ 172 if ( (saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA ) { 173 SDL_SetAlpha(surface, saved_flags, saved_alpha); 174 } 175 176 /* Create an OpenGL texture for the image */ 177 glGenTextures(1, &texture); 178 glBindTexture(GL_TEXTURE_2D, texture); 179 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 180 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 181 glTexImage2D(GL_TEXTURE_2D, 182 0, 183 GL_RGBA, 184 w, h, 185 0, 186 GL_RGBA, 187 GL_UNSIGNED_BYTE, 188 image->pixels); 189 SDL_FreeSurface(image); /* No longer needed */ 190 191 return texture; 295 192 296 } 193 297 … … 223 327 dump = 0; 224 328 /* Look for special rendering types */ 225 renderstyle = TTF_STYLE_NORMAL;226 329 rendertype = RENDER_LATIN1; 227 330 /* Default is black and white */ … … 311 414 return(2); 312 415 } 313 TTF_SetFontStyle(font, renderstyle);314 416 315 417 if( dump ) { -
orxonox/trunk/src/world.cc
r3456 r3458 584 584 light->setAttenuation(CONSTANT, 2.0); 585 585 light->setAttenuation(QUADRATIC, 1.0); 586 light->setPosition(10.0, 1 .0,0.0);586 light->setPosition(10.0, 10.0, 50.0); 587 587 light->setDiffuseColor(1,1,1); 588 588 // light->addLight(1);
Note: See TracChangeset
for help on using the changeset viewer.