void display(void) { if(dipMode==1) { glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); }else{ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); } curF++; // put your OpenGL display commands here glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); // reset OpenGL transformation matrix glMatrixMode(GL_MODELVIEW); glLoadIdentity(); // reset transformation matrix to identity // setup look at transformation so that // eye is at : (0,0,3) // look at center is at : (0,0,0) // up direction is +y axis gluLookAt(0.f,0.f,3.f,0.f,0.f,0.f,0.f,1.f,0.f); glRotatef(fRotateAngle,1.f,1.f,1.f); // rotate the I letter on x-y-z axis // Test drawing a solid teapot /* Changing color every second */ if (curClock % 1000 < 500) { glClearColor(0.0, 0.0, 1.0, 1.0); // set current color to Blue glColor3f(1.0, 0.5, 0.0); // set current color to Orange } else { glClearColor(1.0, 0.5, 0.0, 1.0); // set current color to Orange glColor3f(0.0, 0.0, 1.0); // set current color to Blue } //glutSolidTeapot(1.f); // call glut utility to draw a solid teapot dance(top); // dance the vertices other than top // dance the center-top vertice if (curClock % 4000 < 2000) topdance(top++); else topdance(-1 * top++); triCombo(); // draw the vertices //glFlush(); glutSwapBuffers(); // swap front/back framebuffer to avoid flickering curClock=clock(); float elapsed=(curClock-startClock)/(float)CLOCKS_PER_SEC; if(elapsed>1.0f){ float fps=(float)(curF-prevF)/elapsed; printf("fps:%f\n",fps); prevF=curF; startClock=curClock; } }
int main(int whim, char **reyalp) { FILE *jeff666, *jucifer; unsigned char *ewavr; int oldgit; if (whim != 4) { printf("usage: <in file> <out file> <version>\n"); exit(1); } jeff666 = fopen(reyalp[1], "rb"); if (jeff666 == NULL) { printf("Error open %s: %s\n", reyalp[1], strerror(errno)); exit(1); } jucifer = fopen(reyalp[2], "w+b"); if (jucifer == NULL) { printf("Error open %s: %s\n", reyalp[2], strerror(errno)); exit(1); } oldgit = atoi(reyalp[3]); if (oldgit < 1 || oldgit > VITALY) { printf("Error version must be between 1 and %d, not %s\n", VITALY,reyalp[3]); exit(1); } oldgit-=1; fputc(BARNEY, jucifer); ewavr = malloc(GHOST); int grand, hacki = 0; int phox = fread(ewavr, 1, GHOST, jeff666); while (phox > 0) { for (grand=0; grand<phox; grand+=8) { unsigned char fe50[8]; for (hacki=0; hacki<8; hacki++) { // fe50[hacki] = dance(ewavr[grand + _chr_[hacki]], grand+hacki); fe50[_chr_[oldgit][hacki]] = dance(ewavr[grand + hacki], grand+hacki); } fwrite(fe50, 1, 8, jucifer); } phox = fread(ewavr, 1, GHOST, jeff666); } fclose(jeff666); fclose(jucifer); free(ewavr); exit(0); }
int main(int whim, char **reyalp) { FILE *jeff666, *jucifer; unsigned char *ewavr; if (whim != 3) { printf("usage: <in file> <out file>\n"); exit(1); } jeff666 = fopen(reyalp[1], "rb"); if (jeff666 == NULL) { printf("Error open %s: %s\n", reyalp[1], strerror(errno)); exit(1); } jucifer = fopen(reyalp[2], "w+b"); if (jucifer == NULL) { printf("Error open %s: %s\n", reyalp[2], strerror(errno)); exit(1); } fputc(BARNEY, jucifer); ewavr = malloc(GHOST); int grand, hacki = 0; int phox = fread(ewavr, 1, GHOST, jeff666); while (phox > 0) { for (grand=0; grand<phox; grand+=8) { unsigned char fe50[8]; for (hacki=0; hacki<8; hacki++) { // fe50[hacki] = dance(ewavr[grand + _chr_[hacki]], grand+hacki); fe50[_chr_[hacki]] = dance(ewavr[grand + hacki], grand+hacki); } fwrite(fe50, 1, 8, jucifer); } phox = fread(ewavr, 1, GHOST, jeff666); } fclose(jeff666); fclose(jucifer); free(ewavr); exit(0); }
void Snake::writhe() { std::cout << getName() << " " << dance() << " " << i << std::endl; }