iOS/buildlibs/armv7/allegro-4.4.2/addons/allegrogl/src/glvtable.c
/** \ingroup allegro
  * Prepares for Allegro drawing to the screen.
  *
  * Since AllegroGL actually calls OpenGL commands to perform Allegro functions
  * for 2D drawing, some OpenGL capabilities may interfer with those operations
  * In order to obtain the expected results, allegro_gl_set_allegro_mode() must
  * be called to disable the depth test, texturing, fog and lighting and set
  * the view matrices to an appropriate state. Call
  * allegro_gl_unset_allegro_mode() to restore OpenGL in its previous state.
  *
  * You should encapsulate all Allegro code dealing with the screen in
  * between allegro_gl_set_allegro_mode() and allegro_gl_unset_allegro_mode().
  *
  * If you need to use regular OpenGL commands in between, you may do so,
  * but you can get unexpected results. This is generally not recommended.
  * You should first call allegro_gl_unset_allegro_mode() to restore the
  * original OpenGL matrices. After that, you may freely call any OpenGL
  * command. Don't forget to call back allegro_gl_set_allegro_mode() to switch
  * back to Allegro commands.
  *
  * AllegroGL saves the current OpenGL state with glPushAttrib so you should
  * make sure that at least one level is available in the attribute stack
  * otherwise the next call to allegro_gl_unset_allegro_mode() may fail.
  *
  * Also note that allegro_gl_set_allegro_mode() implicitely calls
  * allegro_gl_set_projection() so you do not need to do it yourself.
  *
  * \sa	allegro_gl_unset_allegro_mode() allegro_gl_set_projection()
  * \sa allegro_gl_unset_projection()
  */
\ingroup allegro
Prepares for Allegro drawing to the screen.

Since AllegroGL actually calls OpenGL commands to perform Allegro functions
for 2D drawing, some OpenGL capabilities may interfer with those operations
In order to obtain the expected results, allegro_gl_set_allegro_mode() must
be called to disable the depth test, texturing, fog and lighting and set
the view matrices to an appropriate state. Call
allegro_gl_unset_allegro_mode() to restore OpenGL in its previous state.

You should encapsulate all Allegro code dealing with the screen in
between allegro_gl_set_allegro_mode() and allegro_gl_unset_allegro_mode().

If you need to use regular OpenGL commands in between, you may do so,
but you can get unexpected results. This is generally not recommended.
You should first call allegro_gl_unset_allegro_mode() to restore the
original OpenGL matrices. After that, you may freely call any OpenGL
command. Don't forget to call back allegro_gl_set_allegro_mode() to switch
back to Allegro commands.

AllegroGL saves the current OpenGL state with glPushAttrib so you should
make sure that at least one level is available in the attribute stack
otherwise the next call to allegro_gl_unset_allegro_mode() may fail.

Also note that allegro_gl_set_allegro_mode() implicitely calls
allegro_gl_set_projection() so you do not need to do it yourself.


\ ingroup allegro Prepares for Allegro drawing to the screen . Since AllegroGL actually calls OpenGL commands to perform Allegro functions for 2D drawing some OpenGL capabilities may interfer with those operations In order to obtain the expected results allegro_gl_set_allegro_mode () must be called to disable the depth test texturing fog and lighting and set the view matrices to an appropriate state . Call allegro_gl_unset_allegro_mode () to restore OpenGL in its previous state . You should encapsulate all Allegro code dealing with the screen in between allegro_gl_set_allegro_mode () and allegro_gl_unset_allegro_mode () . If you need to use regular OpenGL commands in between you may do so but you can get unexpected results . This is generally not recommended . You should first call allegro_gl_unset_allegro_mode () to restore the original OpenGL matrices . After that you may freely call any OpenGL command . Don ' t forget to call back allegro_gl_set_allegro_mode () to switch back to Allegro commands . AllegroGL saves the current OpenGL state with glPushAttrib so you should make sure that at least one level is available in the attribute stack otherwise the next call to allegro_gl_unset_allegro_mode () may fail . Also note that allegro_gl_set_allegro_mode () implicitely calls allegro_gl_set_projection () so you do not need to do it yourself .
void allegro_gl_set_allegro_mode(void)
{
	AGL_LOG(2, "glvtable.c:allegro_gl_set_allegro_mode\n");
	glPushAttrib(GL_ENABLE_BIT | GL_TEXTURE_BIT | GL_TRANSFORM_BIT
	           | GL_POINT_BIT | GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glDisable(GL_DEPTH_TEST);
	glDisable(GL_CULL_FACE);
	glDisable(GL_FOG);
	glDisable(GL_LIGHTING);
	glDisable(GL_BLEND);
	glDisable(GL_ALPHA_TEST);
	glDepthMask(GL_FALSE);
	glEnable(GL_TEXTURE_2D);
	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
	glPointSize(1.);
	if (!__allegro_gl_pool_texture) {
		glGenTextures(1, &__allegro_gl_pool_texture);
	}
	glBindTexture(GL_TEXTURE_2D, __allegro_gl_pool_texture);
	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 256, 256, 0,
	             GL_RGBA, GL_UNSIGNED_BYTE, NULL);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
	glBindTexture(GL_TEXTURE_2D, 0);
	allegro_gl_set_projection();
	if (allegro_gl_info.is_ati_rage_pro) {
		if (!__allegro_gl_dummy_texture) {
			GLubyte tex[4] = {255, 255, 255, 255};
			glGenTextures(1, &__allegro_gl_dummy_texture);
			glBindTexture(GL_TEXTURE_2D, __allegro_gl_dummy_texture);
			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0,
			             GL_RGBA, GL_UNSIGNED_BYTE, tex);
		}
		glBindTexture(GL_TEXTURE_2D, __allegro_gl_dummy_texture);
	}
#ifdef ALLEGRO_MACOSX
	glBegin(GL_POINTS);
	glEnd();
#endif
}
void allegro_gl_set_allegro_mode ( void ) { AGL_LOG ( 2 , " \n " ) ; glPushAttrib ( GL_ENABLE_BIT | GL_TEXTURE_BIT | GL_TRANSFORM_BIT | GL_POINT_BIT | GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ) ; glDisable ( GL_DEPTH_TEST ) ; glDisable ( GL_CULL_FACE ) ; glDisable ( GL_FOG ) ; glDisable ( GL_LIGHTING ) ; glDisable ( GL_BLEND ) ; glDisable ( GL_ALPHA_TEST ) ; glDepthMask ( GL_FALSE ) ; glEnable ( GL_TEXTURE_2D ) ; glTexEnvi ( GL_TEXTURE_ENV , GL_TEXTURE_ENV_MODE , GL_REPLACE ) ; glPointSize ( 1. ) ; if ( ! __allegro_gl_pool_texture ) { glGenTextures ( 1 , & __allegro_gl_pool_texture ) ; } glBindTexture ( GL_TEXTURE_2D , __allegro_gl_pool_texture ) ; glTexImage2D ( GL_TEXTURE_2D , 0 , GL_RGBA , 256 , 256 , 0 , GL_RGBA , GL_UNSIGNED_BYTE , NULL ) ; glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_MIN_FILTER , GL_NEAREST ) ; glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_MAG_FILTER , GL_NEAREST ) ; glBindTexture ( GL_TEXTURE_2D , 0 ) ; allegro_gl_set_projection ( ) ; if ( allegro_gl_info . is_ati_rage_pro ) { if ( ! __allegro_gl_dummy_texture ) { GLubyte tex [ 4 ] = { 255 , 255 , 255 , 255 } ; glGenTextures ( 1 , & __allegro_gl_dummy_texture ) ; glBindTexture ( GL_TEXTURE_2D , __allegro_gl_dummy_texture ) ; glTexImage2D ( GL_TEXTURE_2D , 0 , GL_RGBA , 1 , 1 , 0 , GL_RGBA , GL_UNSIGNED_BYTE , tex ) ; } glBindTexture ( GL_TEXTURE_2D , __allegro_gl_dummy_texture ) ; } #ifdef ALLEGRO_MACOSX glBegin ( GL_POINTS ) ; glEnd ( ) ; #endif }
\ingroup allegro
 Prepares for Allegro drawing to the screen.
\ ingroup allegro Prepares for Allegro drawing to the screen .
/* Save the OpenGL state  then set it up */ /* Create pool texture */ /* Create a texture without defining the data */ /* For some reason, ATI Rage Pro isn't able to draw correctly without a
	 * texture bound. So we bind a dummy 1x1 texture to work around the issue.
	 */ /* MacOSX 10.2.x has a bug: glRasterPos causes a crash (it is used in
	 *'blit'). This stops it happening.
	 */