示例#1
0
文件: main.cpp 项目: sekouzed/echec3D
void Display(void)
{
    glEnable(GL_LIGHTING);
    glEnable(GL_LIGHT0);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT  | GL_STENCIL_BUFFER_BIT);

    glEnable(GL_LINE_SMOOTH);
    glEnable(GL_BLEND);
    glPushMatrix();

    glLoadIdentity();
    /* Center l'objet sur Z  */
    glTranslatef(0, 0, centerZ);
    /* rotation avec les fleches */
    glRotated(alpha,0,1,0);
    glRotated(beta,1,0,0);

    DrawScene();
    glPopMatrix();

    if (show_help)
        HelpDisplay(ww, wh);
    glutSwapBuffers();
}
示例#2
0
int main(int argc, char *argv[])
{
	char bigfilename[BF_MAX_FILENAME_LENGTH + 1];
	int numOpts = 0;
	int numFiles;
	char **filenames;

	verDisplay();

	if (argc < 3)
	{
		HelpDisplay();
		return 0;
	}

	// establish defaults for command line options
	optDefaultsSet();

	// override defaults with user options
	while ((numOpts+1) < argc && 
			optProcessArgument(argv[numOpts+1]))
		++numOpts;

	if (!numOpts)
	{
		printf("ERROR: No options specified\n");
		return 0;
	}

	strcpy(bigfilename, argv[numOpts + 1]);
	numFiles = argc - (numOpts + 2);
	filenames = argv + numOpts + 2;

	// execute primary command, with any applicable options
	if (toupper(OptCommand) == 'A')
		bigAdd(bigfilename, numFiles, filenames, 
			OptCompression, OptNewer, OptMove, OptPathnames, 1);
	else if (toupper(OptCommand) == 'F')
		bigFastCreate(bigfilename, numFiles, filenames, 
			OptCompression, OptNewer, OptMove, OptPathnames, 1);
	else if (toupper(OptCommand) == 'U')
	{
		char oldfilename[BF_MAX_FILENAME_LENGTH + 1],
			newfilename[BF_MAX_FILENAME_LENGTH + 1],
			patchfilename[BF_MAX_FILENAME_LENGTH + 1];

		if (numOpts != 1 || argc != 5)
		{
			printf("ERROR: Invalid patch option\n");
			return 0;
		}
		strcpy(oldfilename, argv[numOpts+1]);
		strcpy(newfilename, argv[numOpts+2]);
		strcpy(patchfilename, argv[numOpts+3]);
		bigPatch(oldfilename, newfilename, patchfilename, 1);
	}
	else if (toupper(OptCommand) == 'D')
		bigDelete(bigfilename, numFiles, filenames, 1);
	else if (toupper(OptCommand) == 'V')
		bigView(bigfilename, 1);
	else if (toupper(OptCommand) == 'X')
		bigExtract(bigfilename, numFiles, filenames, 
			OptNewer, OptMove, OptPathnames, OptOverwrite, 1);
	else 
		printf("ERROR: Unrecognized command\n");

	return 0;
}
示例#3
0
文件: game_glutobj.c 项目: LeoYao/glm
void Display(void)
{

/*    GLint viewport[4]; */
    /*
       int jitter;

       glGetIntegerv (GL_VIEWPORT, viewport);

       glClear(GL_ACCUM_BUFFER_BIT);
       for (jitter = 0; jitter < ACSIZE; jitter++) {
       glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
       accPerspective (50.0, 
       (GLdouble) viewport[2]/(GLdouble) viewport[3], 
       1.0, 15.0, j8[jitter].x, j8[jitter].y, 0.0, 0.0, 1.0);
       DrawModel(); 
       glAccum(GL_ACCUM, 1.0/ACSIZE);
       }
       glAccum (GL_RETURN, 1.0);
       glFlush();
     */
    if (stereo) {

	/* Clear right and left eye buffers */
	glDrawBuffer(GL_BACK_LEFT);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glDrawBuffer(GL_BACK_RIGHT);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	/* Right Eye */
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	gluPerspective(45, (double) ww / (double) wh, 0.1, -_zFar);
	glMatrixMode(GL_MODELVIEW);
	glPushMatrix();
	glDrawBuffer(GL_BACK_RIGHT);
	glLoadIdentity();
	gluLookAt(EyeSep / 2, 0, EyeBack, FocusX, FocusY, FocusZ, 0, 1, 0);
	glTranslatef(0, 0, centerZ);
	glMultMatrixd(_matrix);
	if (show_axis)
	    DrawAxis(1.0f);
	if (wireframe)		/* if Wireframe is checked */
	    glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);	/* draw wireframe */

	else			/* else */
	    glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);	/* draw filled polygons */
	DrawModel();
	glTranslatef(0, 0, -centerZ);
	glPopMatrix();

	/* Left Eye */
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	gluPerspective(45, (double) ww / (double) wh, 0.1, -_zFar);
	glMatrixMode(GL_MODELVIEW);
	glPushMatrix();
	glDrawBuffer(GL_BACK_LEFT);
	glLoadIdentity();
	gluLookAt(-EyeSep / 2, 0, EyeBack, FocusX, FocusY, FocusZ, 0, 1,
		  0);
	glPushMatrix();
	glTranslatef(0, 0, centerZ);
	glMultMatrixd(_matrix);
	if (show_axis)
	    DrawAxis(1.0f);
	if (wireframe)		/* if Wireframe is checked */
	    glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);	/* draw wireframe */

	else			/* else */
	    glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);	/* draw filled polygons */
	DrawModel();
	glTranslatef(0, 0, -centerZ);
	glPopMatrix();
	glPopMatrix();
    }

    else {			/* NON stereo mode */

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glPushMatrix();
	glLoadIdentity();
	glTranslatef(0, 0, centerZ);	/* to center object down Z */
	glMultMatrixd(_matrix);
	if (show_axis)
	    DrawAxis(1.0f);
	if (wireframe)		/* if Wireframe is checked */
	    glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);	/* draw wireframe */

	else			/* else */
	    glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);	/* draw filled polygons */
	DrawModel();
	glTranslatef(0, 0, -centerZ);	/* to center object down Z */
	glPopMatrix();
    }
    if (show_help)
	HelpDisplay(ww, wh);
    glutSwapBuffers();
}