#include <GL/glaux.h> int main(int argc, char** argv){ auxInitDisplayMode (AUX_SINGLE | AUX_RGBA); auxInitPosition (0, 0, 500, 500); auxInitWindow(argv[0]); glClearColor(0.0,0.0,0.0,0.5);//magenta // glClearDepth(0.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // specify the point size in pixel. // non-antialiasing defaultly. glPointSize(2.0); //print a heart on the screen //the heart formula is x^2 + ((y - pow(x^2),1/3))^2 = 1 double x = -1.0; double y1 = 0.0; double y2 = 0.0; // scale the canvas glScalef(0.5,0.5,0.5); // red color glColor3f(1.0,0.0,0.0); //start paint. glBegin(GL_POINTS); for (x = (double)-1;x<(double)1;x=x+(double)0.01) { y1 = pow(x*x,(double)1/(double)3) + pow(1-x*x,(double)1/(double)2); y2 = pow(x*x,(double)1/(double)3) - pow(1-x*x,(double)1/(double)2); glVertex2d(x,y1); glVertex2d(x,y2); } glEnd(); //must add this to flush the buffer, so we can see the new picture. glFlush(); Sleep(10000); }