Commit dec4792d authored by Paul Berry's avatar Paul Berry Committed by Chad Versace

shader_runner: Added a variant of the "ortho" command that takes parameters

This allows shader_runner tests to specify explicit left, right,
bottom, and top values rather than the default of (0, window width, 0,
window height).
Reviewed-by: chadversary's avatarChad Versace <chad@chad-versace.us>
parent 1df50656
......@@ -886,6 +886,10 @@ piglit_display(void)
do_enable_disable(line + 7, false);
} else if (string_match("enable", line)) {
do_enable_disable(line + 6, true);
} else if (sscanf(line, "ortho %f %f %f %f",
c + 0, c + 1, c + 2, c + 3) == 4) {
piglit_gen_ortho_projection(c[0], c[1], c[2], c[3],
-1, 1, GL_FALSE);
} else if (string_match("ortho", line)) {
piglit_ortho_projection(piglit_width, piglit_height,
GL_FALSE);
......
......@@ -731,19 +731,18 @@ piglit_draw_rect_tex(float x, float y, float w, float h,
/**
* Convenience function to configure projection matrix for window coordinates
* Convenience function to configure an abitrary orthogonal projection matrix
*/
void
piglit_ortho_projection(int w, int h, GLboolean push)
piglit_gen_ortho_projection(double left, double right, double bottom,
double top, double near_val, double far_val,
GLboolean push)
{
/* Set up projection matrix so we can just draw using window
* coordinates.
*/
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if (push)
glPushMatrix();
glOrtho(0, w, 0, h, -1, 1);
glOrtho(left, right, bottom, top, near_val, far_val);
glMatrixMode(GL_MODELVIEW);
if (push)
......@@ -752,6 +751,19 @@ piglit_ortho_projection(int w, int h, GLboolean push)
}
/**
* Convenience function to configure projection matrix for window coordinates
*/
void
piglit_ortho_projection(int w, int h, GLboolean push)
{
/* Set up projection matrix so we can just draw using window
* coordinates.
*/
piglit_gen_ortho_projection(0, w, 0, h, -1, 1, push);
}
/**
* Generate a checkerboard texture
......
......@@ -147,6 +147,9 @@ void piglit_escape_exit_key(unsigned char key, int x, int y);
char *piglit_load_text_file(const char *file_name, unsigned *size);
void piglit_gen_ortho_projection(double left, double right, double bottom,
double top, double near_val, double far_val,
GLboolean push);
void piglit_ortho_projection(int w, int h, GLboolean push);
GLuint piglit_checkerboard_texture(GLuint tex, unsigned level,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment