Archive for July, 2007

Page 280 OpenGL Super Bible! was specified for (Web hosting unlimited bandwidth)

Sunday, July 22nd, 2007

Page 280 OpenGL Super Bible! was specified for the last vertex. The only exception is for a GL_POLYGON primitive, in which case the color is that of the first vertex.) Then the code in Listing 8-1 sets the top of the triangle to be pure red, the lower-right corner to be green, and the remaining bottom-left corner to be blue. Because smooth shading is specified, the interior of the triangle is shaded to provide a smooth transition between each corner. The output from the TRIANGLE program is shown in Figure 8-11. This represents the plane shown graphically in Figure 8-10. Figure 8-11 Output from the TRIANGLES program Polygons, more complex than triangles, can also have different colors specified for each vertex. In these instances, the underlying logic for shading can become more intricate. Fortunately, you never have to worry about it with OpenGL. No matter how complex your polygon, OpenGL will successfully shade the interior points between each vertex. Note that you will rarely wish to do this type of shading yourself, anyway. This is primarily used to produce lighting effects, and OpenGL once again comes to the rescue. We ll cover lighting in the Chapter 9. Windows Palettes The TRIANGLE and CCUBE example programs work reasonably well regardless of how many colors are available. If you can change the color depth of your system, try running these programs at the various color depths, starting at 16 colors and going up to 16 million if possible. You ll notice that the colors make a smooth transition regardless of color depth, but the higher color depths provide a smoother and more appealing image. Figures 8-12a and 8-12b show the output of the TRIANGLES sample with 16 colors and 16 million colors, respectively. Even though these pictures are not in color, you can see how much smoother the second triangle appears.
You want to have a cheap webhost for your apache application, then check apache web hosting services.

Web design rates - OpenGL Super Bible! Page 279 Figure 8-10 A

Sunday, July 22nd, 2007

OpenGL Super Bible! Page 279 Figure 8-10 A triangle in RGB color space Listing 8-1 Drawing a smooth-shaded triangle with red, green, and blue corners // Enable smooth shading glShadeModel(GL_SMOOTH); // Draw the triangle glBegin(GL_TRIANGLES); // Red Apex glColor3ub((GLubyte)255,(GLubyte)0,(GLubyte)0); glVertex3f(0.0f,200.0f,0.0f); // Green on the right bottom corner glColor3ub((GLubyte)0,(GLubyte)255,(GLubyte)0); glVertex3f(200.0f,-70.0f,0.0f); // Blue on the left bottom corner glColor3ub((GLubyte)0,(GLubyte)0,(GLubyte)255); glVertex3f(-200.0f, -70.0f, 0.0f); glEnd(); Setting the Shading Model The first line of Listing 8-1 actually sets the shading model OpenGL uses to do smooth shading the model we have been discussing. This is the default shading model, but it s a good idea to call this function anyway to ensure that your program is operating the way you intended. (The other shading model that can be specified with glShadeModel is GL_FLAT for flat shading. Flat shading means that no shading calculations are performed on the interior of primitives. Generally, with flat shading the color of the primitive s interior is the color that
If you are looking for affordable and reliable webhost to host and run your business application visit our ftp web hosting services.

Page 278 OpenGL Super Bible! Figure 8-9 How (Http web server)

Sunday, July 22nd, 2007

Page 278 OpenGL Super Bible! Figure 8-9 How a line is shaded from black to white You can do shading mathematically by finding the equation of the line connecting two points in the three-dimensional RGB color space. Then simply loop through from one end of the line to the other, retrieving coordinates along the way to provide the color of each pixel on the screen. Many good books on computer graphics will explain the algorithm to accomplish this and scale your color line to the physical line on the screen, etc. Fortunately, OpenGL will do all this for you! The shading exercise becomes slightly more complex for polygons. A triangle, for instance, can also be represented as a plane within the color cube. Figure 8-10 shows a triangle with each vertex at full saturation for the red, green, and blue color components. The code to display this triangle is in Listing 8-1, and in the example program TRIANGLES on the CD.
From our experience, we are can tell you that you can find a reliable and cheap webhost service at Java Web Hosting services.

OpenGL Super Bible! Page 277 Most OpenGL programs (Web hosting mysql)

Saturday, July 21st, 2007

