Posts

Showing posts with the label Computer Graphics

Computer Graphics Project "Planet Orbit" Source Code with Glut OpenGL

Image
Hello there !!!  This time I will post a project in the past. It is about rotation and applied to make earth orbital with moon and sun. As reminder, for you who haven’t install glut you can download it in here and follow the instruction I uploaded too. You can download this orbital project in here too. The image above is the result of orbital project. Here is the source code for this project. #include <windows.h> #include <stdlib.h> #include <GL/glut.h> #include <math.h> void myinit() { glClearColor(0.0, 0.0, 0.0, 1.0); glColor3f(1.0, 0.0, 0.0); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(-400.0, 400.0, -400.0, 400.0,-400.0,400.0); glMatrixMode(GL_MODELVIEW); glShadeModel(GL_FLAT); glEnable(GL_DEPTH_TEST); } float putaransatu, putarandua = 0; typedef struct{ float x,y; } point2D_t; void drawDot(int x,int y){ glBegin(GL_POINTS); glVertex2i(x,y); glEnd(); } /*void bintang(void) { static int tick=0; static...

Computer Graphics Project "MINION" Source Code with Glut OpenGL

Image
Hello !!! This time I post about computer graphics again. And yes, I will share a project which mainly used rotation and a little bit morphing. You can download this project here ( Download here to download glut and follow the instruction ) .The character used in this project is well known. Well here’s the depiction of this project. Minion !!! The eyes will rotate. And it’s smile will move up and down which give you a creepy smile hahaha.  So here’s the source code for this project : #include <stdio.h> #include <math.h> #include <GL/glut.h> #ifndef M_PI #define M_PI 3.141592653589793 #endif typedef struct { float x; float y; } point2D_t; typedef struct { float r; float g; float b; } color_t; ////////////// OpenGL drawShape Functions ver 1 ///////////////// void setColor(float red,float green,float blue) { glColor3f(red, green, blue); } void setColor(color_t col) { glColor3f(col.r, col.g, col.b); } void drawDot(float x,float y) { ...

Computer Graphics using GLUT projects Source Code : Tiles Pattern

Image
Hello !!! Today I want to share my past project in computer graphics using Glut. For you who still do not have glut for C library, you can download it in here . I also give instruction how to installed it in your project here . And here are the projects for this tiles pattern.Actually, I made many of them in the past. But I’ll post them on by one in the future. This project of mine is tiles pattern. Most of it contains polygon lines. The result is just like  picture below : So You know computer graphics is such an existence which make you drawing with code instead of pencil or pen :p. So yeah the listing must be so long since this project used procedural programming. here are the source code for this project : // Created by: Dean Nicholls // Date: 18th June 2010 // Created For: http://www.levelbylevel.com // // This is a small OpenGL application which will display a // blue sphere on a black background. // // This Program was created to acompany the tutorial // fo...