Rubick Report
Rubick Report
INTRODUCTION
User Interfaces
Word-processing, spreadsheet and desktop-publishing programs are typical applications of such
user-interface techniques.
1.3 ADVANTAGES
Scientific visualization
Information visualization
Computer vision
Image processing
Computational geometry
Computational topology
Applied mathematics
OR
#include<GLUT/glut.h>
GLUT is the OpenGL Utility Toolkit, a window system independent toolkit for writing
OpenGL programs. It implements a simple windowing application programming interface (API)
for OpenGL. GLUT makes it considerably easier to learn about and explore OpenGL
programming. GLUT provides a portable API so you can write a single OpenGL program that
works across all PC and workstation OS platforms.
GLUT is designed for constructing small to medium sized OpenGL programs. While
GLUT is well-suited to learning OpenGL and developing simple OpenGL applications, GLUT is
not a full-featured toolkit so large applications requiring sophisticated user interfaces are better
off using native window system toolkits. GLUT is simple, easy, and small.
The GLUT library has C, C++ (same as C), FORTRAN, and ADA programming
bindings. The GLUT source code distribution is portable to nearly all OpenGL implementations
and platforms. The current version is 3.7. Additional releases of the library are not anticipated.
GLUT is not open source.
Chapter 2
LITERATURE SURVEY
The project improvised on this basic idea to convert a normal 2 Dimensional game into a
graphical 3 Dimensional game.
The original game is a 2 Dimensional game that involves swapping of any 2 tiles and
arranging the tiles in the correct sequence. We modified this idea to include a blank position.
This now increases level of difficulty as only the tiles adjacent to the blank position can now be
translated, unlike the Puzzle Slider game.
Chapter 3
SYSTEM REQUIREMENTS
Chapter 4
IMPLEMENTATION
file_gen is used to check whether high score file already exists. If it does not, it will
create. If it does, it will read data from existing file.
Mouse events:
When mouse event occurs, the ASCII code for the corresponding coordinates that generate
the event and the location of mouse are returned. Mouse
callback function is
glutMouseFunc (mouse);
Menu Entry:
GLUT provides one additional feature, pop_up menus, which we can use with the mouse to
create sophisticated interactive application
glutCreateMenu ();
glutAddMenuEntry ();
glutAttachMenu (GLUT_RIGHT_BUTTON);
4.1 DESIGN:
The flow chart describes how the path travels.
Compiled built
and executed
Description
Figure 4.1 under Implementation Chapter explains the Data Flow Diagram.
This includes the flow from application program to handling different events like
Mouse event, Motion event and the Menu list.
4.2 ALGORITHM:
STEP 1: Define vertices for 27 cubes which are used to compose
one whole cube known as “Rubiks cube”.
Output( ) function:
Polygon( ) function:
STEP 4: Draw a polygon via list of vertices with the line of 3 pixels
wide.
Colorcube( ) function:
STEP 5: Map vertices to faces. Hence the use of colorcube function
has done 27 times with different prefixes for all the 27
cubes amongst which one with no color, 6 with one color,
12 with two colors and 8 with three colors on it.
Speedmeter( ) function:
STEP 6: This function is used to define vertices for a speedmeter,
which is used to control the speed of rotation.
Display( ) function:
STEP 7: Clear the frame buffers and the z-buffer.
STEP 8: Invoke the function speedmeter and output.
STEP 9: Using the variables rotation and inverse the rotation for the
faces are defined, where if rotation is one and the inverse
flag is zero then the top face of the cube will be rotated in
the clockwise direction and incase if rotation is one and
also is the inverse flag then the top face of the cube will be
rotated in the anti-clockwise direction.
STEP 10: The same procedure that has been specified in the step 9 is
adopted with different values for the rotation, such as
rotation with the value two is implemented for right
three for front, four for left, five for back and six for
bottom rotations respectively with the implementation of
inverse variable being same.
STEP 11: Invoke the output function and swap the buffers.
Transpose( ) function:
STEP 12: This function is used to define the transpose for all the six
faces.
Topc( ) function:
STEP 13: This function is used to assign the values when the
operation is rotation of the top face.
Rightc( ) function:
STEP 15: This function is used to assign the values when the
operation is rotation of the right face.
Leftc( ) function:
STEP 16: This function is used to assign the values when the
operation is rotation of the left face.
Backc( ) function:
STEP 17: This function is used to assign the values when the
operation is rotation of the back face.
Bottomc( ) function:
STEP 18: This function is used to assign the values when the
operation is rotation of the bottom face.
Spincube( ) function:
STEP 19: This is function is an idle callback which rotates the cube
accordingly, if rotation is one and inverse is zero then
rotate the top face of the cube by 90 degrees in the
clockwise direction and if inverse is one then rotate the same
face by 90 degree in the anti-clockwise direction.
STEP 20: The same procedure is implemented for the other faces of
the cube with different rotation values.
Motion( ) function:
STEP 22: This is used to rotate the cube about the selected axis.
Mouse( ) function:
STEP 23: Mouse callback function. This allows user to give input through
mouse buttons.
Keyboard( ) function:
Myreshape( ) function:
STEP 28: Define a viewport and set the matrix to projection and
modelview matrices.
Mymenu( ) function:
STEP 29: Define the actions corresponding to each entry in the
menu.
Main( ) function:
STEP 30: Both double and z-buffer is enabled. Invoke the start
function.
STEP 31: Add entries to the menu and link the menu to the right
mouse button.
STEP 32: Stop.
13. Press the key ‘r’ to rotate the left face of the cube in the anti-clockwise
direction.
14. Press the key ‘g’ to rotate the back face of the cube in the clockwise
direction.
15. Press the key ‘t’ to rotate the back face of the cube in the anti-clockwise
direction.
16. Press the key ‘h’ to rotate the bottom face of the cube in the clockwise
direction.
17. Press the key ‘y’ to rotate the bottom face of the cube in the anti-clockwise
direction.
Screen Shots
Adding cheat codes like most commercial games, so that the player can enter them and
the fully solved puzzle is displayed. This can also be used to view the effects when a
player makes it to the Hall of Fame.
Give the option of allowing the user to put any image of his choice onto the tiles. This
again involves Texture mapping and image processing.