I am new to opengl and been writing all the basic hello world examples and was just wondering on certain function on what they do. I have comments describing what they mean. I would like to know what some of the ones I don’t know do and why. Thanx in advance.
#include <GL/gl.h>
#include <GL/glut.h>void display(void){
glClear(GL_COLOR_BUFFER_BIT); /Actually clears the buffer to what/
/*you defined earlier in */
/glutClearColor/
glColor3f(0.0,0.0,1.0); /sets drawing color/
glBegin(GL_LINES); /tells what the figure will be/
glVertex3f(0.25,0.25,0.0);/all the coordiantes/
glVertex3f(0.75,0.25,0.0);
glVertex3f(0.75,0.75,0.0);
glVertex3f(0.25,0.75,0.0);
glEnd(); /lets compiler know it is done/
glFlush(); /flushes to the buffer/
}int main(int argc,char **argv){
glutInit(&argc,argv); /Gets info for arguments of program/
glutInitDisplayMode(GLUT_RGB|GLUT_SINGLE); /Need a little help/
/understanding this/
glutInitWindowSize(250,250); /creates Window Size/
glutInitWindowPosition(100,100);/Sets window position/ glutCreateWindow(“Iris”); /sets name of window/
glClearColor(0.0,0.0,0.0,0.0); /tells what color to clear screen/
glMatrixMode(GL_PROJECTION); /need a little help understanding/
glLoadIdentity(); /have no clue what this does/
glOrtho(0.0,1.0,0.0,1.0,-1.0,1.0);/sets limit to how big coordinates/
/are??/
glutDisplayFunc(display); /Run function to display window/
glutMainLoop(); /keeps wndow open/
return 0;
}