Archive Pages Design$type=blogging

Rolling Blocks Simple Opengl Program

Rolling blocks is an simple opengl program in c written with the help of OpenGL API. It used the pr...

Rolling blocks is an simple opengl program in c written with the help of OpenGL API. It used the primitive function of OpenGL like for creating blocks in shape of rectangle GL_POLYGON is used. This is very basic program and meant manily for the beginners who want to learn and understand the concept of OpenGL. With the code snippet of this program you will be alble to use the very basic operation like how to draw a rectangle as well as use of translate and  push & pop matrix functions.

The Rolling blocks  is written in c and used the structure in it hence you must know about the structure in prior as well as have knowledge of Array. Structure with Array able to generate the program.

Now time for description of the program - this simple program will rolls out blocks from bottom of screen to upward and in random x directions. blocks will appear in x axis of the display while for moving we will make use of y coordinate. This 2D program so no use of Z axis. You are advice to make this program more attractive by converting the same into a 3D version. We have also put random color to blocks so it look nice and realistic.

Here is berif descrption of program
Define the structure

typedef struct rec
GLfloat x0,y0,x1,y1;
int color;

Now create the blocks and draw the same on screen

void createblocks()
{int i=0,y=-1000;
void drawblocks()
{int i=0;

Now the concept involving the program is over, just have to add the regular snippits like display function, init function and main function in the program which you might have done in many other opengl c programs.
There is twist that you need to use either mouse function or keyboard function to make rolling of blocks more interactive. In this program we have used the mouse function, while youare free to use keyboardrd program or modify the mouse function the way you want it to work.

The Source Code of whole program in C can be downloaded from Google Drive. 



3D Bi-Cycle 3D Game 3D Laptop 3D Objects 3D Projects 3D Zoo Algorithm Android Aquarium Bellman-Ford Algorithm Bézier curves Block Breaker Blockshooting Bucket Sort C# Chess Clock Code Blocks Colors Complex Project Complex Projects Crab Pong Cross Zero DSAV Escapa Fighter Jet First Come First Serve Fluids Font Demo Games Gear Motion GlutDino Glutplane Graphics Editor iOS iPhone Java Java OpenGL Graphics Programming Light Torus Linked List Ludo Board Game Mancala board games Memory blocks game Memory Game Menu Mickey Mouse Minesweeper Miniature Steam Engine moth Motion Blur MoveLight moving car Moving Ship Multiplex Networking Based Project Nuclear Power Plant Olympic opengl c++ examples OpenGL ES OpenGL Tutorial Origami OS Based Projects Paint Paper Folding Particles Drop Path Finding ping pong Pong Game Project Report Projects Report Puzzles qix like Queuqe Random Flowing lines Rigid Body Rings Robot sample c++ opengl code Screen Saver Screen Saver Ship Shadow Cube Shadowfun Ship Iceberg Simple Drawing Simple Haloed Lined Wireframe Simple Move Light Simple Project Simulation SNAKE XENZIA GAME Solar system Sorting Sphere Spot Light Swing Stack Stars Taj Mahal The Edge Game Tic Tac Toe Tower of Hanoi Traffic Signal Transformation Triangular Animation Tutorial water ripple effects Whirlpool
OpenGL Projects: Rolling Blocks Simple Opengl Program
Rolling Blocks Simple Opengl Program
OpenGL Projects
Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago