12#include "attributes.h"
16#define RMASK SDL_SwapLE32( 0x000000ff )
17#define GMASK SDL_SwapLE32( 0x0000ff00 )
18#define BMASK SDL_SwapLE32( 0x00ff0000 )
19#define AMASK SDL_SwapLE32( 0xff000000 )
20#define RGBAMASK RMASK, GMASK, BMASK, AMASK
25#define OPENGL_TEX_MAPTRANS ( 1 << 0 )
26#define OPENGL_TEX_MIPMAPS ( 1 << 1 )
27#define OPENGL_TEX_VFLIP \
30#define OPENGL_TEX_SKIPCACHE \
32#define OPENGL_TEX_SDF \
34#define OPENGL_TEX_CLAMP_ALPHA \
36#define OPENGL_TEX_NOTSRGB ( 1 << 6 )
43typedef struct glTexture_ {
77 unsigned int flags,
int sx,
int sy,
79USE_RESULT
glTexture *gl_loadImageData(
float *data,
int w,
int h,
int sx,
80 int sy,
const char *name );
84 const unsigned int flags );
86 const int sy,
const unsigned int flags );
88 const int sx,
const int sy,
89 const unsigned int flags );
102int gl_fboCreate( GLuint *fbo, GLuint *tex, GLsizei width, GLsizei height );
103int gl_fboAddDepth( GLuint fbo, GLuint *tex, GLsizei width, GLsizei height );
108void gl_contextSet(
void );
109void gl_contextUnset(
void );
glTexture * gl_dupTexture(const glTexture *texture)
Duplicates a texture.
USE_RESULT glTexture * gl_texExistsOrCreate(const char *path, unsigned int flags, int sx, int sy, int *created)
Check to see if a texture matching a path already exists.
glTexture * gl_newSprite(const char *path, const int sx, const int sy, const unsigned int flags)
Loads the texture immediately, but also sets it as a sprite.
void gl_exitTextures(void)
Cleans up the opengl texture subsystem.
glTexture * gl_newImageRWops(const char *path, SDL_RWops *rw, const unsigned int flags)
Loads an image as a texture.
USE_RESULT glTexture * gl_rawTexture(const char *name, GLuint texid, double w, double h)
Creates a texture from a raw opengl index.
int gl_fboCreate(GLuint *fbo, GLuint *tex, GLsizei width, GLsizei height)
Creates a framebuffer and its associated texture.
glTexture * gl_newSpriteRWops(const char *path, SDL_RWops *rw, const int sx, const int sy, const unsigned int flags)
Loads the texture immediately, but also sets it as a sprite.
glTexture ** gl_addTexArray(glTexture **tex, glTexture *t)
Adds an element to a texture array.
int gl_isTrans(const glTexture *t, const int x, const int y)
Checks to see if a pixel is transparent in a texture.
glTexture ** gl_copyTexArray(glTexture **tex)
Copy a texture array.
glTexture * gl_newImage(const char *path, const unsigned int flags)
Loads an image as a texture.
int gl_fboAddDepth(GLuint fbo, GLuint *tex, GLsizei width, GLsizei height)
Adds a depth attachment to an FBO.
void gl_getSpriteFromDir(int *x, int *y, int sx, int sy, double dir)
Sets x and y to be the appropriate sprite for glTexture using dir.
void gl_freeTexture(glTexture *texture)
Frees a texture.
int gl_initTextures(void)
Initializes the opengl texture subsystem.
Abstraction for rendering sprite sheets.