iOS/buildlibs/armv7/allegro-4.4.2/addons/allegrogl/src/glvtable.c
/** \ingroup allegro
  * Prepares for Allegro drawing to the screen.
  *
  * This function sets the OpenGL projection and modelview matrices so
  * that 2D OpenGL coordinates match the usual Allegro coordinate system.
  *
  * OpenGL uses a completely different coordinate system than Allegro. So
  * to be able to use Allegro operations on the screen, you first need
  * to properly set up the OpenGL projection and modelview matrices.
  * AllegroGL provides this set of functions to allow proper alignment of
  * OpenGL coordinates with their Allegro counterparts.
  *
  * Since AllegroGL actually calls OpenGL commands to perform Allegro functions
  * for 2D drawing, some OpenGL capabilities such as texturing or depth testing
  * may interfer with those operations. In order to prevent such inconveniences,
  * you should call allegro_gl_set_allegro_mode() instead of
  * allegro_gl_set_projection()
  *
  * allegro_gl_set_projection() and allegro_gl_unset_projection() are not
  * nestable, which means that you should not call allegro_gl_set_projection()
  * inside another allegro_gl_set_projection() block. Similarly for
  * allegro_gl_unset_projection().
  *
  * Have a look at examp/exalleg.c for an example of
  * combining Allegro drawing commands and OpenGL.
  *
  * \sa allegro_gl_unset_projection() allegro_gl_set_allegro_mode()
  * \sa allegro_gl_unset_allegro_mode()
  */
\ingroup allegro
Prepares for Allegro drawing to the screen.

This function sets the OpenGL projection and modelview matrices so
that 2D OpenGL coordinates match the usual Allegro coordinate system.

OpenGL uses a completely different coordinate system than Allegro. So
to be able to use Allegro operations on the screen, you first need
to properly set up the OpenGL projection and modelview matrices.
AllegroGL provides this set of functions to allow proper alignment of
OpenGL coordinates with their Allegro counterparts.

Since AllegroGL actually calls OpenGL commands to perform Allegro functions
for 2D drawing, some OpenGL capabilities such as texturing or depth testing
may interfer with those operations. In order to prevent such inconveniences,
you should call allegro_gl_set_allegro_mode() instead of
allegro_gl_set_projection()

allegro_gl_set_projection() and allegro_gl_unset_projection() are not
nestable, which means that you should not call allegro_gl_set_projection()
inside another allegro_gl_set_projection() block.

Have a look at examp/exalleg.c for an example of
combining Allegro drawing commands and OpenGL.


\ ingroup allegro Prepares for Allegro drawing to the screen . This function sets the OpenGL projection and modelview matrices so that 2D OpenGL coordinates match the usual Allegro coordinate system . OpenGL uses a completely different coordinate system than Allegro . So to be able to use Allegro operations on the screen you first need to properly set up the OpenGL projection and modelview matrices . AllegroGL provides this set of functions to allow proper alignment of OpenGL coordinates with their Allegro counterparts . Since AllegroGL actually calls OpenGL commands to perform Allegro functions for 2D drawing some OpenGL capabilities such as texturing or depth testing may interfer with those operations . In order to prevent such inconveniences you should call allegro_gl_set_allegro_mode () instead of allegro_gl_set_projection () allegro_gl_set_projection () and allegro_gl_unset_projection () are not nestable which means that you should not call allegro_gl_set_projection () inside another allegro_gl_set_projection () block . Have a look at examp / exalleg . c for an example of combining Allegro drawing commands and OpenGL .
void allegro_gl_set_projection(void)
{
	GLint v[4];
	AGL_LOG(2, "glvtable.c:allegro_gl_set_projection\n");
	glGetIntegerv(GL_VIEWPORT, &v[0]);
	glMatrixMode(GL_MODELVIEW);
	glGetDoublev(GL_MODELVIEW_MATRIX, allegro_gl_modelview_matrix);
	glLoadIdentity();
	glMatrixMode(GL_PROJECTION);
	glGetDoublev(GL_PROJECTION_MATRIX, allegro_gl_projection_matrix);
	glLoadIdentity();
	gluOrtho2D(v[0] - 0.325, v[0] + v[2] - 0.325, v[1] + v[3] - 0.325, v[1] - 0.325);
}
void allegro_gl_set_projection ( void ) { GLint v [ 4 ] ; AGL_LOG ( 2 , " \n " ) ; glGetIntegerv ( GL_VIEWPORT , & v [ 0 ] ) ; glMatrixMode ( GL_MODELVIEW ) ; glGetDoublev ( GL_MODELVIEW_MATRIX , allegro_gl_modelview_matrix ) ; glLoadIdentity ( ) ; glMatrixMode ( GL_PROJECTION ) ; glGetDoublev ( GL_PROJECTION_MATRIX , allegro_gl_projection_matrix ) ; glLoadIdentity ( ) ; gluOrtho2D ( v [ 0 ] - 0.325 , v [ 0 ] + v [ 2 ] - 0.325 , v [ 1 ] + v [ 3 ] - 0.325 , v [ 1 ] - 0.325 ) ; }
\ingroup allegro
 Prepares for Allegro drawing to the screen.
\ ingroup allegro Prepares for Allegro drawing to the screen .
/* Setup OpenGL matrices */