[Add] Documented opengl stuff.

This commit is contained in:
Allanis 2013-10-22 18:29:07 +01:00
parent 3347a8b7cc
commit 2533dd816f
3 changed files with 40 additions and 25 deletions

View File

@ -2,6 +2,8 @@
* @file lfile.c
*
* @brief Handle read/write abstractions to the users directory.
*
* @todo Add support for windows and mac OS.
*/
#include <string.h>

View File

@ -15,13 +15,10 @@
#include "opengl.h"
/* Requirements. */
#define OPENGL_REQ_MULTITEX 2 /* 2 is minimum OpenGL 1.2. Must have. */
#define OPENGL_REQ_MULTITEX 2 /**< 2 is minimum OpenGL 1.2. Must have. */
/* The screen info, gives data of current opengl settings. */
glInfo gl_screen;
/* Our precious camera. */
Vec2* gl_camera;
glInfo gl_screen; /**< Give data of current opengl settings. */
Vec2* gl_camera; /**< Camera we are using. */
/* offsets to Adjust the pilot's place onscreen */
/*to be in the middle, even with the GUI. */

View File

@ -20,31 +20,47 @@
#define RGBAMASK RMASK,GMASK,BMASK,AMASK
/* Info about opengl screen. */
#define OPENGL_FULLSCREEN (1<<0)
#define OPENGL_DOUBLEBUF (1<<1)
#define OPENGL_AA_POINT (1<<2)
#define OPENGL_AA_LINE (1<<3)
#define OPENGL_AA_POLYGON (1<<4)
#define OPENGL_FRAG_SHADER (1<<5)
#define OPENGL_VERT_SHADER (1<<6)
#define gl_has(f) (gl_screen.flags & (f)) /* Check for the flag. */
#define OPENGL_FULLSCREEN (1<<0) /**< Fullscreen. */
#define OPENGL_DOUBLEBUF (1<<1) /**< Doublebuffer. */
#define OPENGL_AA_POINT (1<<2) /**< Antialiasing points. */
#define OPENGL_AA_LINE (1<<3) /**< Antialiasing lines. */
#define OPENGL_AA_POLYGON (1<<4) /**< Antialiasing polygons. */
#define OPENGL_FRAG_SHADER (1<<5) /**< Fragment shaders. */
#define OPENGL_VERT_SHADER (1<<6) /**< Vertex shaders. */
#define gl_has(f) (gl_screen.flags & (f)) /**< Check for the flag. */
/**
* @struct glInfo
*
* @brief Store data about the current opengl environment.
*/
typedef struct glInfo_ {
int w, h; /* Window dimensions. */
int depth; /* Depth in bpp. */
int r, g, b, a; /* Framebuffer values in bits. */
int flags; /* Store different properties. */
int tex_max; /* Max texture size. */
int multitex_max; /* Max multitexture levels. */
int w; /**< Window width. */
int h; /**< Window height. */
int depth; /**< Depth in bpp. */
int r; /**< Amount of red bits. */
int g; /**< Amount of green bits. */
int b; /**< Amount of blue bits. */
int a; /**< Amount of alpha bits. */
int flags; /**< Store different properties. */
int tex_max; /**< Max texture size. */
int multitex_max; /**< Max multitexture levels. */
} glInfo;
extern glInfo gl_screen; /* Local structure set with gl_init etc. */
#define SCREEN_W gl_screen.w
#define SCREEN_H gl_screen.h
#define SCREEN_W gl_screen.w /**< Screen width. */
#define SCREEN_H gl_screen.h /**< Screen height. */
#define COLOUR(x) glColor4d((x).r, (x).g, (x).b, (x).a)
#define ACOLOUR(x,a) glColor4d((x).r, (x).g, (x).b, a)
#define COLOUR(x) glColor4d((x).r, (x).g, (x).b, (x).a) /**< Change colour. */
#define ACOLOUR(x,a) glColor4d((x).r, (x).g, (x).b, a) /**< Change colour and override alpha. */
/* Spritesheet info. */
/**
* @struct glTexture
*
* @brief Abstraction for rendering spritesheets.
*
* The basic unit all the graphic rendering works with.
*/
typedef struct glTexture_ {
char* name; /**< Name of graphic. */