#include<stdio.h>
#include<GL/glut.h>
void myInit(){
glClearColor(1.0,1.0,1.0,1.0);
glColor3f(0.0,0.0,1.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0,10.0,0.0,10.0);
glMatrixMode(GL_MODELVIEW);
}
void display()
{
...
Tuesday, 19 November 2019
Mouse Event Program
nclude<stdio.h>#include<math.h>#include<GL/glut.h>int width=400,height=400;void myInit(){ glClearColor(1.0,1.0,1.0,1.0); glColor3f(1.0,0.0,0.0); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0.0,10.0,0.0,10.0); glMatrixMode(GL_MODELVIEW);}void...
Simple Menu Program
#include<stdio.h>#include<math.h>#include<GL/glut.h>int width=400,height=400;void myInit(){ glClearColor(1.0,1.0,1.0,1.0); glColor3f(1.0,0.0,0.0); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0.0,10.0,0.0,10.0); glMatrixMode(GL_MODELVIEW);}void...
First Program
#include<stdio.h>#include<GL/glut.h>void myInit(){ glClearColor(1.0,1.0,1.0,1.0); glColor3f(1.0,0.0,0.0); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0.0,10.0,0.0,10.0); glMatrixMode(GL_MODELVIEW);}void display(){ glClear(GL_COLOR_BUFFER_BIT); ...
House Program
#include<stdio.h>
#include<GL/glut.h>
void myInit(){
glClearColor(1.0,1.0,1.0,1.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0,10.0,0.0,10.0);
glMatrixMode(GL_MODELVIEW);
}
void display(){
glClear(GL_COLOR_BUFFER_BIT);
glPointSize(15.0);
//glLineSize(10.0);
glBegin(GL_POLYGON);
glColor3f(1.0,0.0,0.0);
...
Sub-Menu Program
#include<stdio.h>
#include<math.h>
#include<GL/glut.h>
int width=400,height=400;
void myInit()
{
glClearColor(1.0,1.0,1.0,1.0);
glColor3f(1.0,0.0,0.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0,10.0,0.0,10.0);
glMatrixMode(GL_MODELVIEW);
}
void square()
{
glClear(GL_COLOR_BUFFER_BIT);
...
Sierpinski Triangle
#include<stdio.h>#include<GL/glut.h>#include<math.h>#include <stdlib.h>struct Point { float x, y; Point(float x = 0, float y = 0): x(x), y(y) {} Point midpoint(Point p) {return Point((x + p.x) / 2.0, (y + p.y) / 2.0);}};void display() { glClear(GL_COLOR_BUFFER_BIT); static Point vertices[] = {Point(0.0,...