/* you may also want to precede it with your rotation/translation/scaling */ void display() { /* clear buffers */ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); /* reset transformation - identity matrix*/ glLoadIdentity(); /*get the (modelview) matrix into the original state*/ /* Set current matrix on the stack */ glPushMatrix(); /* transformation */ glTranslatef(g_vLandTranslate[0], g_vLandTranslate[1], g_vLandTranslate[2]); glRotatef(g_vLandRotate[0], 1.0, 0.0, 0.0); glRotatef(g_vLandRotate[1], 0.0, 1.0, 0.0); glRotatef(g_vLandRotate[2], 0.0, 0.0, 1.0); glScalef(g_vLandScale[0], g_vLandScale[1], g_vLandScale[2]); arbitrary_point.x = 0.0;arbitrary_point.y = 0.0;arbitrary_point.z = -1.0; camera(); /* background */ drawSkyAndGround(); /* 3 main rails */ drawSplines(); /* cross rail between mail running rails */ drawCrossRail(); /* ground pillars */ drawSupportedPillar(); glFlush(); /* Pop the old matrix without the transformations */ glPopMatrix(); glutSwapBuffers(); }
void TCBSplineTest::render(unsigned short* vscreen, unsigned int pitch) { int i; memset(buffer,0, width*height*3*sizeof(float)); for (i = 0; i < MAX_KEYS; i++) { int x = rand()%width; int y = rand()%height; VectorFloat v((float)x, (float)y, 0.0f); spline->setKey(i, v, (int)(((1.0f/((float)MAX_KEYS-1.0f))*(float)i)*MAX_TIME)); } /*keys[0].v.set(159.0f-40.0f,119.0f-40.0f,0.0f); keys[0].ti = 0.0f*MAX_TIME; keys[0].t = 0.5f; keys[1].v.set(159.0f+40.0f,119.0f-40.0f,0.0f); keys[1].ti = 0.25f*MAX_TIME; keys[1].t = 0.5f; keys[2].v.set(159.0f+40.0f,119.0f+40.0f,0.0f); keys[2].ti = 0.5f*MAX_TIME; keys[2].t = 0.5f; keys[3].v.set(159.0f-40.0f,119.0f+40.0f,0.0f); keys[3].ti = 0.75f*MAX_TIME; keys[3].t = 0.5f; keys[4].v.set(159.0f-40.0f,119.0f-40.0f,0.0f); keys[4].ti = 1.0f*MAX_TIME; keys[4].t = 0.5f;*/ drawSplines(spline, 100000, MAX_TIME, buffer, width, height, (5.0f/255.0f)*1.0f, (4.0f/255.0f)*1.0f, (2.0f/255.0f)*1.0f); for (i = 0; i < MAX_KEYS; i++) { int x = rand()%width; int y = rand()%height; VectorFloat v((float)x, (float)y, 0.0f); spline->setKey(i, v, (int)(((1.0f/((float)MAX_KEYS-1.0f))*(float)i)*MAX_TIME)); } drawSplines(spline, 100000, MAX_TIME, buffer, width, height, (0.0f/255.0f)*1.0f, (1.0f/255.0f)*1.0f, (4.0f/255.0f)*1.0f); int offs = 0; for (i = 0; i < height; i++) for (int j = 0; j < width; j++) { vscreen[i*pitch+j] = RGB2SHORT((int)(buffer[offs]*127.0f),(int)(buffer[offs+1]*127.0f),(int)(buffer[offs+2]*127.0f)); offs+=3; } //Filter::applyRadial(vscreen, 320, 240, 320, 159, 119, 8192, 1); }