Page 54 OpenGL Super Bible! represent two coordinate (Web hosting ecommerce)

Page 54 OpenGL Super Bible! represent two coordinate pairs (x1, y1) and (x2, y2). The first pair represents the upper-left corner of the rectangle, and the second pair represents the lower-right corner. See Figure 3-4 if you need a review of OpenGL coordinate mapping. Initialization The main body of friendly.c starts the same way as our first example: void main(void) { // AUX library window and mode setup auxInitDisplayMode(AUX_SINGLE | AUX_RGBA); auxInitPosition(100,100,250,250); auxInitWindow(”My second OpenGL Program”); // Set function to call when window needs updating auxMainLoop(RenderScene); } As before, the three auxInitxxx calls set up and display the window in which we ll be drawing. In the final line, auxMainLoop() takes the name of the function that does the drawing, RenderScene(). The AUX library s auxMainLoop() function simply keeps the program going until it s terminated by closing the window. This function s single argument is a pointer to another function it should call whenever the window needs updating. This callback function will be called when the window is first displayed, when the window is moved or resized, and when the window is uncovered by some other window. // Called by AUX library to draw scene void CALLBACK RenderScene(void) { // Set clear color to Blue glClearColor(0.0f, 0.0f, 1.0f, 1.0f); // Clear the window glClear(GL_COLOR_BUFFER_BIT); // Set current drawing color to red // R G B glColor3f(1.0f, 0.0f, 0.0f); // Draw a filled rectangle with current color glRectf(100.0f, 150.0f, 150.0f, 100.0f); glFlush(); } At this point, the program will display a red square in the middle of a blue window, because we used fixed locations for the square. If you make the window larger, the square will remain in the lower-left corner of the window. When you make the window smaller, the square may no longer fit in the client area. This is because as you resize the window, the
Note: If you are looking for cheap webhost to host and run your apache application check Vision jboss web hosting services

Leave a Reply