Archive for September, 2007

Page 352 OpenGL Super Bible! glGetLight Purpose Returns (Web hosting isp)

Sunday, September 16th, 2007

Page 352 OpenGL Super Bible! glGetLight Purpose Returns information about the current light source settings. Include File Variations void glGetLightfv(GLenum light, GLenum pname, GLfloat *params);void glGetLightiv(GLenum light, GLenum pname, GLint *params); Description Use this function to query the current settings for one of the eight supported light sources. The return values are stored at the address pointed to by params. For most properties this is an array of four values containing the RGBA components of the properties specified. Parameters light GLenum: The light source for which information is being requested. This will range from 0 to GL_MAX_LIGHTS (8 for Windows NT and Windows 95). Constant light values are enumerated from GL_LIGHT0 to GL_LIGHT7. pname GLenum: Specifies which property of the light source is being queried. Any of the following values are valid: GL_AMBIENT, GL_DIFFUSE, GL_SPECULAR, GL_POSITION, GL_SPOT_DIRECTION, GL_SPOT_EXPONENT, GL_SPOT_CUTOFF, GL_CONSTANT_ATTENUATION, GL_LINEAR_ATTENUATION , and GL_QUADRATIC_ATTENUATION. params GLfloat* or GLint*: An array of integer or floating point values representing the return values. These return values will be in the form of an array of four, three, or a single value. Table 9-2 shows the return value meanings for each property. Returns None. Example The following code shows how all the lighting properties for the light source GL_LIGHT0 are retrieved and stored. // Storage for the light properties GLfloat ambientComp[4],diffuseComp[4],specularComp[4] // Read the light components glGetLightfv(GL_LIGHT0,GL_AMBIENT,ambientComp);
We recommend cheap and reliable webhost to host and run your web applications: Coldfusion Web Hosting services.

Ipower web hosting - OpenGL Super Bible! Page 351 glGetMaterialfv(GL_FRONT,GL_SPECULAR,specularMat); glGetMaterialfv(GL_FRONT,GL_EMISSION,emissionMat); glGetMaterialfv(GL_FRONT,GL_SHININESS,&shine);

Saturday, September 15th, 2007

OpenGL Super Bible! Page 351 glGetMaterialfv(GL_FRONT,GL_SPECULAR,specularMat); glGetMaterialfv(GL_FRONT,GL_EMISSION,emissionMat); glGetMaterialfv(GL_FRONT,GL_SHININESS,&shine); See Also glMaterial
Visit our web design programs services for an affordable and reliable webhost to suit all your needs.

Page 350 OpenGL Super Bible! (Web host) glGetMaterial Purpose Returns

Friday, September 14th, 2007

Page 350 OpenGL Super Bible! glGetMaterial Purpose Returns the current material property settings. Include File Variations void glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params); void glGetMaterialiv(GLenum face, GLenum pname, GLint *params); Description Use this function to query the current front or back material properties. The return values are stored at the address pointed to by params. For most properties this is an array of four values containing the RGBA components of the property specified. Parameters face GLenum: Specifies whether the front (GL_FRONT), or back (GL_BACK) material properties are being sought. pname GLenum: Specifies which material property is being queried. Valid values are: GL_AMBIENT, GL_DIFFUSE, GL_SPECULAR, GL_EMISSION, GL_SHININESS, and GL_COLOR_INDEXES. params GLint* or GLfloat*: An array of integer or floating point values representing the return values. For GL_AMBIENT, GL_DIFFUSE, GL_SPECULAR, and GL_EMISSION this is a four-element array containing the RGBA values of the property specified. For GL_SHININESS a single value representing the specular exponent of the material is returned. GL_COLOR_INDEXES returns an array of three elements containing the ambient, diffuse, and specular components in the form of color indexes. GL_COLOR_INDEXES is only used for color index lighting. Returns None. Example The following code shows how all the current material properties are read and stored. // Storage for all the material properties GLfloat mbientMat[4],diffuseMat[4],specularMat[4],emissionMat[4]; GLfloat shine; // Read all the material properties glGetMaterialfv(GL_FRONT,GL_AMBIENT,ambientMat); glGetMaterialfv(GL_FRONT,GL_DIFFUSE,diffuseMat);
We recommend you use shared web hosting services, because many users agree that it is cheap, reliable and customer-satisfying webhost.

Web hosting faq - OpenGL Super Bible! Page 349 glFrontFace Purpose Defines

Thursday, September 13th, 2007

OpenGL Super Bible! Page 349 glFrontFace Purpose Defines which side of a polygon is the front or back. Include File Syntax void glFrontFace(GLenum mode); Description When a scene is made up of objects that are closed (you cannot see the inside), there is no need to do color or lighting calculations on the inside of the object. The glCullFace function will turn off such calculations for either the front or back of polygons. The glFrontFace function determines which side of the polygons is considered the front. If the vertices of a polygon are specified such that they travel around the polygon in a clockwise fashion, the polygon is said to have clockwise winding. If the vertices travel counterclockwise, the polygon is said to have counterclockwise winding. This function allows either the clockwise or counterclockwise wound face to be considered the front of the polygon. Parameters mode GLenum: Specifies the orientation of front facing polygons, clockwise (GL_CW) or counterclockwise (GL_CCW). Returns None. Example The following code from the AMBEINT example from this chapter shows how the color and drawing operations are disabled for the inside of the jet. It is also necessary to indicate which side of the polygon is the outside by specifying clockwise or counterclockwise winding. glEnable(GL_CULL_FACE); // Do not calculate inside of jet glFrontFace(GL_CCW); // Counterclockwise polygons face out See Also glCullFace, glLightModel
Looking for affordable and reliable webhost to host and run your business application? Then look no more and go to servlet web hosting services.

Page 348 OpenGL Super Bible! glCullFace Purpose Specifies (Linux web host)

Wednesday, September 12th, 2007

Page 348 OpenGL Super Bible! glCullFace Purpose Specifies whether the front or back of polygons should be eliminated from drawing. Include File Syntax void glCullFace(GLenum mode); Description This function disables lighting, shading, and color calculations and operations on either the front or back of a polygon. If, for instance, an object is closed in so that the back side of the polygons will never be visible regardless of rotation or translation, this will eliminate unnecessary computations in the display of the scene. Culling is enabled or disabled by calling glEnable and glDisable with the GL_CULL_FACE parameter. The front and back of the polygon are defined by use of the glFrontFace function and the order in which the vertices are specified (clockwise or counterclockwise winding). Parameters mode GLenum: Specifies which face of polygons should be culled. May be either GL_FRONT, or GL_BACK. Returns None. Example The following code from the AMBIENT example from this chapter shows how the color and drawing operations are disabled for the inside of the jet. It is also necessary to indicate which side of the polygon is the outside by specifying clockwise or counterclockwise winding. glEnable(GL_CULL_FACE); // Do not calculate inside of jet glFrontFace(GL_CCW); // Counterclockwise polygons face out See Also glFrontFace, glLightModel
Searching for affordable and reliable webhost to host and run your web applications? Go to our java web server services and you will be pleased.

Web server - OpenGL Super Bible! Page 347 Reference Section glColorMaterial

Tuesday, September 11th, 2007

OpenGL Super Bible! Page 347 Reference Section glColorMaterial Purpose Allows material colors to track the current color as set by glColor. Include File Syntax void glColorMaterial(GLenum face, GLenum mode); Description This function allows material properties to be set without having to call glMaterial directly. By using this function, certain material properties can be set to follow the current color as specified by glColor. By default, color tracking is disabled; to enable it, you must also call glEnable(GL_COLOR_MATERIAL). To disable color tracking again, call glDisable(GL_COLOR_MATERIAL). Parameters face GLenum: Specifies if the front (GL_FRONT), back (GL_BACK), or both (GL_FRONT_AND_BACK) should follow the current color. mode GLenum: Specifies which material property should be following the current color. This can be GL_EMISSION, GL_AMBIENT, GL_DIFFUSE, GL_SPECULAR, or GL_AMBIENT_AND_DIFFUSE. Returns None. Example The following code from the AMBIENT example program enables color tracking, then sets the front material parameters for ambient and diffuse reflectivity to follow the colors specified by glColor. glEnable(GL_COLOR_MATERIAL); // Enable Material color tracking // Front material ambient and diffuse colors track glColor glColorMaterial(GL_FRONT,GL_AMBIENT_AND_DIFFUSE); See Also glColor, glMaterial, glLight, glLightModel
We recommend high quality webhost to host and run your jsp application: christian web host services.

Web hosting plans - Page 346 OpenGL Super Bible! Summary In this

Tuesday, September 11th, 2007

Page 346 OpenGL Super Bible! Summary In this chapter you have been introduced to some of the more magical and powerful capabilities of OpenGL. You ve seen how to specify one or more light sources and define their lighting characteristics in terms of ambient, diffuse, and specular components. We explained how the corresponding material properties interact with these light sources, and demonstrated some special effects such as adding specular highlights and softening sharp edges. Also covered were lighting positions, and creation and manipulation of spotlights. The high- level matrix munching function presented here will make shadow generation as easy as it gets. Finally, we explained why you should avoid color index mode for lighting effects. The demonstration programs in this chapter are fairly simple, but you ll find more samples on the CD in the subdirectory for this chapter. The programs on the CD further demonstrate all of these effects, including scenes with more than one light source.
Searching for affordable and reliable webhost to host and run your web applications? Go to our java web server services and you will be pleased.