OpenGL Super Bible! Page 277 Most OpenGL programs that you ll see will use glColor3f and will specify the intensity of each component as 0.0 for none or 1.0 for full intensity. However, it may be easier, if you have Windows programming experience, to use the glColor3ub version of the function. This version takes three unsigned bytes, from 0 to 255, to specify the intensities of red, green, and blue. Using this version of the function is like using the Windows RGB macro to specify a color: glColor3ub(0,255,128) = RGB(0,255,128) In fact, this may make it easier for you to match your OpenGL colors to existing RGB colors used by your program for other non-OpenGL drawing tasks. Remember that the RGB macro specifies a color to Windows but does not itself set the current drawing color, as glColor does. To do this, you d use the RGB macro in conjunction with the creation of a GDI pen or brush. Shading Our previous working definition for glColor was that this function set the current drawing color, and all objects drawn after this command would have the last color specified. Now that we have discussed the OpenGL drawing primitives (Chapter 6), we can expand this definition to this: The glColor function sets the current color that is used for all vertices drawn after the command. So far, all of our examples have drawn wireframe objects, or solid objects with each face a different but solid color. If we specify a different color for each vertex of a primitive (either point, line, or polygon), what color is the interior? Let s answer this question first regarding points. A point has only one vertex, and whatever color you specify for that vertex will be the resulting color for that point. A line, however, has two vertices and each can be set to a different color. The color of the line depends on the shading model. Shading is simply defined as the smooth transition from one color to the next. Any two points in our RGB color space (Figure 8-7) can be connected by a straight line. Smooth shading causes the colors along the line to vary as they do through the color cube from one color point to the other. In Figure 8-9, the color cube is shown with the black and white corners pointed out. Below it is a line with two vertices, one black and one white. The colors selected along the length of the line match the colors along the straight line in the color cube, from the black to the white corners. This results in a line that progresses from black through lighter and lighter shades of gray and eventually to white.
We recommend cheap and reliable webhost to host and run your web applications: Coldfusion Web Hosting services.

Page 276 OpenGL Super Bible! Figure 8-8 is

Saturday, July 21st, 2007

