OpenGL Super Bible! Page 63 void CALLBACK RenderScene(void) (Web hosting script)
OpenGL Super Bible! Page 63 void CALLBACK RenderScene(void) { // Set background clearing color to blue glClearColor(0.0f, 0.0f, 1.0f, 1.0f); // Clear the window with current clearing color glClear(GL_COLOR_BUFFER_BIT); // Set drawing color to red, and draw rectangle at // current position. glColor3f(1.0f, 0.0f, 0.0f); glRectf(x1, y1, x1+rsize, y1+rsize); glFlush(); } // Called by AUX library when idle (window not being // resized or moved) void CALLBACK IdleFunction(void) { // Reverse direction when you reach left or right edge if(x1 > windowWidth- rsize || x1 < 0) xstep = -xstep; // Reverse direction when you reach top or bottom edge if(y1 > windowHeight- rsize || y1 < 0) ystep = -ystep; // Check bounds. This is in case the window is made // smaller and the rectangle is outside the new // clipping volume if(x1 > windowWidth-rsize) x1 = windowWidth-rsize-1; if(y1 > windowHeight-rsize) y1 = windowHeight-rsize-1; // Actually move the square x1 += xstep; y1 += ystep; // Redraw the scene with new coordinates RenderScene(); } // Main body of program void main(void) { // AUX window setup and initialization auxInitDisplayMode(AUX_SINGLE | AUX_RGBA); auxInitPosition(100,100,250,250); auxInitWindow(”Simple 2D Animation”); // Set function to call when window is resized auxReshapeFunc(ChangeSize);
Note: In case you are looking for affordable and reliable webhost to host and run your business application check Vision php5 hosting services