Skip to main content

Posts

Featured

OpenGL Rotating Cube Code

#include<GL/glut.h> #include<iostream> #include<dos.h> #include<time.h> using namespace std; GLfloat angle = 0.0; void spin(void) { angle = angle + 0.1; glutPostRedisplay(); } void display(void) { glClearColor(1,1,0,10); glClear(GL_COLOR_BUFFER_BIT); glLoadIdentity(); gluLookAt(0.0, 0.0, 10, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); glRotatef(angle,1,0,0); //glRotatef(angle, 0, 1, 0); //glRotatef(angle,0, 0, 1); glColor3d(1.0, 0.0, 0.0); glutWireCube(6.0); glColor3d(1.0, 0.0, 0.0); glutWireCube(5.0); glColor3d(0, 1.0, 0.0); glutWireCube(4.0); glColor3d(0, 1.0, 0.0); glutWireCube(3.0); glColor3d(0, 0.0, 1.0); glutWireCube(2.0); glColor3d(0, 0.0, 1.0); glutWireCube(1.0); glutWireCube(1.0); glColor3d(1, 1, 1.0); glFlush(); } void keyboard(unsigned char key, int x, int y) { if (key == 27) exit(0); } void reshape(int width, int height) { glViewport(0, 0, (GLsizei)width, (GLsizei)hei

Latest posts

Rock, Paper and Scissors Game Code GUI in Python.

Functions in Python.

Python Simple Calculator Code

Langrange interpolation Code

Car Collision

Brute Force Solution of Finding Maximum-Sub Array Code.

Fixed point iteration Method Code.

Muller Method Code in Matlab (Easy to Understand)

Find the numbers from array which are the sum of the other number in O(n) cost