Presentation is loading. Please wait.

Presentation is loading. Please wait.

111/17/2015 03:24 UML Solution Involves Selection of Discrete Representation Values.

Similar presentations


Presentation on theme: "111/17/2015 03:24 UML Solution Involves Selection of Discrete Representation Values."— Presentation transcript:

1 111/17/2015 03:24 UML Solution Involves Selection of Discrete Representation Values

2 211/17/2015 03:24 UML Antialiasing: An Example

3 311/17/2015 03:24 UML Aliasing: Square Pixels

4 411/17/2015 03:24 UML Antialiasing: Unweighted Area Sampling Pixel Intensity Proportional to Area of Intersection

5 511/17/2015 03:24 UML Antialiasing: Unweighted Area Sampling

6 611/17/2015 03:24 UML Antialiasing: Weighted Sampling Function (Conical) Desired Line Weighting Function Region of Overlap

7 711/17/2015 03:24 UML Gupta-Sproull Antialiasing v 1+v 1-v

8 811/17/2015 03:24 UML Write from Memory to Frame Buffer Main Memory

9 911/17/2015 03:24 UML Read from Frame Buffer into Main Memory Main Memory

10 1011/17/2015 03:24 UML Copy from One Part of Frame Buffer to Another

11 1111/17/2015 03:24 UML OpenGL Functions for Reading, Writing, Copying Pixel Data glReadPixels( ) - Reads a rectangular array of pixels from the frame buffer and stores in main memory glDrawPixels( ) - Writes a rectangular array of pixels into the frame buffer from data in main memory glCopyPixels( ) - Copies a rectangular array of pixels from one part of the frame buffer to another Issues: Kind of frame buffer data How data is stored in main memory Data conversions performed during reading, writing, or copying

12 1211/17/2015 03:24 UML Reading Pixel Data Frame Buffer -> Memory void glReadPixels(GLint x, Glint y, Glsizei width, GLsizei height, GLenum format, Glenum type, GLvoid *pixels); x - x coordinate of lower left corner of rectangular subimage y - y coordinate of lower left corner of rectangular subimage width - width of subimage in pixels height - height of subimage in pixels format - type of pixel data elements read type - storage data type for each element *pixels - array to receive the data

13 1311/17/2015 03:24 UML Pixel Formats GL_COLOR_INDEX A single color index GL_RGB A red color component followed by a green followed by a blue GL_RGBA Red, green, blue, alpha components GL_RED A single red component GL_GREEN A single green component GL_BLUE A single blue component GL_ALPHA A single alpha component GL_LUMINANCE A single luminance component GL_LUMINANCE_ALPHA A luminance component followed by an alpha component GL_STENCIL_INDEX A single stencil index GL_DEPTH_COMPONENT A single depth component

14 1411/17/2015 03:24 UML Data Types GL_UNSIGNED_BYTE unsigned 8-bit integer GL_BYTE signed 8-bit integer GL_BITMAP single bits in unsigned 8-bit integers GL_UNSIGNED_SHORT unsigned 16-bit integer GL_SHORT signed 16-bit integer GL_UNSIGNED_INT unsigned 32-bit integer GL_INT 32-bit integer GL_FLOAT single-precision float pt.

15 1511/17/2015 03:24 UML Writing Pixel Data Memory -> Frame Buffer void glDrawPixels(Glsizei width, GLsizei height, GLenum format, Glenum type, GLvoid *pixels); width - width of subimage in pixels height - height of subimage in pixels format - type of pixel data elements read type - storage data type for each element *pixels - array holding the data to be drawn Lower left corner of the subimage is defined by the current raster position, defined by glRasterPos*().

16 1611/17/2015 03:24 UML Copying Pixel Data void glCopyPixels(GLint x, Glint y, Glsizei width, GLsizei height,Glenum type); x - x coordinate of lower left corner of rectangular subimage y - y coordinate of lower left corner of rectangular subimage width - width of subimage in pixels height - height of subimage in pixels type - GL_COLOR, GL_DEPTH, or GL_STENCIL Copied data is drawn at the current raster position.

17 1711/17/2015 03:24 UML Pixel Storage Mode Determination void glPixelStore{if} (GLenum pname, TYPE param); ParameterTypeDefault GL_UNPACK_SWAP_BYTESGLbooleanFALSE GL_PACK_SWAP_BYTES GL_UNPACK_LSB_FIRSTGLboolearFALSE GL_PACK_LSB_FIRST GL_UNPACK_ROW_LENGTHGLint0 GL_PACK_ROW_LENGTH GL_UNPACK_SKIP_ROWSGLint0 GL_PACK_SKIP_ROWS GL_UNPACK_SKIP_PIXELSGLint0 GL_PACK_SKIP_PIXELS GL_UNPACK_ALIGNMENTGLint4 GL_PACK_ALIGNMENT

18 1811/17/2015 03:24 UML Reading a Subimage from Memory ROW_LENGTH subimage SKIP_PIXELS SKIP_ROWS image in memory

19 1911/17/2015 03:24 UML Pixel Transfer Operations void glPixelTransfer{if}(GLenum pname, TYPE param); ParameterTypeDefault GL_RED_SCALEGLfloat1.0 GL_GREEN_SCALEGLfloat1.0 GL_BLUE_SCALEGLfloat1.0 GL_RED_BIASGLfloat0.0 GL_GREEN_SCALEGLfloat0.0 GL_BLUE_SCALEGLfloat0.0... and many more

20 2011/17/2015 03:24 UML Graphics Files ModelRender Display ModelRender Display ModelRender Display Store Customary graphics data flow: Alternative graphics data flows:

21 2111/17/2015 03:24 UML Graphics File Types “Vector”Bitmap

22 2211/17/2015 03:24 UML Vector File Formats Advantages and…….. Disadvantages 0 Efficient representation 0 Work well for “line art” 0 Well suited to scaling (zoom) 0 Objects can have identity 0 Extensible to 3D 0 Limited set of objects that can be represented

23 2311/17/2015 03:24 UML Bitmap File Formats Advantages and…….. Disadvantages 0 Represent images with complex variations in colors 0 Storage size -Mitigated by compression techniques 0 Costly to manipulate 0 Fixed resolution - problem with scaling 0 Inability to identify “objects”

24 2411/17/2015 03:24 UML Graphics Metafiles Page Description Languages Graphics Metafile Attributes Vector Data Image Data

25 2511/17/2015 03:24 UML Bitmap File Formats: Generic Structure Header Pixel Data [Optional Compression] [Color Table] Fixed File Offset

26 2611/17/2015 03:24 UML Example Bitmap Format: Windows BMP (Device Independent Bitmap) File Header Bitmap Data Bitmap Header 0 14

27 2711/17/2015 03:24 UML Example Bitmap Format: Windows BMP (Device Independent Bitmap) 0 Offset Size Name Description 02bfTypeASCII “BM” 24bfSizeSize of file in bytes 62bfReserved1Zero 82bfReserved2Zero 104bfOffBitsByte offset to image File Header

28 2811/17/2015 03:24 UML Example Bitmap Format: Windows BMP (Device Independent Bitmap) 14 Offset Size Name Description 144biSizeSize of this header 184biWidthImage width (pixels) 224biHeightImage height 262biPlanes#planes (=1) 282biBitCountBits/pixel (1,4,8 or 24) 304biCompressionCompression type 344biSizeImageSize (bytes) of comp.img. 384biXPelsPerMeterx pixels/meter 424biYPelsPerMetery pixels/meter 464biClrUsedNumber of colors used 504biClrImportantNo. of important colors 544*NbmiColorsColor Map Bitmap Header

29 2911/17/2015 03:24 UML Example Bitmap Format: Windows BMP (Device Independent Bitmap) 54 Offset Size Name Description 01rgbBlueBlue value 11rgbGreenGreen value 21rgbRedRed value 31rgbReservedZero Color Map

30 3011/17/2015 03:24 UML Example Bitmap Format: Windows BMP (Device Independent Bitmap) 0 Bits are stored a row at a time starting from the bottom of the image to the top. 0 Each row is padded to a 4-byte boundary 0 Significance of bits depends upon the number of bits per pixel -In case of 1 bit per pixel each pixel is a single bit. High- order bit is the leftmost pixel -In case of 4 bit per pixel images are packed two pixels per byte, with the high nibble being the leftmost pixel

31 3111/17/2015 03:24 UML Example Bitmap Format: Windows BMP (Device Independent Bitmap) Pixel 1 Pixel 2 Pixel 3 Pixel 4 Pixel 5 Pixel 6 Pixel 7 Pixel 8 Pixel 9 Pixel 10 Pixel 1 Pixel 2 8 bits/pixel (color index) 24 bits/pixel Pixel 3

32 3211/17/2015 03:24 UML Windows Bitmap RLE Compression Repeating groups (2 bytes: count, repeated byte): 05 24 24 24 24 24 24 Literal groups (zero byte, pixel count, literal pixels): 00 05 12 34 56 78 9A 00 12 34 56 78 9A Special group: 00 00end of row 00 01end of bitmap 00 02 xx yycontinuation xx pixels to right and yy pixels down

33 3311/17/2015 03:24 UML Texture Mapping Texture Map = image Polygon

34 3411/17/2015 03:24 UML Texture Mapping: The Main Steps 0 Specify the texture -Usually a single, two dimensional, rectangular image =Can be one dimensional -Individual elements: texels -One to four elements per texel (RGBA) -OpenGL 1.x requires dimensions be powers of two 0 Define how the texture is to be applied to each pixel -Decal mode -Replace mode -Modulate mode -Blend mode -Add mode (new with OpenGL 2.0) 0 Enable texture mapping 0 Draw the scene, supplying both texture and geometric coordinates

35 3511/17/2015 03:24 UML Texture Mapping: Specifying the Current Texture in OpenGL void glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLvoid *texels); target - future use, must be GL_TEXTURE_2D level - 0 unless using multiple level of detail internalFormat - one of 38 symbolic constants width, height - height and width of texture map in texels border - size of border in texels format, type - storage parameters, same as glDrawPixels() *texels - storage location of the texture map

36 3611/17/2015 03:24 UML Binding Texture Objects void glBindTexture(GLenum target, GLuint textureName); target: GL_TEXTURE_1D or GL_TEXTURE_2D textureName: unique unsigned int identifier When initially called, binds the default texture state to the identifier. Subsequent calls to texture functions modify the state of the texture object. When binding to a previously created texture object, that object becomes active. Unique texture names can be generated by: glGenTextures()

37 3711/17/2015 03:24 UML Texture Mapping: Assigning Texture Coordinates void glTexCoord2d(GLdouble s, GLdouble t); s t 1.00.0 1.0 Values outside [0.0, 1.0] can be made to either wrap or clamp to boundary values Texture Image

38 3811/17/2015 03:24 UML Boundary Wrapping/Clamping void glTexParameteri(GLenum target, GLenum pname, TYPE param); target: GL_TEXTURE_2D pname: GL_TEXTURE_WRAP_S or GL_TEXTURE_WRAP_T param: GL_CLAMP uses the last pixel value in the s or t direction for s,t outside [0,1] GL_REPEAT repeats the texture pattern for s, t outside [0,1]

39 3911/17/2015 03:24 UML Texture Mapping: Magnification and Minification TexturePolygon Texture MagnificationMinification

40 4011/17/2015 03:24 UML Texture Mapping: Specifying Filtering for Mag./Min. glTexParameteri(GL_TEXTURE_2D, filter type, filter)’ filter type - GL_TEXTURE_MAG_FILTER for magnification, GL_TEXTURE_MIN_FILTER for minification filter - GL_NEAREST selects the texel mapping nearest to the target pixel GL_LINEAR performs a linear average of the 2x2 array of texels around the mapped point

41 4111/17/2015 03:24 UML Texture Mapping: How the Texture is Applied void glTexEnv*(GLenum target, GLenum pname, GLenum param); target - must be GL_TEXTURE_ENV pname - GL_TEXTURE_ENV_MODE param - one of GL_DECAL, GL_REPLACE, GL_MODULATE, GL_BLEND, GL_ADD

42 4211/17/2015 03:24 UML Texture Mapping: Interpreting glTexEnv() Parameters From OpenGL 2.0 Specification, J. Leech & P. Brown, ed., Oct. 22, 2004

43 4311/17/2015 03:24 UML Texture Mapping: Interpreting glTexEnv() Parameters From OpenGL 2.0 SpecificationFrom OpenGL 2.0 Specification, J. Leech & P. Brown, ed., Oct. 22, 2004


Download ppt "111/17/2015 03:24 UML Solution Involves Selection of Discrete Representation Values."

Similar presentations


Ads by Google