Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

convgltex.cpp File Reference

SDL surface conversion to OpenGL texture formats. More...

#include "Teddy/TeddyConfig.h"
#include <SDL.h>
#include <cstring>

Include dependency graph for convgltex.cpp:

Include dependency graph

Go to the source code of this file.

Functions

SDL_Surface * conv_surf_gl (SDL_Surface *s, int want_alpha)
 Convert surface for OpenGL. More...

SDL_Surface * load_gl_texture (const char *file)


Detailed Description

SDL surface conversion to OpenGL texture formats.

Author:
Mattias Engdegård
Use, modification and distribution of this source is allowed without limitation, warranty or liability of any kind.

Definition in file convgltex.cpp.


Function Documentation

SDL_Surface* conv_surf_gl SDL_Surface *    s,
int    want_alpha
 

Convert surface for OpenGL.

Bug:
Crashes with some tga images if SDL_FreeSurface(s) is enabled

Convert a surface into one suitable as an OpenGL texture; in RGBA format if want_alpha is nonzero, or in RGB format otherwise.

The surface may have a colourkey, which is then translated to an alpha channel if RGBA is desired.

Return the resulting texture, or NULL on error. The original surface is always freed.

Definition at line 33 of file convgltex.cpp.

SDL_Surface* load_gl_texture const char *    file
 

A sample use of conv_surf_gl():

Load an image from a file, and convert it to RGB or RGBA format, depending on the image.

Return the resulting surface, or NULL on error

Definition at line 121 of file convgltex.cpp.

References conv_surf_gl.