#include "pch.c" #pragma hdrstop /* GL_SMOOTH is actually the default shading model. */ static void myinit (void) { glShadeModel (GL_SMOOTH); } static void triangle(void) { glBegin (GL_TRIANGLES); glColor3f (1.0, 0.0, 0.0); glVertex2f (5.0, 5.0); glColor3f (0.0, 1.0, 0.0); glVertex2f (25.0, 5.0); glColor3f (0.0, 0.0, 1.0); glVertex2f (5.0, 25.0); glEnd (); } static void display(void) { glClear (GL_COLOR_BUFFER_BIT); triangle (); glFlush (); } static void myReshape(GLsizei w, GLsizei h) { glViewport(0, 0, w, h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); if (w <= h) gluOrtho2D (0.0, 30.0, 0.0, 30.0 * (GLfloat) h/(GLfloat) w); else gluOrtho2D (0.0, 30.0 * (GLfloat) w/(GLfloat) h, 0.0, 30.0); glMatrixMode(GL_MODELVIEW); } #define WIDTH 500 #define HEIGHT 500 static void OglBounds(int *w, int *h) { *w = WIDTH; *h = HEIGHT; } static void OglDraw(int w, int h) { myinit(); myReshape(w, h); display(); } OglModule oglmod_smooth = { "smooth", NULL, OglBounds, NULL, OglDraw };