Page 276 OpenGL Super Bible! Figure 8-8 is a screenshot of the smoothly shaded color cube produced by a sample program from this chapter, CCUBE. The surface of this cube shows the color variations from black on one corner to white on the opposite corner. Red, green, and blue are present on their corners 255 units from black. Additionally, the colors yellow, cyan, and magenta have corners showing the combination of the other three primary colors. This program will do an adequate job of rendering the color cube, even in a 16-color Windows display mode, and you ll learn how this is done later in this chapter. You can also spin the color cube around to examine all of its sides, by pressing the arrow keys. Figure 8-8 Output from CCUBE is this color cube Setting the Drawing Color Let s briefly review the glColor() function. It is prototyped as follows: void glColor(red, green, blue, alpha); In the function name, the represents the number of arguments; it may be 3 for three arguments of red, green, and blue, or 4 for four arguments to include the alpha component. (The alpha component specifies the translucency of the color and will be covered in more detail in (Chapter 15.) For the time being, just use a three-argument version of the function. The in the function name specifies the argument s data type and can be b, d, f, i, s, ub, ui, us, for byte, double, float, integer, short, unsigned byte, unsigned integer, and unsigned short data types, respectively. Another version of the function has a v appended to the end; this version takes an array that contains the arguments (the v stands for vectored). In the Reference Section you will find an entry with more details on the glColor() function.
We recommend cheap and reliable webhost to host and run your web applications: Coldfusion Web Hosting services.

OpenGL Super Bible! Page 275 Figure 8-6 The

Saturday, July 21st, 2007

OpenGL Super Bible! Page 275 Figure 8-6 The origin of RGB color space This color cube (Figure 8-7) then contains all the possible colors, either on the surface of the cube or within the interior of the cube. For example, all possible shades of gray between black and white lie internally on the diagonal line between the corner (0,0,0) and (255,255,255). Figure 8-7 The RGB color space
If you are looking for affordable and reliable webhost to host and run your business application visit our ftp web hosting services.

Web design service - Page 274 OpenGL Super Bible! 24-bit for photographic

Friday, July 20th, 2007

Page 274 OpenGL Super Bible! 24-bit for photographic image reproduction. It is difficult to tell the difference between 16bit and 24-bit color modes for most photographic images, although some banding may be observed on smoothly shaded surfaces with only 16 bits of color. Programmatically, a color in the 15- or 16-bit color mode is set in the same way as for the 24-bit color modes that is, as a set of three 8-bit intensities. The hardware or device driver takes this 24-bit color value and scales it to the nearest matching 15- or 16-bit color value before setting the pixel color. Selecting a Color You now know that OpenGL specifies an exact color as separate intensities of red, green, and blue components. You also know that Windows-supported PC hardware may be able to display nearly all of these combinations, or only a very few. How, then, do we specify a desired color in terms of these red, green, and blue components? And how will Windows fulfill this request using the colors it has available? The Color Cube Since a color is specified by three positive color values, we can model the available colors as a volume that we shall call the RGB color space. Figure 8-6 shows what this color space looks like at the origin with red, green, and blue as the axes. The red, green, and blue coordinates are specified just like x, y, and z coordinates. At the origin (0,0,0), the relative intensities of all the components is zero, and the resulting color is black. The maximum available on the PC for storage information is 24 bits, so with 8 bits for each component, let s say that a value of 255 along the axis would represent full saturation of that component. We would then end up with a cube measuring 255 on each side. The corner directly opposite black, where the concentrations are (0,0,0), is white with relative concentrations of (255,255,255). At full saturation (255) from the origin along each axis would lie the pure colors of red, green, and blue, respectively.
We highly recommend you visit web and email hosting services if you need stable and cheap web hosting platform for your web applications.

OpenGL Super Bible! Page 273 and sharpness of

Friday, July 20th, 2007

OpenGL Super Bible! Page 273 and sharpness of your image. It is generally accepted that most serious graphics applications can ignore the 16-color mode. 8-Bit Color The 8-bit mode supports up to 256 colors on the screen. This is a substantial improvement, and when combined with dithering (explained later in this chapter) can produce satisfactory results for many applications. There are 8 bits devoted to each pixel, which are used to hold a value from 0 to 255 that references an index into a color table called the palette. The colors in this color table can be selected from over 16 million possible colors. If you need 256 shades of red, the hardware will support it. Each color in the palette is selected by specifying 8 bits each for separate intensities of red, green, and blue, which means the intensity of each component can range from 0 to 255. This effectively yields a choice of over 16 million different colors for the palette. By selecting these colors carefully, near- photographic quality can be achieved on the PC screen. 24-Bit Color The best quality image production available today on PCs is 24-bit color mode. In this mode, a full 24 bits are devoted to each pixel to hold eight bits of color data for each of the red, green, and blue color components (8 + 8 + 8 = 24). You have the capability to put any of over 16 million possible colors in every pixel on the screen. The most obvious drawback to this mode is the amount of memory required for high-resolution screens (over 2MB for a 1024 768 screen). Also indirectly, it is much slower to move larger chunks of memory around when doing animation, or just drawing on the screen. Fortunately, today s accelerated graphics adapters are optimized for these types of operations. Other Color Depths For saving memory or improving performance, many display cards also support various other color modes. In the area of performance improvement, some cards support a 32-bit color mode sometimes called true color mode. Actually, the 32-bit color mode cannot display any more colors than the 24-bit mode, but it improves performance by aligning the data for each pixel on a 32-bit address boundary. Unfortunately, this results in a wasted 8-bits (1 byte) per pixel. On today s 32-bit Intel PCs, a memory address evenly divisible by 32 results in much faster memory access. Two other popular display modes are sometimes supported to use memory more efficiently. The first is 15-bit color mode, which uses 5 bits each for storing red, green, and blue components. Each pixel can display any of 32,768 different colors. And in 16-bit mode, an additional bit is added for one of the color components (usually green), allowing one of 65,536 possible colors for each pixel. This last mode, especially, is practically as effective as
Please visit our professional web hosting services to find out about cheap and reliable webhost service that will surely answer all your demands.

Page 272 OpenGL Super (Php web hosting) Bible! PC Display Modes

Friday, July 20th, 2007

Page 272 OpenGL Super Bible! PC Display Modes Microsoft Windows revolutionized the world of PC graphics in two respects. First, it created a mainstream graphical operating environment that was adopted by the business world at large and, soon thereafter, the consumer market. Second, it made PC graphics significantly easier for programmers to do. With Windows, the hardware was virtualized by Windows display device drivers. Instead of having to write instructions directly to the video hardware, programmers today can write to a single API, and Windows handles the specifics of talking to the hardware. Typically, Microsoft provides in the Windows base package (usually with vendor assistance) drivers for the more popular graphics cards. Hardware vendors with later hardware and software revisions ship their cards with Windows drivers and often provide updates to these drivers on BBSs or on the Internet. There was a time when Windows shipped with drivers for the Hercules monochrome cards, and standard CGA, and EGA video adapters. Not anymore. Standard VGA is now considered the bottom of the barrel. New PCs sold today are capable of at least 640 480 resolution with 16 colors, and the choices of resolution and color depth go up from there. Screen Resolution Screen resolution for today s PCs can vary from 640 480 pixels up to 1280 1024 or more. Screen resolution, however, is not usually a prime limiting factor in writing graphics applications. The lower resolution of 640 480 is considered adequate for most graphics display tasks. More important is the size of the window, and this is taken into account easily with clipping volume and viewport settings (see Chapter 3). By scaling the size of the drawing to the size of the window, you can easily account for the various resolutions and window size combinations that can occur. Well-written graphics applications will display the same approximate image regardless of screen resolution. The user should automatically be able to see more and sharper details as the resolution increases. Color Depth If an increase in screen resolution or in the number of available drawing pixels in turn increases the detail and sharpness of the image, so too should an increase in available colors improve the clarity of the resulting image. An image displayed on a computer that can display millions of colors should look remarkably better than the same image displayed with only 16 colors. In programming, there are really only three color depths that you need to worry about: 4-bit, 8-bit, and 24-bit. 4-Bit Color On the low end, your program may be run in a video mode that only supports 16 colors called 4-bit mode because there are 4 bits devoted to color information for each pixel. These 4 bits represent a value from 0 to 15 that provides an index into a set of 16 predefined colors. With only 16 colors at your disposal, , there is little you can do to improve the clarity
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 271 could place any

Friday, July 20th, 2007

OpenGL Super Bible! Page 271 could place any four of 16 colors on the screen at once. A higher resolution (640 200) with two colors was also possible, but wasn t as effective or cost conscious as the Hercules card (color monitors = $$$). CGA was puny by today s standards it was even outmatched then by the graphics capabilities of a $200 Commodore 64 or Atari home computer. Lacking adequate resolution for business graphics or even modest modeling, CGA was used primarily for simple PC games or business applications that could benefit from colored text. Generally though, it was hard to make a good business justification for this more expensive hardware. The next big breakthrough for PC graphics came when IBM introduced the Enhanced Graphics Adapter (EGA) card. This one could do more than 25 lines of colored text in new text modes, and for graphics could support 640 350-pixel bitmapped graphics in 16 colors! Other technical improvements eliminated some flickering problems of the CGA ancestor and provided for better and smoother animation. Now arcade-style games, real business graphics, and even 3D graphics became not only possible but even reasonable on the PC. This advance was a giant move beyond CGA, but still PC graphics were in their infancy. The last mainstream PC graphics standard set by IBM was the VGA card (which stood for Vector Graphics Array rather than the commonly held Video Graphics Adapter). This card was significantly faster than the EGA, could support 16 colors at a higher resolution (640 480) and 256 colors at a lower resolution of 320 200. These 256 colors were selected from a palette of over 16 million possible colors. That s when the floodgates opened for PC graphics. Near photo- realistic graphics become possible on PCs. Ray tracers, 3D games, and photo- editing software began to pop up in the PC market. IBM, as well, had a high-end graphics card the 8514 for their workstations. This card could do 1024 768 graphics at 256 colors. IBM thought this card would only be used by CAD and scientific applications! But one thing is certain about the consumer market: They always want more. It was this short-sightedness that cost IBM its role as standard-setter in the PC graphics market. Other vendors began to ship Super-VGA cards that could display higher and higher resolutions, with more and more colors. First 800 600, then 1024 768 and even higher, with first 256 colors, then 32,000, to 65,000. Today 24-bit color cards can display 16 million colors at resolutions up to 1024 768. Inexpensive PC hardware can support full color at VGA resolutions, or 8 00 600 Super-VGA resolutions. Most Windows PCs sold today can support at least 65,000 colors at resolutions of 1024 768. All this power makes for some really cool possibilities photo-realistic 3D graphics to name just one. When Microsoft ported OpenGL to the Windows platform, that enabled creation of high-end graphics applications for PCs. Today s Pentium and Pentium Pro P Cs are still no match for modern SGI Workstations. But combine them with 3D-graphics accelerated graphics cards, and you can get the kind of performance possible only a few years ago on $100,000 graphics workstations at a Wal-Mart Christmas special! In the very near future, typical home machines will be capable of very sophisticated simulations, games, and more. Our children will laugh at the term virtual reality in the same way we smile at those old Buck Rogers rocket ships.
If you are searching for cheap webhost for your web application, please visit MySQL5 Web Hosting services.