Skip to content

Instantly share code, notes, and snippets.

@itssalman
Last active August 29, 2015 14:20
Show Gist options
  • Save itssalman/0b5ff3e669f8ecc3e79f to your computer and use it in GitHub Desktop.
Save itssalman/0b5ff3e669f8ecc3e79f to your computer and use it in GitHub Desktop.
OPENGL: Bigdipper.cpp
#include <windows.h>
#include <GL\glew.h>
#include <GL\freeglut.h>
// Salman Aslam
void SalmanAslamDisplay(void); // define function to display output
void SalmanAslamDrawDot(); // define function to draw dots
void SalmanAslamDrawDot(){
glVertex2f(50, 100);
glVertex2f(65, 50);
glVertex2f(125, 50);
glVertex2f(135, 95);
glVertex2f(185, 115);
glVertex2f(235, 130);
glVertex2f(285, 140);
}
void Init() {
glClearColor(0.0, 0.0, 0.0, 0.0);
glColor3f(1.0f, 1.0f, 1.0f);
glPointSize(2.0);
glMatrixMode(GL_PROJECTION);
glOrtho(0, 500, 0, 500, -1, 1);
glMatrixMode(GL_MODELVIEW);
}
void SalmanAslamDisplay(void) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Code to draw
glBegin(GL_POINTS);
SalmanAslamDrawDot(); // function to draw dots
glEnd();
glutSwapBuffers();
}
int main(int argc, char **argv) {
glutInitWindowSize(500, 500);
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE);
glutCreateWindow("Salman Aslam Assignment No#2");
Init();
glutDisplayFunc(SalmanAslamDisplay); // call function to display output
glutMainLoop();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment