Web server address - OpenGL Super Bible! Page 409 In this example,
OpenGL Super Bible! Page 409 In this example, the GL_UNPACK_ROW_LENGTH value specifies the width of the original image in pixels. Set this when the width specified with glDrawPixels is different from the width of the image. GL_UNPACK_SKIP_PIXELS specifies the number of pixels to skip on the left side of the image. Here we skip the first (640 300) / 2, or 170 pixels on the left side of the image to show the middle. GL_UNPACK_SKIP_ROWS is similar but specifies the number of rows or scanlines in the image to skip. Normally, this value represents the number of rows from the bottom, but you can change this by specifying a negative Y scaling with glPixelZoom. NOTE: The GL_UNPACK_ROW_LENGTH, GL_UNPACK_SKIP_PIXELS, and GL_UNPACK_SKIP_ROWS attributes refer to the original pixmap size in pixels, not the size after zooming! Reading Pixmaps OpenGL provides a function called glReadPixels that can read an image from the screen. Beyond the obvious application of saving your created image to disk, it can also be used for cool effects with texture mapping. Unlike glDrawPixels, glReadPixels ignores the current raster position and requires you to specify an (x,y) viewport coordinate for the lower-left corner of the image to read. Listing 11-8 demonstrates how to read the current viewport into a Windows bitmap structure suitable for saving to a file or using as a texture. Listing 11-8 ReadDIBitmap function /* * ‘ReadDIBitmap()’ - Read the current OpenGL viewport into a * 24-bit RGB bitmap. * * Returns the bitmap pixels if successful and NULL otherwise. */ void * ReadDIBitmap(BITMAPINFO **info) /* O - Bitmap information */ { long i, j, /* Looping var */ bitsize, /* Total size of bitmap */ width; /* Aligned width of a scanline */ GLint viewport[4]; /* Current viewport */ void *bits; /* RGB bits */ GLubyte *rgb, /* RGB looping var */
From our experience, we can recommend PHP Web Hosting services, if you need affordable webhost to host and run your web application.