The Allegro Wiki is migrating to github at https://github.com/liballeg/allegro_wiki/wiki

RenderState

From Allegro Wiki
Jump to: navigation, search
/* Clears the depth buffer to the specified value. */

void al_clear_depth_buffer(float x);



/* Updates the given render state (for the current target bitmap). */

void al_set_render_state(ALLEGRO_RENDER_STATE state, int value);



enum ALLEGRO_RENDER_STATE {
   /* combination of ALLEGRO_BITMAP_WRITE_FLAGS, default is 0 */
   // in Opengl this is glColorMask and glDepthMask
   
   ALLEGRO_WRITE_MASK,

   /* 1 or 0, default is 0. If 0 the depth buffer is not used at all, neither
    * read nor writen. If 1 ALLEGRO_WRITE_MASK and ALLEGRO_DEPTH_FUNCTION
    * specify whether it is written and how it is compared.
    */
   // in OpenGL this is glEnable(GL_DEPTH_TEST)
   
   ALLEGRO_DEPTH_TEST,

   /* one of ALLEGRO_RENDER_FUNCTION, default is NEVER */
   // in OpenGL this is glDepthFunc
   
   ALLEGRO_DEPTH_FUNCTION,

   /* 1 or 0, default is 0. If 0 all pixels are always written no matter the
    * alpha value.
    */
   // in OpenGL this is glEnable(GL_ALPHA_TEST)
   
   ALLEGRO_RENDER_STATE_ALPHA_TEST = ALLEGRO_ALPHA_TEST,

   /* one of ALLEGRO_RENDER_FUNCTION, default is NEVER */
   // in OpenGL this is glAlphaFunc
   
   ALLEGRO_ALPHA_FUNCTION,
};



enum ALLEGRO_RENDER_FUNCTION {
   ALLEGRO_RENDER_NEVER,
   ALLEGRO_RENDER_ALWAYS,
   ALLEGRO_RENDER_LESS, 
   ALLEGRO_RENDER_EQUAL,     
   ALLEGRO_RENDER_LESS_EQUAL,       
   ALLEGRO_RENDER_GREATER,        
   ALLEGRO_RENDER_NOT_EQUAL, 
   ALLEGRO_RENDER_GREATER_EQUAL,
};



enum ALLEGRO_WRITE_MASK_FLAGS {
   ALLEGRO_MASK_RED = 1 << 0,
   ALLEGRO_MASK_GREEN = 1 << 1,
   ALLEGRO_MASK_BLUE = 1 << 2,
   ALLEGRO_MASK_ALPHA = 1 << 3,
   ALLEGRO_MASK_DEPTH = 1 << 4,
};