maug
Quick and dirty C mini-augmentation library.
Loading...
Searching...
No Matches
RetroGLU API

Library of tools for working with RetroFlat and OpenGL. More...

Collaboration diagram for RetroGLU API:

Topics

 RetroGLU OBJ Parser
 
 RetroGLU Sprites
 
 RetroGLU Overlay API
 Convenience macros for drawing a 2D overlay using transparent textures.
 

Files

file  retroglu.h
 Library of tools for working with RetroFlat and OpenGL.
 

Data Structures

struct  RETROGLU_VERTEX
 
struct  RETROGLU_VTEXTURE
 
struct  RETROGLU_MATERIAL
 
struct  RETROGLU_FACE
 
struct  RETROGLU_OBJ
 
struct  RETROGLU_PROJ_ARGS
 

Macros

#define RETROGLU_PARSER_ERROR   -1
 
#define RETROGLU_PARSER_TOKEN_SZ_MAX   32
 
#define RETROGLU_TRACE_LVL   0
 
#define RETROGLU_SPRITE_TEX_FRAMES_SZ   10
 
#define glShininessf(side, light, f)
 
#define RETROGLU_FACE_VERTICES_SZ_MAX   3
 
#define RETROGLU_MATERIAL_NAME_SZ_MAX   32
 
#define RETROGLU_MATERIAL_LIB_SZ_MAX   32
 
#define RETROGLU_VERTICES_SZ_MAX   1024
 
#define RETROGLU_FACES_SZ_MAX   1024
 
#define RETROGLU_MATERIALS_SZ_MAX   1024
 
#define RETROGLU_PROJ_ORTHO   0
 
#define RETROGLU_PROJ_FRUSTUM   1
 
#define retroglu_enable_lightning()
 
#define retroglu_disable_lightning()
 
#define retroglu_tex_px_x_to_f(px, sprite)
 
#define retroglu_tex_px_y_to_f(px, sprite)
 
#define retroglu_scr_px_x_to_f(px)
 
#define retroglu_scr_px_y_to_f(py)
 
#define retroglu_set_sprite_tex(sprite, texture_id, bmp_w, bmp_h)
 
#define retroglu_set_sprite_color(sprite, color_in)
 
#define RETROFLAT_COLOR_TABLE_GL(idx, name_l, name_u, r, g, b, cgac, cgad)
 

Typedefs

typedef float RETROGLU_COLOR[4]
 

Functions

void retroglu_draw_poly (struct RETROGLU_OBJ *obj)
 
void retroglu_set_tile_clip (struct RETROGLU_TILE *tile, uint32_t px, uint32_t py, uint32_t pw, uint32_t ph, uint8_t flags)
 
void retroglu_set_sprite_clip (struct RETROGLU_SPRITE *sprite, uint32_t front_px, uint32_t front_py, uint32_t back_px, uint32_t back_py, uint32_t pw, uint32_t ph, uint8_t flags)
 
void retroglu_init_sprite_vertices (struct RETROGLU_SPRITE *sprite)
 Setup the sprite vertices for the poly the sprite will be drawn on. This should be called once when the sprite is initialized, but calling it again later shouldn't hurt.
 
void retroglu_init_sprite_vertices_scale (struct RETROGLU_SPRITE *sprite, float scale)
 
void retroglu_set_sprite_pos (struct RETROGLU_SPRITE *sprite, uint32_t px, uint32_t py)
 
void retroglu_tsrot_sprite (struct RETROGLU_SPRITE *sprite)
 
void retroglu_draw_sprite (struct RETROGLU_SPRITE *sprite)
 Draw the given sprite. This function never uses a list, and can therefore be used to create a draw list.
 
void retroglu_prerender_sprite (struct RETROGLU_SPRITE *sprite, int list_idx, uint32_t front_px, uint32_t front_py, uint32_t back_px, uint32_t back_py, uint32_t pw, uint32_t ph, uint8_t flags)
 If lists are enabled, prerender the sprite to a list using the given params to retroglu_set_sprite_clip().
 
void retroglu_jitrender_sprite (struct RETROGLU_SPRITE *sprite, int list_idx)
 If lists are enabled, render the sprite list at list_idx. Otherwise, draw the sprite using retroglu_draw_sprite().
 
void retroglu_free_sprite (struct RETROGLU_SPRITE *sprite)
 
MERROR_RETVAL retroglu_init_glyph_tex ()
 
void retroglu_destroy_glyph_tex ()
 
void retroglu_string (float x, float y, float z, const RETROGLU_COLOR color, const char *str, size_t str_sz, const char *font_str, uint8_t flags)
 
MERROR_RETVAL retroglu_check_errors (const char *desc)
 
int retroglu_draw_release (struct RETROFLAT_BITMAP *bmp)
 
MERROR_RETVAL retroglu_blit_bitmap (struct RETROFLAT_BITMAP *target, struct RETROFLAT_BITMAP *src, size_t s_x, size_t s_y, size_t d_x, size_t d_y, size_t w, size_t h, int16_t instance)
 

Detailed Description

Library of tools for working with RetroFlat and OpenGL.

Macro Definition Documentation

◆ glShininessf

#define glShininessf ( side,
light,
f )
Value:
glMaterialf( side, light, f )

◆ RETROFLAT_COLOR_TABLE_GL

#define RETROFLAT_COLOR_TABLE_GL ( idx,
name_l,
name_u,
r,
g,
b,
cgac,
cgad )
Value:
extern MAUG_CONST float RETROGLU_COLOR_ ## name_u[];

◆ retroglu_disable_lightning

#define retroglu_disable_lightning ( )
Value:
glDisable( GL_LIGHTING )

◆ retroglu_enable_lightning

#define retroglu_enable_lightning ( )
Value:
glEnable( GL_LIGHTING )

◆ retroglu_scr_px_x_to_f

#define retroglu_scr_px_x_to_f ( px)
Value:
(float)(((px) * 1.0 / (retroflat_screen_w() / 2)) - 1.0)
#define retroflat_screen_w()
Get the current screen width in pixels.
Definition retpltd.h:35

◆ retroglu_scr_px_y_to_f

#define retroglu_scr_px_y_to_f ( py)
Value:
(float)(((py) * 1.0 / (retroflat_screen_h() / 2)) - 1.0)
#define retroflat_screen_h()
Get the current screen height in pixels.
Definition retpltd.h:38

◆ retroglu_set_sprite_color

#define retroglu_set_sprite_color ( sprite,
color_in )
Value:
memcpy( (sprite)->color, (color_in), 3 * sizeof( float ) )

◆ retroglu_set_sprite_tex

#define retroglu_set_sprite_tex ( sprite,
texture_id,
bmp_w,
bmp_h )
Value:
sprite->texture_id = texture_id; \
sprite->texture_w = bmp_w; \
sprite->texture_h = bmp_h;

◆ retroglu_tex_px_x_to_f

#define retroglu_tex_px_x_to_f ( px,
sprite )
Value:
((px) * 1.0 / sprite->texture.tex.w)

◆ retroglu_tex_px_y_to_f

#define retroglu_tex_px_y_to_f ( px,
sprite )
Value:
((px) * 1.0 / sprite->texture.tex.h)

Function Documentation

◆ retroglu_prerender_sprite()

void retroglu_prerender_sprite ( struct RETROGLU_SPRITE * sprite,
int list_idx,
uint32_t front_px,
uint32_t front_py,
uint32_t back_px,
uint32_t back_py,
uint32_t pw,
uint32_t ph,
uint8_t flags )

If lists are enabled, prerender the sprite to a list using the given params to retroglu_set_sprite_clip().

Note
If lists are not enabled, this call does nothing.