Added ESC key handling
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: renormal.c,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
|
/* $Id: renormal.c,v 1.2 1999/09/17 02:40:51 tjump Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Test GL_EXT_rescale_normal extension
|
* Test GL_EXT_rescale_normal extension
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Id: renormal.c,v 1.1 1999/08/19 00:55:40 jtg Exp $
|
* $Id: renormal.c,v 1.2 1999/09/17 02:40:51 tjump Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -95,6 +95,18 @@ static void ModeMenu(int entry)
|
|||||||
glutPostRedisplay();
|
glutPostRedisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
key(unsigned char k, int x, int y)
|
||||||
|
{
|
||||||
|
switch (k) {
|
||||||
|
case 27: /* Escape */
|
||||||
|
exit(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
glutPostRedisplay();
|
||||||
|
}
|
||||||
|
|
||||||
int main( int argc, char *argv[] )
|
int main( int argc, char *argv[] )
|
||||||
{
|
{
|
||||||
@@ -110,6 +122,7 @@ int main( int argc, char *argv[] )
|
|||||||
glutIdleFunc( Idle );
|
glutIdleFunc( Idle );
|
||||||
glutReshapeFunc( Reshape );
|
glutReshapeFunc( Reshape );
|
||||||
glutDisplayFunc( Display );
|
glutDisplayFunc( Display );
|
||||||
|
glutKeyboardFunc(key);
|
||||||
|
|
||||||
glutCreateMenu(ModeMenu);
|
glutCreateMenu(ModeMenu);
|
||||||
glutAddMenuEntry("Unscaled", UNSCALED);
|
glutAddMenuEntry("Unscaled", UNSCALED);
|
||||||
|
@@ -149,6 +149,19 @@ void myReshape(int w, int h)
|
|||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
key(unsigned char k, int x, int y)
|
||||||
|
{
|
||||||
|
switch (k) {
|
||||||
|
case 27: /* Escape */
|
||||||
|
exit(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
glutPostRedisplay();
|
||||||
|
}
|
||||||
|
|
||||||
/* Main Loop
|
/* Main Loop
|
||||||
* Open window with initial window size, title bar,
|
* Open window with initial window size, title bar,
|
||||||
* RGBA display mode, and handle input events.
|
* RGBA display mode, and handle input events.
|
||||||
@@ -163,6 +176,7 @@ int main(int argc, char** argv)
|
|||||||
myinit();
|
myinit();
|
||||||
glutReshapeFunc (myReshape);
|
glutReshapeFunc (myReshape);
|
||||||
glutDisplayFunc(display);
|
glutDisplayFunc(display);
|
||||||
|
glutKeyboardFunc(key);
|
||||||
glutMainLoop();
|
glutMainLoop();
|
||||||
return 0; /* ANSI C requires main to return int. */
|
return 0; /* ANSI C requires main to return int. */
|
||||||
}
|
}
|
||||||
|
@@ -93,6 +93,19 @@ void myReshape(int w, int h)
|
|||||||
glTranslatef (0.0, 0.0, -4.0); /* move object into view */
|
glTranslatef (0.0, 0.0, -4.0); /* move object into view */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
key(unsigned char k, int x, int y)
|
||||||
|
{
|
||||||
|
switch (k) {
|
||||||
|
case 27: /* Escape */
|
||||||
|
exit(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
glutPostRedisplay();
|
||||||
|
}
|
||||||
|
|
||||||
/* Main Loop
|
/* Main Loop
|
||||||
* Open window with initial window size, title bar,
|
* Open window with initial window size, title bar,
|
||||||
* RGBA display mode, and handle input events.
|
* RGBA display mode, and handle input events.
|
||||||
@@ -105,7 +118,7 @@ int main(int argc, char** argv)
|
|||||||
myinit();
|
myinit();
|
||||||
glutReshapeFunc (myReshape);
|
glutReshapeFunc (myReshape);
|
||||||
glutDisplayFunc(display);
|
glutDisplayFunc(display);
|
||||||
|
glutKeyboardFunc(key);
|
||||||
glutMainLoop();
|
glutMainLoop();
|
||||||
return 0; /* ANSI C requires main to return int. */
|
return 0; /* ANSI C requires main to return int. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -134,6 +134,19 @@ myReshape(int w, int h)
|
|||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
key(unsigned char k, int x, int y)
|
||||||
|
{
|
||||||
|
switch (k) {
|
||||||
|
case 27: /* Escape */
|
||||||
|
exit(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
glutPostRedisplay();
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
@@ -143,6 +156,7 @@ main(int argc, char **argv)
|
|||||||
myinit();
|
myinit();
|
||||||
glutReshapeFunc(myReshape);
|
glutReshapeFunc(myReshape);
|
||||||
glutDisplayFunc(display);
|
glutDisplayFunc(display);
|
||||||
|
glutKeyboardFunc(key);
|
||||||
glutMainLoop();
|
glutMainLoop();
|
||||||
return 0; /* ANSI C requires main to return int. */
|
return 0; /* ANSI C requires main to return int. */
|
||||||
}
|
}
|
||||||
|
@@ -55,7 +55,7 @@ void makeCheckImage(void)
|
|||||||
|
|
||||||
for (i = 0; i < checkImageWidth; i++) {
|
for (i = 0; i < checkImageWidth; i++) {
|
||||||
for (j = 0; j < checkImageHeight; j++) {
|
for (j = 0; j < checkImageHeight; j++) {
|
||||||
c = ((((i&0x8)==0)^((j&0x8))==0))*255;
|
c = ((((i&0x8)==0)^((j&0x8)==0)))*255;
|
||||||
checkImage[i][j][0] = (GLubyte) c;
|
checkImage[i][j][0] = (GLubyte) c;
|
||||||
checkImage[i][j][1] = (GLubyte) c;
|
checkImage[i][j][1] = (GLubyte) c;
|
||||||
checkImage[i][j][2] = (GLubyte) c;
|
checkImage[i][j][2] = (GLubyte) c;
|
||||||
@@ -111,6 +111,19 @@ void myReshape(int w, int h)
|
|||||||
glTranslatef(0.0, 0.0, -3.6);
|
glTranslatef(0.0, 0.0, -3.6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
key(unsigned char k, int x, int y)
|
||||||
|
{
|
||||||
|
switch (k) {
|
||||||
|
case 27: /* Escape */
|
||||||
|
exit(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
glutPostRedisplay();
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char** argv)
|
main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
@@ -120,6 +133,7 @@ main(int argc, char** argv)
|
|||||||
myinit();
|
myinit();
|
||||||
glutReshapeFunc (myReshape);
|
glutReshapeFunc (myReshape);
|
||||||
glutDisplayFunc(display);
|
glutDisplayFunc(display);
|
||||||
|
glutKeyboardFunc(key);
|
||||||
glutMainLoop();
|
glutMainLoop();
|
||||||
return 0; /* ANSI C requires main to return int. */
|
return 0; /* ANSI C requires main to return int. */
|
||||||
}
|
}
|
||||||
|
@@ -86,6 +86,19 @@ void myReshape(int w, int h)
|
|||||||
glTranslatef (0.0, 0.0, -4.0); /* move object into view */
|
glTranslatef (0.0, 0.0, -4.0); /* move object into view */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
key(unsigned char k, int x, int y)
|
||||||
|
{
|
||||||
|
switch (k) {
|
||||||
|
case 27: /* Escape */
|
||||||
|
exit(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
glutPostRedisplay();
|
||||||
|
}
|
||||||
|
|
||||||
/* Main Loop
|
/* Main Loop
|
||||||
*/
|
*/
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
@@ -96,7 +109,7 @@ int main(int argc, char** argv)
|
|||||||
myinit();
|
myinit();
|
||||||
glutReshapeFunc(myReshape);
|
glutReshapeFunc(myReshape);
|
||||||
glutDisplayFunc(display);
|
glutDisplayFunc(display);
|
||||||
|
glutKeyboardFunc(key);
|
||||||
glutMainLoop();
|
glutMainLoop();
|
||||||
return 0; /* ANSI C requires main to return int. */
|
return 0; /* ANSI C requires main to return int. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -219,6 +219,19 @@ void myReshape(int w, int h)
|
|||||||
glViewport(0, 0, w, h);
|
glViewport(0, 0, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
key(unsigned char k, int x, int y)
|
||||||
|
{
|
||||||
|
switch (k) {
|
||||||
|
case 27: /* Escape */
|
||||||
|
exit(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
glutPostRedisplay();
|
||||||
|
}
|
||||||
|
|
||||||
/* Main Loop
|
/* Main Loop
|
||||||
* Open window with initial window size, title bar,
|
* Open window with initial window size, title bar,
|
||||||
* RGBA display mode, depth buffer, and handle input events.
|
* RGBA display mode, depth buffer, and handle input events.
|
||||||
@@ -232,7 +245,7 @@ int main(int argc, char** argv)
|
|||||||
myinit();
|
myinit();
|
||||||
glutReshapeFunc(myReshape);
|
glutReshapeFunc(myReshape);
|
||||||
glutDisplayFunc(display);
|
glutDisplayFunc(display);
|
||||||
|
glutKeyboardFunc(key);
|
||||||
glutMainLoop();
|
glutMainLoop();
|
||||||
return 0; /* ANSI C requires main to return int. */
|
return 0; /* ANSI C requires main to return int. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -99,6 +99,19 @@ void mouse(int button, int state, int x, int y)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
key(unsigned char k, int x, int y)
|
||||||
|
{
|
||||||
|
switch (k) {
|
||||||
|
case 27: /* Escape */
|
||||||
|
exit(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
glutPostRedisplay();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Request double buffer display mode.
|
* Request double buffer display mode.
|
||||||
* Register mouse input callback functions
|
* Register mouse input callback functions
|
||||||
@@ -114,6 +127,7 @@ int main(int argc, char** argv)
|
|||||||
glutDisplayFunc(display);
|
glutDisplayFunc(display);
|
||||||
glutReshapeFunc(reshape);
|
glutReshapeFunc(reshape);
|
||||||
glutMouseFunc(mouse);
|
glutMouseFunc(mouse);
|
||||||
|
glutKeyboardFunc(key);
|
||||||
glutMainLoop();
|
glutMainLoop();
|
||||||
return 0; /* ANSI C requires main to return int. */
|
return 0; /* ANSI C requires main to return int. */
|
||||||
}
|
}
|
||||||
|
@@ -161,6 +161,19 @@ myReshape(int w, int h)
|
|||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
key(unsigned char k, int x, int y)
|
||||||
|
{
|
||||||
|
switch (k) {
|
||||||
|
case 27: /* Escape */
|
||||||
|
exit(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
glutPostRedisplay();
|
||||||
|
}
|
||||||
|
|
||||||
/* Main Loop
|
/* Main Loop
|
||||||
* Open window with initial window size, title bar,
|
* Open window with initial window size, title bar,
|
||||||
* RGBA display mode, depth buffer, and handle input events.
|
* RGBA display mode, depth buffer, and handle input events.
|
||||||
@@ -181,6 +194,7 @@ main(int argc, char **argv)
|
|||||||
glutAddMenuEntry("Fog LINEAR", GL_LINEAR);
|
glutAddMenuEntry("Fog LINEAR", GL_LINEAR);
|
||||||
glutAddMenuEntry("Quit", 0);
|
glutAddMenuEntry("Quit", 0);
|
||||||
glutAttachMenu(GLUT_RIGHT_BUTTON);
|
glutAttachMenu(GLUT_RIGHT_BUTTON);
|
||||||
|
glutKeyboardFunc(key);
|
||||||
glutMainLoop();
|
glutMainLoop();
|
||||||
return 0; /* ANSI C requires main to return int. */
|
return 0; /* ANSI C requires main to return int. */
|
||||||
}
|
}
|
||||||
|
@@ -120,6 +120,19 @@ myReshape(int w, int h)
|
|||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
key(unsigned char k, int x, int y)
|
||||||
|
{
|
||||||
|
switch (k) {
|
||||||
|
case 27: /* Escape */
|
||||||
|
exit(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
glutPostRedisplay();
|
||||||
|
}
|
||||||
|
|
||||||
/* Main Loop
|
/* Main Loop
|
||||||
* Open window with initial window size, title bar,
|
* Open window with initial window size, title bar,
|
||||||
* RGBA display mode, depth buffer, and handle input events.
|
* RGBA display mode, depth buffer, and handle input events.
|
||||||
@@ -133,6 +146,7 @@ main(int argc, char **argv)
|
|||||||
myinit();
|
myinit();
|
||||||
glutReshapeFunc(myReshape);
|
glutReshapeFunc(myReshape);
|
||||||
glutDisplayFunc(display);
|
glutDisplayFunc(display);
|
||||||
|
glutKeyboardFunc(key);
|
||||||
glutMainLoop();
|
glutMainLoop();
|
||||||
return 0; /* ANSI C requires main to return int. */
|
return 0; /* ANSI C requires main to return int. */
|
||||||
}
|
}
|
||||||
|
@@ -74,6 +74,19 @@ void init (void)
|
|||||||
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
|
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
key(unsigned char k, int x, int y)
|
||||||
|
{
|
||||||
|
switch (k) {
|
||||||
|
case 27: /* Escape */
|
||||||
|
exit(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
glutPostRedisplay();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Declare initial window size, position, and display mode
|
* Declare initial window size, position, and display mode
|
||||||
* (single buffer and RGBA). Open window with "hello"
|
* (single buffer and RGBA). Open window with "hello"
|
||||||
@@ -90,6 +103,7 @@ int main(int argc, char** argv)
|
|||||||
glutCreateWindow ("hello");
|
glutCreateWindow ("hello");
|
||||||
init ();
|
init ();
|
||||||
glutDisplayFunc(display);
|
glutDisplayFunc(display);
|
||||||
|
glutKeyboardFunc(key);
|
||||||
glutMainLoop();
|
glutMainLoop();
|
||||||
return 0; /* ANSI C requires main to return int. */
|
return 0; /* ANSI C requires main to return int. */
|
||||||
}
|
}
|
||||||
|
@@ -274,6 +274,19 @@ void myReshape(int w, int h)
|
|||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
key(unsigned char k, int x, int y)
|
||||||
|
{
|
||||||
|
switch (k) {
|
||||||
|
case 27: /* Escape */
|
||||||
|
exit(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
glutPostRedisplay();
|
||||||
|
}
|
||||||
|
|
||||||
/* Main Loop
|
/* Main Loop
|
||||||
* Open window with initial window size, title bar,
|
* Open window with initial window size, title bar,
|
||||||
* RGBA display mode, and handle input events.
|
* RGBA display mode, and handle input events.
|
||||||
@@ -287,7 +300,7 @@ int main(int argc, char** argv)
|
|||||||
myinit();
|
myinit();
|
||||||
glutReshapeFunc(myReshape);
|
glutReshapeFunc(myReshape);
|
||||||
glutDisplayFunc(display);
|
glutDisplayFunc(display);
|
||||||
|
glutKeyboardFunc(key);
|
||||||
glutMainLoop();
|
glutMainLoop();
|
||||||
return 0; /* ANSI C requires main to return int. */
|
return 0; /* ANSI C requires main to return int. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -150,6 +150,19 @@ void myReshape(int w, int h)
|
|||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
key(unsigned char k, int x, int y)
|
||||||
|
{
|
||||||
|
switch (k) {
|
||||||
|
case 27: /* Escape */
|
||||||
|
exit(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
glutPostRedisplay();
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
glutInit(&argc, argv);
|
glutInit(&argc, argv);
|
||||||
@@ -159,7 +172,7 @@ int main(int argc, char** argv)
|
|||||||
myinit();
|
myinit();
|
||||||
glutReshapeFunc (myReshape);
|
glutReshapeFunc (myReshape);
|
||||||
glutDisplayFunc(display);
|
glutDisplayFunc(display);
|
||||||
|
glutKeyboardFunc(key);
|
||||||
glutMainLoop();
|
glutMainLoop();
|
||||||
return 0; /* ANSI C requires main to return int. */
|
return 0; /* ANSI C requires main to return int. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -159,6 +159,19 @@ void myReshape(int w, int h)
|
|||||||
gluLookAt(7.0,4.5,4.0, 4.5,4.5,2.0, 6.0,-3.0,2.0);
|
gluLookAt(7.0,4.5,4.0, 4.5,4.5,2.0, 6.0,-3.0,2.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
key(unsigned char k, int x, int y)
|
||||||
|
{
|
||||||
|
switch (k) {
|
||||||
|
case 27: /* Escape */
|
||||||
|
exit(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
glutPostRedisplay();
|
||||||
|
}
|
||||||
|
|
||||||
/* Main Loop
|
/* Main Loop
|
||||||
* Open window with initial window size, title bar,
|
* Open window with initial window size, title bar,
|
||||||
* RGBA display mode, and handle input events.
|
* RGBA display mode, and handle input events.
|
||||||
@@ -171,6 +184,7 @@ int main(int argc, char** argv)
|
|||||||
myinit();
|
myinit();
|
||||||
glutReshapeFunc (myReshape);
|
glutReshapeFunc (myReshape);
|
||||||
glutDisplayFunc(display);
|
glutDisplayFunc(display);
|
||||||
|
glutKeyboardFunc(key);
|
||||||
glutMainLoop();
|
glutMainLoop();
|
||||||
return 0; /* ANSI C requires main to return int. */
|
return 0; /* ANSI C requires main to return int. */
|
||||||
}
|
}
|
||||||
|
@@ -183,6 +183,19 @@ myReshape(int w, int h)
|
|||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
key(unsigned char k, int x, int y)
|
||||||
|
{
|
||||||
|
switch (k) {
|
||||||
|
case 27: /* Escape */
|
||||||
|
exit(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
glutPostRedisplay();
|
||||||
|
}
|
||||||
|
|
||||||
/* Main Loop
|
/* Main Loop
|
||||||
* Open window with initial window size, title bar,
|
* Open window with initial window size, title bar,
|
||||||
* RGBA display mode, depth buffer, and handle input events.
|
* RGBA display mode, depth buffer, and handle input events.
|
||||||
@@ -198,6 +211,7 @@ main(int argc, char **argv)
|
|||||||
glutMouseFunc(pickRects);
|
glutMouseFunc(pickRects);
|
||||||
glutReshapeFunc(myReshape);
|
glutReshapeFunc(myReshape);
|
||||||
glutDisplayFunc(display);
|
glutDisplayFunc(display);
|
||||||
|
glutKeyboardFunc(key);
|
||||||
glutMainLoop();
|
glutMainLoop();
|
||||||
return 0; /* ANSI C requires main to return int. */
|
return 0; /* ANSI C requires main to return int. */
|
||||||
}
|
}
|
||||||
|
@@ -139,6 +139,19 @@ void myReshape(int w, int h)
|
|||||||
glMatrixMode (GL_MODELVIEW);
|
glMatrixMode (GL_MODELVIEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
key(unsigned char k, int x, int y)
|
||||||
|
{
|
||||||
|
switch (k) {
|
||||||
|
case 27: /* Escape */
|
||||||
|
exit(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
glutPostRedisplay();
|
||||||
|
}
|
||||||
|
|
||||||
/* Main Loop
|
/* Main Loop
|
||||||
* Open window with initial window size, title bar,
|
* Open window with initial window size, title bar,
|
||||||
* RGBA display mode, and handle input events.
|
* RGBA display mode, and handle input events.
|
||||||
@@ -152,6 +165,7 @@ int main(int argc, char** argv)
|
|||||||
myinit();
|
myinit();
|
||||||
glutReshapeFunc (myReshape);
|
glutReshapeFunc (myReshape);
|
||||||
glutDisplayFunc(display);
|
glutDisplayFunc(display);
|
||||||
|
glutKeyboardFunc(key);
|
||||||
glutMainLoop();
|
glutMainLoop();
|
||||||
return 0; /* ANSI C requires main to return int. */
|
return 0; /* ANSI C requires main to return int. */
|
||||||
}
|
}
|
||||||
|
@@ -209,6 +209,19 @@ void keyboard (unsigned char key, int x, int y)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
key(unsigned char k, int x, int y)
|
||||||
|
{
|
||||||
|
switch (k) {
|
||||||
|
case 27: /* Escape */
|
||||||
|
exit(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
glutPostRedisplay();
|
||||||
|
}
|
||||||
|
|
||||||
/* Main Loop
|
/* Main Loop
|
||||||
* Open window with initial window size, title bar,
|
* Open window with initial window size, title bar,
|
||||||
* RGBA display mode, and handle input events.
|
* RGBA display mode, and handle input events.
|
||||||
@@ -223,6 +236,7 @@ int main(int argc, char** argv)
|
|||||||
glutMouseFunc(mouse);
|
glutMouseFunc(mouse);
|
||||||
glutKeyboardFunc(keyboard);
|
glutKeyboardFunc(keyboard);
|
||||||
gfxinit();
|
gfxinit();
|
||||||
|
glutKeyboardFunc(key);
|
||||||
glutMainLoop();
|
glutMainLoop();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -106,6 +106,19 @@ static void reshape(GLsizei w, GLsizei h)
|
|||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
key(unsigned char k, int x, int y)
|
||||||
|
{
|
||||||
|
switch (k) {
|
||||||
|
case 27: /* Escape */
|
||||||
|
exit(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
glutPostRedisplay();
|
||||||
|
}
|
||||||
|
|
||||||
/* Main Loop
|
/* Main Loop
|
||||||
* Open window with initial window size, title bar,
|
* Open window with initial window size, title bar,
|
||||||
* RGBA display mode, and handle input events.
|
* RGBA display mode, and handle input events.
|
||||||
@@ -119,6 +132,7 @@ int main(int argc, char** argv)
|
|||||||
myinit ();
|
myinit ();
|
||||||
glutDisplayFunc(display);
|
glutDisplayFunc(display);
|
||||||
glutReshapeFunc(reshape);
|
glutReshapeFunc(reshape);
|
||||||
|
glutKeyboardFunc(key);
|
||||||
glutMainLoop();
|
glutMainLoop();
|
||||||
return 0; /* ANSI C requires main to return int. */
|
return 0; /* ANSI C requires main to return int. */
|
||||||
}
|
}
|
||||||
|
@@ -109,6 +109,19 @@ void myReshape(int w, int h)
|
|||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
key(unsigned char k, int x, int y)
|
||||||
|
{
|
||||||
|
switch (k) {
|
||||||
|
case 27: /* Escape */
|
||||||
|
exit(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
glutPostRedisplay();
|
||||||
|
}
|
||||||
|
|
||||||
/* Main Loop
|
/* Main Loop
|
||||||
* Open window with initial window size, title bar,
|
* Open window with initial window size, title bar,
|
||||||
* RGBA display mode, and handle input events.
|
* RGBA display mode, and handle input events.
|
||||||
@@ -122,6 +135,7 @@ int main(int argc, char** argv)
|
|||||||
myinit();
|
myinit();
|
||||||
glutReshapeFunc (myReshape);
|
glutReshapeFunc (myReshape);
|
||||||
glutDisplayFunc(display);
|
glutDisplayFunc(display);
|
||||||
|
glutKeyboardFunc(key);
|
||||||
glutMainLoop();
|
glutMainLoop();
|
||||||
return 0; /* ANSI C requires main to return int. */
|
return 0; /* ANSI C requires main to return int. */
|
||||||
}
|
}
|
||||||
|
@@ -109,6 +109,19 @@ void myReshape(int w, int h)
|
|||||||
glMatrixMode (GL_MODELVIEW);
|
glMatrixMode (GL_MODELVIEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
key(unsigned char k, int x, int y)
|
||||||
|
{
|
||||||
|
switch (k) {
|
||||||
|
case 27: /* Escape */
|
||||||
|
exit(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
glutPostRedisplay();
|
||||||
|
}
|
||||||
|
|
||||||
/* Main Loop
|
/* Main Loop
|
||||||
* Open window with initial window size, title bar,
|
* Open window with initial window size, title bar,
|
||||||
* RGBA display mode, and handle input events.
|
* RGBA display mode, and handle input events.
|
||||||
@@ -122,6 +135,7 @@ int main(int argc, char** argv)
|
|||||||
myinit ();
|
myinit ();
|
||||||
glutReshapeFunc (myReshape);
|
glutReshapeFunc (myReshape);
|
||||||
glutDisplayFunc(display);
|
glutDisplayFunc(display);
|
||||||
|
glutKeyboardFunc(key);
|
||||||
glutMainLoop();
|
glutMainLoop();
|
||||||
return 0; /* ANSI C requires main to return int. */
|
return 0; /* ANSI C requires main to return int. */
|
||||||
}
|
}
|
||||||
|
@@ -108,6 +108,19 @@ void myReshape(int w, int h)
|
|||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
key(unsigned char k, int x, int y)
|
||||||
|
{
|
||||||
|
switch (k) {
|
||||||
|
case 27: /* Escape */
|
||||||
|
exit(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
glutPostRedisplay();
|
||||||
|
}
|
||||||
|
|
||||||
/* Main Loop
|
/* Main Loop
|
||||||
* Open window with initial window size, title bar,
|
* Open window with initial window size, title bar,
|
||||||
* RGBA display mode, and handle input events.
|
* RGBA display mode, and handle input events.
|
||||||
@@ -121,6 +134,7 @@ int main(int argc, char** argv)
|
|||||||
myinit();
|
myinit();
|
||||||
glutReshapeFunc (myReshape);
|
glutReshapeFunc (myReshape);
|
||||||
glutDisplayFunc(display);
|
glutDisplayFunc(display);
|
||||||
|
glutKeyboardFunc(key);
|
||||||
glutMainLoop();
|
glutMainLoop();
|
||||||
return 0; /* ANSI C requires main to return int. */
|
return 0; /* ANSI C requires main to return int. */
|
||||||
}
|
}
|
||||||
|
@@ -108,6 +108,19 @@ void myReshape(int w, int h)
|
|||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
key(unsigned char k, int x, int y)
|
||||||
|
{
|
||||||
|
switch (k) {
|
||||||
|
case 27: /* Escape */
|
||||||
|
exit(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
glutPostRedisplay();
|
||||||
|
}
|
||||||
|
|
||||||
/* Main Loop
|
/* Main Loop
|
||||||
* Open window with initial window size, title bar,
|
* Open window with initial window size, title bar,
|
||||||
* RGBA display mode, and handle input events.
|
* RGBA display mode, and handle input events.
|
||||||
@@ -121,6 +134,7 @@ int main(int argc, char** argv)
|
|||||||
myinit();
|
myinit();
|
||||||
glutReshapeFunc (myReshape);
|
glutReshapeFunc (myReshape);
|
||||||
glutDisplayFunc(display);
|
glutDisplayFunc(display);
|
||||||
|
glutKeyboardFunc(key);
|
||||||
glutMainLoop();
|
glutMainLoop();
|
||||||
return 0; /* ANSI C requires main to return int. */
|
return 0; /* ANSI C requires main to return int. */
|
||||||
}
|
}
|
||||||
|
@@ -144,6 +144,19 @@ void myReshape(int w, int h)
|
|||||||
glTranslatef(0.0, 0.0, -5.0);
|
glTranslatef(0.0, 0.0, -5.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
key(unsigned char k, int x, int y)
|
||||||
|
{
|
||||||
|
switch (k) {
|
||||||
|
case 27: /* Escape */
|
||||||
|
exit(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
glutPostRedisplay();
|
||||||
|
}
|
||||||
|
|
||||||
/* Main Loop
|
/* Main Loop
|
||||||
* Open window with initial window size, title bar,
|
* Open window with initial window size, title bar,
|
||||||
* RGBA display mode, and handle input events.
|
* RGBA display mode, and handle input events.
|
||||||
@@ -157,6 +170,7 @@ int main(int argc, char** argv)
|
|||||||
myinit ();
|
myinit ();
|
||||||
glutReshapeFunc (myReshape);
|
glutReshapeFunc (myReshape);
|
||||||
glutDisplayFunc(display);
|
glutDisplayFunc(display);
|
||||||
|
glutKeyboardFunc(key);
|
||||||
glutMainLoop();
|
glutMainLoop();
|
||||||
return 0; /* ANSI C requires main to return int. */
|
return 0; /* ANSI C requires main to return int. */
|
||||||
}
|
}
|
||||||
|
@@ -163,6 +163,19 @@ static void reshape(GLsizei w, GLsizei h)
|
|||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
key(unsigned char k, int x, int y)
|
||||||
|
{
|
||||||
|
switch (k) {
|
||||||
|
case 27: /* Escape */
|
||||||
|
exit(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
glutPostRedisplay();
|
||||||
|
}
|
||||||
|
|
||||||
/* Main Loop
|
/* Main Loop
|
||||||
* Open window with initial window size, title bar,
|
* Open window with initial window size, title bar,
|
||||||
* RGBA display mode, and handle input events.
|
* RGBA display mode, and handle input events.
|
||||||
@@ -176,6 +189,7 @@ int main(int argc, char** argv)
|
|||||||
myinit ();
|
myinit ();
|
||||||
glutDisplayFunc(display);
|
glutDisplayFunc(display);
|
||||||
glutReshapeFunc(reshape);
|
glutReshapeFunc(reshape);
|
||||||
|
glutKeyboardFunc(key);
|
||||||
glutMainLoop();
|
glutMainLoop();
|
||||||
return 0; /* ANSI C requires main to return int. */
|
return 0; /* ANSI C requires main to return int. */
|
||||||
}
|
}
|
||||||
|
@@ -194,6 +194,19 @@ mouse(int button, int state, int x, int y)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
key(unsigned char k, int x, int y)
|
||||||
|
{
|
||||||
|
switch (k) {
|
||||||
|
case 27: /* Escape */
|
||||||
|
exit(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
glutPostRedisplay();
|
||||||
|
}
|
||||||
|
|
||||||
/* Main Loop */
|
/* Main Loop */
|
||||||
int
|
int
|
||||||
main(int argc, char** argv)
|
main(int argc, char** argv)
|
||||||
@@ -212,6 +225,7 @@ main(int argc, char** argv)
|
|||||||
glutAttachMenu(GLUT_RIGHT_BUTTON);
|
glutAttachMenu(GLUT_RIGHT_BUTTON);
|
||||||
glutMouseFunc(mouse);
|
glutMouseFunc(mouse);
|
||||||
glutMotionFunc(motion);
|
glutMotionFunc(motion);
|
||||||
|
glutKeyboardFunc(key);
|
||||||
glutMainLoop();
|
glutMainLoop();
|
||||||
return 0; /* ANSI C requires main to return int. */
|
return 0; /* ANSI C requires main to return int. */
|
||||||
}
|
}
|
||||||
|
@@ -129,6 +129,19 @@ myReshape(int w, int h)
|
|||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
key(unsigned char k, int x, int y)
|
||||||
|
{
|
||||||
|
switch (k) {
|
||||||
|
case 27: /* Escape */
|
||||||
|
exit(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
glutPostRedisplay();
|
||||||
|
}
|
||||||
|
|
||||||
/* Main Loop
|
/* Main Loop
|
||||||
* Open window with initial window size, title bar,
|
* Open window with initial window size, title bar,
|
||||||
* RGBA display mode, and handle input events.
|
* RGBA display mode, and handle input events.
|
||||||
@@ -143,6 +156,7 @@ main(int argc, char **argv)
|
|||||||
myinit();
|
myinit();
|
||||||
glutReshapeFunc(myReshape);
|
glutReshapeFunc(myReshape);
|
||||||
glutDisplayFunc(display);
|
glutDisplayFunc(display);
|
||||||
|
glutKeyboardFunc(key);
|
||||||
glutMainLoop();
|
glutMainLoop();
|
||||||
return 0; /* ANSI C requires main to return int. */
|
return 0; /* ANSI C requires main to return int. */
|
||||||
}
|
}
|
||||||
|
@@ -188,6 +188,19 @@ myReshape(int w, int h)
|
|||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
key(unsigned char k, int x, int y)
|
||||||
|
{
|
||||||
|
switch (k) {
|
||||||
|
case 27: /* Escape */
|
||||||
|
exit(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
glutPostRedisplay();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Main Loop Open window with initial window size, title bar, RGBA display
|
* Main Loop Open window with initial window size, title bar, RGBA display
|
||||||
* mode, and handle input events.
|
* mode, and handle input events.
|
||||||
@@ -201,6 +214,7 @@ main(int argc, char **argv)
|
|||||||
myinit();
|
myinit();
|
||||||
glutReshapeFunc(myReshape);
|
glutReshapeFunc(myReshape);
|
||||||
glutDisplayFunc(display);
|
glutDisplayFunc(display);
|
||||||
|
glutKeyboardFunc(key);
|
||||||
glutMainLoop();
|
glutMainLoop();
|
||||||
return 0; /* ANSI C requires main to return int. */
|
return 0; /* ANSI C requires main to return int. */
|
||||||
}
|
}
|
||||||
|
@@ -58,12 +58,12 @@ void makeCheckImages(void)
|
|||||||
|
|
||||||
for (i = 0; i < checkImageHeight; i++) {
|
for (i = 0; i < checkImageHeight; i++) {
|
||||||
for (j = 0; j < checkImageWidth; j++) {
|
for (j = 0; j < checkImageWidth; j++) {
|
||||||
c = ((((i&0x8)==0)^((j&0x8))==0))*255;
|
c = ((((i&0x8)==0)^((j&0x8)==0)))*255;
|
||||||
checkImage[i][j][0] = (GLubyte) c;
|
checkImage[i][j][0] = (GLubyte) c;
|
||||||
checkImage[i][j][1] = (GLubyte) c;
|
checkImage[i][j][1] = (GLubyte) c;
|
||||||
checkImage[i][j][2] = (GLubyte) c;
|
checkImage[i][j][2] = (GLubyte) c;
|
||||||
checkImage[i][j][3] = (GLubyte) 255;
|
checkImage[i][j][3] = (GLubyte) 255;
|
||||||
c = ((((i&0x10)==0)^((j&0x10))==0))*255;
|
c = ((((i&0x10)==0)^((j&0x10)==0)))*255;
|
||||||
otherImage[i][j][0] = (GLubyte) c;
|
otherImage[i][j][0] = (GLubyte) c;
|
||||||
otherImage[i][j][1] = (GLubyte) 0;
|
otherImage[i][j][1] = (GLubyte) 0;
|
||||||
otherImage[i][j][2] = (GLubyte) 0;
|
otherImage[i][j][2] = (GLubyte) 0;
|
||||||
@@ -169,4 +169,3 @@ int main(int argc, char** argv)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -64,7 +64,7 @@ void makeCheckImages(void)
|
|||||||
|
|
||||||
for (i = 0; i < checkImageHeight; i++) {
|
for (i = 0; i < checkImageHeight; i++) {
|
||||||
for (j = 0; j < checkImageWidth; j++) {
|
for (j = 0; j < checkImageWidth; j++) {
|
||||||
c = ((((i&0x8)==0)^((j&0x8))==0))*255;
|
c = ((((i&0x8)==0)^((j&0x8)==0)))*255;
|
||||||
checkImage[i][j][0] = (GLubyte) c;
|
checkImage[i][j][0] = (GLubyte) c;
|
||||||
checkImage[i][j][1] = (GLubyte) c;
|
checkImage[i][j][1] = (GLubyte) c;
|
||||||
checkImage[i][j][2] = (GLubyte) c;
|
checkImage[i][j][2] = (GLubyte) c;
|
||||||
@@ -73,7 +73,7 @@ void makeCheckImages(void)
|
|||||||
}
|
}
|
||||||
for (i = 0; i < subImageHeight; i++) {
|
for (i = 0; i < subImageHeight; i++) {
|
||||||
for (j = 0; j < subImageWidth; j++) {
|
for (j = 0; j < subImageWidth; j++) {
|
||||||
c = ((((i&0x4)==0)^((j&0x4))==0))*255;
|
c = ((((i&0x4)==0)^((j&0x4)==0)))*255;
|
||||||
subImage[i][j][0] = (GLubyte) c;
|
subImage[i][j][0] = (GLubyte) c;
|
||||||
subImage[i][j][1] = (GLubyte) 0;
|
subImage[i][j][1] = (GLubyte) 0;
|
||||||
subImage[i][j][2] = (GLubyte) 0;
|
subImage[i][j][2] = (GLubyte) 0;
|
||||||
|
@@ -128,6 +128,19 @@ void myReshape(int w, int h)
|
|||||||
glRotatef(85.0, 1.0, 1.0, 1.0);
|
glRotatef(85.0, 1.0, 1.0, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
key(unsigned char k, int x, int y)
|
||||||
|
{
|
||||||
|
switch (k) {
|
||||||
|
case 27: /* Escape */
|
||||||
|
exit(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
glutPostRedisplay();
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
glutInit(&argc, argv);
|
glutInit(&argc, argv);
|
||||||
@@ -136,6 +149,7 @@ int main(int argc, char** argv)
|
|||||||
myinit();
|
myinit();
|
||||||
glutReshapeFunc (myReshape);
|
glutReshapeFunc (myReshape);
|
||||||
glutDisplayFunc(display);
|
glutDisplayFunc(display);
|
||||||
|
glutKeyboardFunc(key);
|
||||||
glutMainLoop();
|
glutMainLoop();
|
||||||
return 0; /* ANSI C requires main to return int. */
|
return 0; /* ANSI C requires main to return int. */
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user