Skip to content

Commit

Permalink
[tests/hello_world_gles.c]: Added F11 to go in fullscreen mode (to te…
Browse files Browse the repository at this point in the history
…st the glutFullScreen implementation) ;
  • Loading branch information
prenaux committed Apr 19, 2012
1 parent 8356efd commit cceaa75
Showing 1 changed file with 33 additions and 30 deletions.
63 changes: 33 additions & 30 deletions tests/hello_world_gles.c
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -23,7 +23,7 @@
* Ported to GLES2.
* Kristian Høgsberg <[email protected]>
* May 3, 2010
*
*
* Improve GLES2 port:
* * Refactor gear drawing.
* * Use correct normals for surfaces.
Expand Down Expand Up @@ -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 *
Expand All @@ -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 *
Expand Down Expand Up @@ -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
*/
Expand All @@ -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
Expand All @@ -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
};
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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] = {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
*/
Expand Down Expand Up @@ -520,7 +520,7 @@ draw_gear(struct gear *gear, GLfloat *transform,
glDisableVertexAttribArray(0);
}

/**
/**
* Draws the gears.
*/
static void
Expand Down Expand Up @@ -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
*/
Expand All @@ -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
Expand All @@ -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;
}
}

Expand Down

0 comments on commit cceaa75

Please sign in to comment.