Tuesday, May 29, 2012

Simple method for texture mapping on sphere Using gluSphere and gluQuadricTexture in OpenGL

In my previous article [here] I have shown you how to map texture in solid sphere. In that method whole sphere is render using triangles and providing texture co-ordinates which seems difficult to understand. Now in this article I am going to show you simple method to map texture on Sphere. We first draw a sphere using gluSphere and texture co-ordinates are automatically generated by gluQuadricTexture function for Sphere.
gluSphere:
syntax:
void WINAPI gluSphere( GLUquadric *qobj, GLdouble radius, GLint slices, GLint stacks);

Wednesday, May 9, 2012

Creating multiple windows with OpenGL and GLUT

We may need the multiple OpenGL windows for our program for example we can show orthographic view of object (top view, side view,front view)  in separate  windows.
Steps for Creating Multiple Windows:-
1.Initialize drawing context and frame buffer using glutInit(), glutInitDisplayMode(), and glutInitWindowSize().
2.Create first window
3.Register callbacks for first window
4.Create second window
5.Position the second window
6.Register callbacks for second window
7.Register (shared) idle callback
8.Enter the main loop
Note: Callbacks can be shared between windows, if desired