[Add] Documented opengl stuff.
This commit is contained in:
		
							parent
							
								
									3347a8b7cc
								
							
						
					
					
						commit
						2533dd816f
					
				| @ -2,6 +2,8 @@ | |||||||
|  * @file lfile.c |  * @file lfile.c | ||||||
|  * |  * | ||||||
|  * @brief Handle read/write abstractions to the users directory. |  * @brief Handle read/write abstractions to the users directory. | ||||||
|  |  * | ||||||
|  |  * @todo Add support for windows and mac OS. | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include <string.h> | #include <string.h> | ||||||
|  | |||||||
| @ -15,13 +15,10 @@ | |||||||
| #include "opengl.h" | #include "opengl.h" | ||||||
| 
 | 
 | ||||||
| /* Requirements. */ | /* 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; /**< Give data of current opengl settings. */ | ||||||
| glInfo gl_screen; | Vec2* gl_camera;  /**< Camera we are using. */ | ||||||
| 
 |  | ||||||
| /* Our precious camera. */ |  | ||||||
| Vec2* gl_camera; |  | ||||||
| 
 | 
 | ||||||
| /* offsets to Adjust the pilot's place onscreen */ | /* offsets to Adjust the pilot's place onscreen */ | ||||||
| /*to be in the middle, even with the GUI. */ | /*to be in the middle, even with the GUI. */ | ||||||
|  | |||||||
							
								
								
									
										54
									
								
								src/opengl.h
									
									
									
									
									
								
							
							
						
						
									
										54
									
								
								src/opengl.h
									
									
									
									
									
								
							| @ -20,31 +20,47 @@ | |||||||
| #define RGBAMASK RMASK,GMASK,BMASK,AMASK | #define RGBAMASK RMASK,GMASK,BMASK,AMASK | ||||||
| 
 | 
 | ||||||
| /* Info about opengl screen. */ | /* Info about opengl screen. */ | ||||||
| #define OPENGL_FULLSCREEN   (1<<0) | #define OPENGL_FULLSCREEN   (1<<0)    /**< Fullscreen. */ | ||||||
| #define OPENGL_DOUBLEBUF    (1<<1) | #define OPENGL_DOUBLEBUF    (1<<1)    /**< Doublebuffer. */ | ||||||
| #define OPENGL_AA_POINT     (1<<2) | #define OPENGL_AA_POINT     (1<<2)    /**< Antialiasing points. */ | ||||||
| #define OPENGL_AA_LINE      (1<<3) | #define OPENGL_AA_LINE      (1<<3)    /**< Antialiasing lines. */ | ||||||
| #define OPENGL_AA_POLYGON   (1<<4) | #define OPENGL_AA_POLYGON   (1<<4)    /**< Antialiasing polygons. */ | ||||||
| #define OPENGL_FRAG_SHADER  (1<<5) | #define OPENGL_FRAG_SHADER  (1<<5)    /**< Fragment shaders. */ | ||||||
| #define OPENGL_VERT_SHADER  (1<<6) | #define OPENGL_VERT_SHADER  (1<<6)    /**< Vertex shaders. */ | ||||||
| #define gl_has(f)           (gl_screen.flags & (f)) /* Check for the flag. */ | #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_ { | typedef struct glInfo_ { | ||||||
|   int w, h;         /* Window dimensions. */ |   int w;            /**< Window width. */ | ||||||
|   int depth;        /* Depth in bpp. */ |   int h;            /**< Window height. */ | ||||||
|   int r, g, b, a;   /* Framebuffer values in bits. */ |   int depth;        /**< Depth in bpp. */ | ||||||
|   int flags;        /* Store different properties. */ |   int r;            /**< Amount of red bits. */ | ||||||
|   int tex_max;      /* Max texture size. */ |   int g;            /**< Amount of green bits. */ | ||||||
|   int multitex_max; /* Max multitexture levels. */ |   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; | } glInfo; | ||||||
| extern glInfo gl_screen; /* Local structure set with gl_init etc. */ | extern glInfo gl_screen; /* Local structure set with gl_init etc. */ | ||||||
| 
 | 
 | ||||||
| #define SCREEN_W      gl_screen.w | #define SCREEN_W      gl_screen.w   /**< Screen width. */ | ||||||
| #define SCREEN_H      gl_screen.h | #define SCREEN_H      gl_screen.h   /**< Screen height. */ | ||||||
| 
 | 
 | ||||||
| #define COLOUR(x)     glColor4d((x).r, (x).g, (x).b, (x).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) | #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_ { | typedef struct glTexture_ { | ||||||
|   char* name;         /**< Name of graphic. */ |   char* name;         /**< Name of graphic. */ | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Allanis
						Allanis