aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPierre Renaux <pierre@talansoft.com>2012-04-07 20:11:56 +0800
committerPierre Renaux <pierre@talansoft.com>2012-04-19 11:48:57 +0800
commitcceaa759b450cd2138be06ceb3a50dd27c7b959b (patch)
tree56233c349bfe24f62a92cbf65b44efdeee2bc1fd /tests
parent8356efd9a97bfbf69b7fc96df4012daa066e5d1f (diff)
[tests/hello_world_gles.c]: Added F11 to go in fullscreen mode (to test the glutFullScreen implementation) ;
Diffstat (limited to 'tests')
-rw-r--r--tests/hello_world_gles.c63
1 files changed, 33 insertions, 30 deletions
diff --git a/tests/hello_world_gles.c b/tests/hello_world_gles.c
index 6f7a4324..78595a49 100644
--- a/tests/hello_world_gles.c
+++ b/tests/hello_world_gles.c
@@ -1,16 +1,16 @@
/*
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
@@ -23,7 +23,7 @@
* Ported to GLES2.
* Kristian Høgsberg <krh@bitplanet.net>
* May 3, 2010
- *
+ *
* Improve GLES2 port:
* * Refactor gear drawing.
* * Use correct normals for surfaces.
@@ -113,15 +113,15 @@ static GLfloat ProjectionMatrix[16];
/** The direction of the directional light for the scene */
static const GLfloat LightSourcePosition[4] = { 5.0, 5.0, 10.0, 1.0};
-/**
+/**
* Fills a gear vertex.
- *
+ *
* @param v the vertex to fill
* @param x the x coordinate
* @param y the y coordinate
* @param z the z coortinate
- * @param n pointer to the normal table
- *
+ * @param n pointer to the normal table
+ *
* @return the operation error code
*/
static GearVertex *
@@ -139,13 +139,13 @@ vert(GearVertex *v, GLfloat x, GLfloat y, GLfloat z, GLfloat n[3])
/**
* Create a gear wheel.
- *
+ *
* @param inner_radius radius of hole at center
* @param outer_radius radius at center of teeth
* @param width width of gear
* @param teeth number of teeth
* @param tooth_depth depth of tooth
- *
+ *
* @return pointer to the constructed struct gear
*/
static struct gear *
@@ -289,11 +289,11 @@ create_gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width,
return gear;
}
-/**
+/**
* Multiplies two 4x4 matrices.
- *
+ *
* The result is stored in matrix m.
- *
+ *
* @param m the first matrix to multiply
* @param n the second matrix to multiply
*/
@@ -316,9 +316,9 @@ multiply(GLfloat *m, const GLfloat *n)
memcpy(m, &tmp, sizeof tmp);
}
-/**
+/**
* Rotates a 4x4 matrix.
- *
+ *
* @param[in,out] m the matrix to rotate
* @param angle the angle to rotate
* @param x the x component of the direction to rotate to
@@ -333,7 +333,7 @@ rotate(GLfloat *m, GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
sincos(angle, &s, &c);
GLfloat r[16] = {
x * x * (1 - c) + c, y * x * (1 - c) + z * s, x * z * (1 - c) - y * s, 0,
- x * y * (1 - c) - z * s, y * y * (1 - c) + c, y * z * (1 - c) + x * s, 0,
+ x * y * (1 - c) - z * s, y * y * (1 - c) + c, y * z * (1 - c) + x * s, 0,
x * z * (1 - c) + y * s, y * z * (1 - c) - x * s, z * z * (1 - c) + c, 0,
0, 0, 0, 1
};
@@ -342,9 +342,9 @@ rotate(GLfloat *m, GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
}
-/**
+/**
* Translates a 4x4 matrix.
- *
+ *
* @param[in,out] m the matrix to translate
* @param x the x component of the direction to translate to
* @param y the y component of the direction to translate to
@@ -358,9 +358,9 @@ translate(GLfloat *m, GLfloat x, GLfloat y, GLfloat z)
multiply(m, t);
}
-/**
+/**
* Creates an identity 4x4 matrix.
- *
+ *
* @param m the matrix make an identity matrix
*/
static void
@@ -376,12 +376,12 @@ identity(GLfloat *m)
memcpy(m, t, sizeof(t));
}
-/**
+/**
* Transposes a 4x4 matrix.
*
* @param m the matrix to transpose
*/
-static void
+static void
transpose(GLfloat *m)
{
GLfloat t[16] = {
@@ -420,9 +420,9 @@ invert(GLfloat *m)
multiply(m, t);
}
-/**
+/**
* Calculate a perspective projection transformation.
- *
+ *
* @param m the matrix to save the transformation in
* @param fovy the field of view in the y direction
* @param aspect the view aspect ratio
@@ -485,7 +485,7 @@ draw_gear(struct gear *gear, GLfloat *transform,
glUniformMatrix4fv(ModelViewProjectionMatrix_location, 1, GL_FALSE,
model_view_projection);
- /*
+ /*
* Create and set the NormalMatrix. It's the inverse transpose of the
* ModelView matrix.
*/
@@ -520,7 +520,7 @@ draw_gear(struct gear *gear, GLfloat *transform,
glDisableVertexAttribArray(0);
}
-/**
+/**
* Draws the gears.
*/
static void
@@ -549,9 +549,9 @@ gears_draw(void)
glutSwapBuffers();
}
-/**
+/**
* Handles a new window size or exposure.
- *
+ *
* @param width the window width
* @param height the window height
*/
@@ -565,9 +565,9 @@ gears_reshape(int width, int height)
glViewport(0, 0, (GLint) width, (GLint) height);
}
-/**
+/**
* Handles special glut events.
- *
+ *
* @param special the event to handle.
*/
static void
@@ -586,6 +586,9 @@ gears_special(int special, int crap, int morecrap)
case GLUT_KEY_DOWN:
view_rot[0] -= 5.0;
break;
+ case GLUT_KEY_F11:
+ glutFullScreen();
+ break;
}
}