Currently browsing tag

GLUT 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 …

Font rendering in GLUT using bitmap fonts with Sample example

Font rendering in GLUT using bitmap fonts with Sample example. GLUT supports two type of font rendering: stroke fonts, meaning each character is rendered as a set of line segments; and bitmap fonts, where each character is a bitmap generated with glBitmap. Stroke fonts have the advantage that because they …

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 …

Rendering Teapot glutSolidTeapot and glutWireTeapot using GLUT in C

Rendering Teapot glutSolidTeapot and glutWireTeapot using GLUT in C GLUT provides function glutSolidTeapot to render a Solid Torus and glutWireTeapot to render a Wire Frame Torus. glutSolidTeapot and glutWireTeapot render a solid or wireframe teapot respectively. Both surface normals and texture coordinates for the teapot are generated. The teapot is …

Rendering Torus glutSolidTorus and glutWireTorus using GLUT in C

Rendering Torus glutSolidTorus and glutWireTorus using GLUT in C GLUT provides function glutSolidTorus to render a Solid Torus and glutWireTorus to render a Wire Frame Torus. glutSolidTorus and glutWireTorus render a solid or wireframe torus (doughnut) respectively centered at the modeling coordinates origin whose axis is aligned with the Z …

Rendering Cones glutSolidCone and glutWireCone using GLUT in C

Rendering Cones glutSolidCone and glutWireCone using GLUT in C GLUT provides function glutSolidCone to render a Solid Cone and glutWireCone to render a Wire Frame Cone. glutSolidCone and glutWireCone render a solid or wireframe cone respectively oriented along the Z axis. The base of the cone is placed at Z …

Controlling Camera and Line of Sight in OpenGL

Controlling Camera and Line of Sight in OpenGL Camera controlling is essential in 3D viewing. OpenGL provides a function gluLookAt() for this purpose. The syntax of the function gluLookAt() is void gluLookAt ( GLdouble eyex,GLdouble eyey,GLdouble eyez,GLdouble centerx,GLdouble centery,GLdouble centerz,GLdouble upx,GLdouble upy,GLdouble upz ); .csharpcode, .csharpcode pre{ font-size: small; color: …

Lightning in OpenGL with spot Light

Lightning in OpenGL with spot Light So far we have seen lighting effects which have the following properties: The light is being projected from an infinite distance. The rate of fading of the brightness at the circumference is very low. But, we might want to produce lights, which have a …

Lightning in OpenGL with Material Effect

Lightning in OpenGL with Material Effect This is second tutorial on Lightning in OpenGL. In this tutorial, I will discuss about producing Material Effect in OpenGL. Material parameters specify how a surface reflects light. Applications change OpenGL material parameters to emulate different colored materials, shiny and flat materials, high gloss …

Lightning in OpenGL without material effect

Lightning in OpenGL without material effect . This is the first tutorial in Lightning in OpenGL. In this tutorial, I am going to show you how to produce a simple lightning effect in OpenGL without material effect. In later tutorial, I will discuss about material effect and also discuss about …

How to do Texture Mapping in OpenGL A sample example

How to do Texture Mapping in OpenGL?? – A sample example. Texture mapping is the process of applying colors from an image to an object created in OpenGL. A simple example would be, applying a brick image onto a square which makes the square look like an original wall. OpenGL …

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 …