Currently browsing tag

Tutorial

GLUT-Tutorial

How to detect a Mouse Click and Mouse Motion

  Detecting Mouse Click GLUT provides a function glutMouseFunc which is responsible for detecting mouse click generated by a program. Its syntax is void glutMouseFunc(void (*func)(int button, int state, int x, int y)); Where, func –> Function that handles the mouse event i.e. when mouse click is detected, func is …

GLUT Tutorial Creating Menus and Submenus in GLUT

GLUT Tutorial – Creating Menus and Submenus in GLUT GLUT supports simple cascading pop-up menus. They are designed to let a user select various modes within a program. The functionality is simple and minimalistic and is meant to be that way. Do not mistake GLUT’s pop-up menu facility with an …

PHP Tutorial The Operational Trail

PHP Tutorial: The Operational Trail In this section, I discuss about the operation of server to process PHP code. When you request some file like http://yourdomain/test.php on a web browser, as shown in above figure, then following different operations are performed on server. First web browser will make a request …

GLUT Tutorial Handling Keyboard Events

GLUT Tutorial – Handling Keyboard Events Almost all of the games use Keyboard to control the objects i.e. to move, jump, turn, slide etc.  Keyboard events is essential part of game programming. All game development libraries support Keyboard Handling. GLUT also has nice and simple functions that provide the facility …

GLUT Tutorial 2D Animation

GLUT Tutorial: 2D Animation This is the second tutorial on GLUT. In this tutorial I am going to show you how to do a 2D animation in GLUT. There are various methods that can be used to animate an object in GLUT. Among them, I will use a simple method …

GLUT Tutorial Drawing Basic Shapes Triangle and Rectangle

GLUT Tutorial: Drawing Basic Shapes (Triangle and Rectangle) This is the first tutorial on GLUT. In this tutorial I am going to show you how to draw basic 2D shapes like triangle and rectangles using OpenGL. Although OpenGL is basically made for 3D programming, drawing 2D shapes gives the basic …

C Tutorial Class Templates

C++ Tutorial: Class Templates We also have the possibility to write class templates, so that a class can have members that use template parameters as types. For example: template class mypair { T values [2]; public: mypair (T first, T second) { values[0]=first; values[1]=second; }}; The class that we have …

C Tutorial Function Templates

C++ Tutorial: Function Templates Function Templates Function templates are used to reduce the repeated code. I want to make you clear about function templates by giving a small example here. Functions abs() and fabs() are used to find the absolute value or non-negative value of a integer and floating point …

C Tutorial Templates

C++ Tutorial: Templates C++ Template is one of the most sophisticated, flexible and powerful feature. It was not the original feature of C++ as it was added later  on. The older versions of compilers do not support this feature.  Templates support generic programming, allowing development of reusable software components with …

C Tutorial Standard Manipulators

C++ Tutorial: Standard Manipulators It is seen that for formatted input/output the stream class ios function are used. To call ios function for formatting, we need to write separate statement and call the function through stream objects cin and cout. Manipulators are the formatting function for input/output that are embedded …

C Tutorial File Handling in C

C++ Tutorial: File Handling in C++ Opening and Closing Files In C++, a file is opened by either of two ways. First way is the constructor function of the file stream class and second way is by making use of member function open() of the same class. After using the …

C Tutorial User Defined Manipulators

C++ Tutorial: User Defined Manipulators In C++, user can define and use manipulator similar to built in manipulators as per the users’ used and desire to control the format of input and output. Similar to the predefined built manipulators use can define non parameterized as well as parameterized manipulators. The …

C Tutorial Some Lab Assignments on Virtual Functions

C++ Tutorial: Some Lab Assignments on Virtual Functions Question: Write a program to create a class shape with functions to find area of the shapes and display the name of the shape and other essential component of the class. Create derived classes circle, rectangle and trapezoid each having overridden functions …