iOS/buildlibs/armv7/allegro-4.4.2/addons/allegrogl/examp/excamera.c
/* Draws the overlay over the field. The position of the overlay is
 * independent of the camera.
 */
Draws the overlay over the field. The position of the overlay is
independent of the camera.
Draws the overlay over the field . The position of the overlay is independent of the camera .
void draw_overlay() {
	float heading, pitch, roll;
	int color;
	VECTOR v;
	glViewport(0, 0, SCREEN_W, SCREEN_H);
	allegro_gl_set_projection();
	glColor3ub(255, 0, 0);
	glDisable(GL_DEPTH_TEST);
	glBegin(GL_LINE_LOOP);
		glVertex2i((SCREEN_W - viewport_w) / 2, (SCREEN_H - viewport_h) / 2);
		glVertex2i((SCREEN_W + viewport_w) / 2 - 1,
		           (SCREEN_H - viewport_h) / 2);
		glVertex2i((SCREEN_W + viewport_w) / 2 - 1,
		           (SCREEN_H + viewport_h) / 2 - 1);
		glVertex2i((SCREEN_W - viewport_w) / 2,
		           (SCREEN_H + viewport_h) / 2 - 1);
	glEnd();
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	color = 0;
	glTranslatef(-0.375, -0.375, 0);
	allegro_gl_printf(agl_font, 0,  0, 0, color,
	                  "Viewport width:  %03d pix (w/W changes)", viewport_w);
	allegro_gl_printf(agl_font, 0,  8, 0, color,
	                  "Viewport height: %03d pix (h/H changes)", viewport_h);
	allegro_gl_printf(agl_font, 0, 16, 0, color,
	                  "Field Of View:    %02d deg (f/F changes)", fov);
	allegro_gl_printf(agl_font, 0, 24, 0, color,
	                  "Aspect Ratio:    %.2f   (a/A changes)", aspect);
	allegro_gl_printf(agl_font, 0, 32, 0, color,
	                  "X position:     %+.2f (x/X changes)", camera.position.x);
	allegro_gl_printf(agl_font, 0, 40, 0, color,
	                  "Y position:     %+.2f (y/Y changes)", camera.position.y);
	allegro_gl_printf(agl_font, 0, 48, 0, color,
	                  "Z position:     %+.2f (z/Z changes)", camera.position.z);
	convert_quat(&camera.orientation, &heading, &pitch, &roll);
	allegro_gl_printf(agl_font, 0, 56, 0, color,
	    "Heading:        %+.2f deg (left/right changes)", heading * 180 / M_PI);
	allegro_gl_printf(agl_font, 0, 64, 0, color,
	    "Pitch:          %+.2f deg (pgup/pgdn changes)", pitch * 180 / M_PI);
	allegro_gl_printf(agl_font, 0, 72, 0, color,
	    "Roll:           %+.2f deg (r/R changes)", roll * 180 / M_PI);
	apply_quat(&camera.orientation, 0, 0, -1, &v.x, &v.y, &v.z);
	allegro_gl_printf(agl_font, 0, 80, 0, color,
	                 "Front Vector:    %.2f, %.2f, %.2f", v.x, v.y, v.z);
	apply_quat(&camera.orientation, 0, 1, 0, &v.x, &v.y, &v.z);	
	allegro_gl_printf(agl_font, 0, 88, 0, color,
	                  "Up Vector:       %.2f, %.2f, %.2f", v.x, v.y, v.z);
	allegro_gl_printf(agl_font, 0, 96, 0, color,
	          "QUAT:  %f, %f, %f, %f ", camera.orientation.w,
	          camera.orientation.x, camera.orientation.y, camera.orientation.z);
	allegro_gl_unset_projection();
	glBlendFunc(GL_ONE, GL_ZERO);
	glEnable(GL_DEPTH_TEST);
}
void draw_overlay ( ) { float heading , pitch , roll ; int color ; VECTOR v ; glViewport ( 0 , 0 , SCREEN_W , SCREEN_H ) ; allegro_gl_set_projection ( ) ; glColor3ub ( 255 , 0 , 0 ) ; glDisable ( GL_DEPTH_TEST ) ; glBegin ( GL_LINE_LOOP ) ; glVertex2i ( ( SCREEN_W - viewport_w ) / 2 , ( SCREEN_H - viewport_h ) / 2 ) ; glVertex2i ( ( SCREEN_W + viewport_w ) / 2 - 1 , ( SCREEN_H - viewport_h ) / 2 ) ; glVertex2i ( ( SCREEN_W + viewport_w ) / 2 - 1 , ( SCREEN_H + viewport_h ) / 2 - 1 ) ; glVertex2i ( ( SCREEN_W - viewport_w ) / 2 , ( SCREEN_H + viewport_h ) / 2 - 1 ) ; glEnd ( ) ; glBlendFunc ( GL_SRC_ALPHA , GL_ONE_MINUS_SRC_ALPHA ) ; color = 0 ; glTranslatef ( -0.375 , -0.375 , 0 ) ; allegro_gl_printf ( agl_font , 0 , 0 , 0 , color , " " , viewport_w ) ; allegro_gl_printf ( agl_font , 0 , 8 , 0 , color , " " , viewport_h ) ; allegro_gl_printf ( agl_font , 0 , 16 , 0 , color , " " , fov ) ; allegro_gl_printf ( agl_font , 0 , 24 , 0 , color , " " , aspect ) ; allegro_gl_printf ( agl_font , 0 , 32 , 0 , color , " " , camera . position . x ) ; allegro_gl_printf ( agl_font , 0 , 40 , 0 , color , " " , camera . position . y ) ; allegro_gl_printf ( agl_font , 0 , 48 , 0 , color , " " , camera . position . z ) ; convert_quat ( & camera . orientation , & heading , & pitch , & roll ) ; allegro_gl_printf ( agl_font , 0 , 56 , 0 , color , " " , heading * 180 / M_PI ) ; allegro_gl_printf ( agl_font , 0 , 64 , 0 , color , " " , pitch * 180 / M_PI ) ; allegro_gl_printf ( agl_font , 0 , 72 , 0 , color , " " , roll * 180 / M_PI ) ; apply_quat ( & camera . orientation , 0 , 0 , -1 , & v . x , & v . y , & v . z ) ; allegro_gl_printf ( agl_font , 0 , 80 , 0 , color , " " , v . x , v . y , v . z ) ; apply_quat ( & camera . orientation , 0 , 1 , 0 , & v . x , & v . y , & v . z ) ; allegro_gl_printf ( agl_font , 0 , 88 , 0 , color , " " , v . x , v . y , v . z ) ; allegro_gl_printf ( agl_font , 0 , 96 , 0 , color , " " , camera . orientation . w , camera . orientation . x , camera . orientation . y , camera . orientation . z ) ; allegro_gl_unset_projection ( ) ; glBlendFunc ( GL_ONE , GL_ZERO ) ; glEnable ( GL_DEPTH_TEST ) ; }
Draws the overlay over the field.
Draws the overlay over the field .
/* Set up the viewport so that it takes up the whole screen */ /* Draw a line around the viewport */ /* Overlay some text describing the current situation */ /* Convert the orientation QUAT into heading, pitch and roll to display */