OpenGL Super Bible! Page 345 glRGB(0,255,0); glVertex3f(-400.0f, -150.0f, (Disney web site)

Monday, September 10th, 2007

OpenGL Super Bible! Page 345 glRGB(0,255,0); glVertex3f(-400.0f, -150.0f, 200.0f); glVertex3f(400.0f, -150.0f, 200.0f); glEnd(); // Restore lighting state variables glPopAttrib(); // Flush drawing commands glFlush(); } Lighting and Color Index Mode In Chapter 8, you learned that in color index mode, color is specified as an index into a palette rather than as components of red, green, and blue light. This has some obvious implications for lighting effects. Most of the lighting functions expect light and material properties to be specified in terms of these RGBA components. Some consideration is made for color index mode by OpenGL, but in color index mode your lights may only contain diffuse and specular components. Material properties can include shininess, ambient, diffuse, and specular light, and although this may be enough to do some lighting, it is questionable whether it s actually worth the effort. In order to do lighting, your palette must contain three color ramps for ambient, diffuse, and specular colorings. To achieve satisfactory results, your ramps will usually progress from black to shades of a single color and finally to white. It s possible to define these such that you produce a smoothly shaded object in a single color, but this has few if any practical applications. Generally, most recognized OpenGL texts recommend that you avoid color index mode for lighting effects. Still, if you must use it, the CD contains a supplementary example called ILIGHT that shows how to use color index mode to illuminate a scene with some objects. However, all these objects are the same color!
Searching for affordable and proven webhost to host and run your servlet applications? Go to Linux Web Hosting services and you will find it.

Page 344 OpenGL Super Bible! Listing 9-12 Render (Professional web hosting)

Sunday, September 9th, 2007

Page 344 OpenGL Super Bible! Listing 9-12 Render the jet and its shadow // Called to draw scene void RenderScene(void) { // Clear the window with current clearing color glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Save the matrix state and do the rotations glPushMatrix(); // Draw jet at new orientation, put light in correct position // before rotating the jet glLightfv(GL_LIGHT0,GL_POSITION,lightPos); glRotatef(xRot, 1.0f, 0.0f, 0.0f); glRotatef(yRot, 0.0f, 1.0f, 0.0f); DrawJet(FALSE); // Restore original matrix state glPopMatrix(); // Get ready to draw the shadow and the ground // First disable lighting and save the projection state glPushAttrib(GL_LIGHTING_BIT); glDisable(GL_LIGHTING); glPushMatrix(); // Multiply by shadow projection matrix glMultMatrixf((GLfloat *)shadowMat); // Now rotate the jet around in the new flattened space glRotatef(xRot, 1.0f, 0.0f, 0.0f); glRotatef(yRot, 0.0f, 1.0f, 0.0f); // Pass true to indicate drawing shadow DrawJet(TRUE); // Restore the projection to normal glPopMatrix(); // Draw the light source glPushMatrix(); glTranslatef(lightPos[0],lightPos[1], lightPos[2]); glRGB(255,255,0); auxSolidSphere(5.0f); glPopMatrix(); // Draw the ground; we do manual shading to a darker green // in the background to give the illusion of depth glBegin(GL_QUADS); glRGB(0,128,0); glVertex3f(400.0f, -150.0f, -200.0f); glVertex3f(-400.0f, - 150.0f, -200.0f);
If you are in need for chaep and reliable webhost to host your website, our recommendation is http web server services.

OpenGL Super Bible! Page 343 The code in (Web hosting bandwidth)

Saturday, September 8th, 2007

OpenGL Super Bible! Page 343 The code in Listing 9-11 shows how the shadow projection matrix was created for this example. Note that we create the matrix once in SetupRC() and save it in a global variable. Listing 9-11 Setting up the shadow projection matrix GLfloat lightPos[] = { -75.0f, 150.0f, -50.0f, 0.0f }; // Transformation matrix to project shadow GLfloat shadowMat[4][4]; // This function does any needed initialization on the rendering // context. Here it sets up and initializes the lighting for // the scene. void SetupRC() { // Any three points on the ground (counterclockwise order) GLfloat points[3][3] = {{ -30.0f, -149.0f, -20.0f }, { -30.0f, -149.0f, 20.0f }, {40.0f, -149.0f, 20.0f }}; glEnable(GL_DEPTH_TEST); // Hidden surface removal glFrontFace(GL_CCW); // Counterclockwise polygons face out glEnable(GL_CULL_FACE); // Do not calculate inside of jet // Enable lighting glEnable(GL_LIGHTING); // Code to setup lighting, etc. // Light blue background glClearColor(0.0f, 0.0f, 1.0f, 1.0f ); // Calculate projection matrix to draw shadow on the ground MakeShadowMatrix(points, lightPos, shadowMat); } Listing 9-12 shows the rendering code for the SHADOW example. We first draw the jet as we normally would; then we restore the Modelview matrix and multiply it by the shadow matrix. This creates our squish Projection matrix. Then we draw the jet again (we ve modified our code to accept a flag telling the DrawJet function to render in color or black). After restoring the Modelview matrix once again, we draw a small yellow sphere to approximate the position of the light, and then draw a plane below the jet to indicate the ground. This rectangle lies in the same plane in which our shadow will be drawn.
You need excellent and relaible webhost company to host your web applications? Then pay a visit to Inexpensive Web Hosting services.