1 / 19

CS 470 Introduction to Computer Graphics

CS 470 Introduction to Computer Graphics. Bitmaps & Images. Bitmaps and Images. Some objects that we might draw are not geometry These objects are images and consist of bitmaps You can’t (for the most part) manipulate bitmaps the same way you manipulate geometry. Bitmaps and Images.

virgo
Download Presentation

CS 470 Introduction to Computer Graphics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS 470Introduction toComputer Graphics Bitmaps & Images

  2. Bitmaps and Images • Some objects that we might draw are not geometry • These objects are images and consist of bitmaps • You can’t (for the most part) manipulate bitmaps the same way you manipulate geometry.

  3. Bitmaps and Images • OpenGL pipeline Geometry Rasterization Display Bitmaps/ Pixels

  4. Bitmaps and Images void glBitmap(GLsizei r, GLsize c, GLfloat dx, GLfloat dy, GLfloat xn, GLfloat yn, GLubyte *array); Creates an r by c image from the bitmap array located at dx, dy from the current raster position. xn, yn are the new values of rasterposition.

  5. Bitmaps and Images • Sample code – GLubyte wb[2] = {0x00, 0xff}; GLubyte check[512]; int i, j; for[i=0; i<64, i++) for (j=0; j<8, j++); check[i*8 +j] = wb[(i/8+j)%2]; glBitmap(64, 64, 0.0, 0.0, 0.0, 0.0, check); from Angel, 2002

  6. Bitmaps and Images void glLogicOp(Glenum logop); Determines the logicial operation used to display the image over existing display. Default is to replace the existing pixel with the image pixel Must enable with glEnable(GL_COLOR_LOGIC_OP);

  7. Bitmaps and Images • Some logic operations • GL_CLEAR • GL_COPY source • GL_NOOP destination • GL_SET set regardless • GL_OR s OR d • GL_XOR s XOR d

  8. Bitmaps and Images void glDrawPixels(GLsizei w, GLsizei h, GLenum format, GLenum type, void *array); Draws images from pixels defined in array at current raster position. Format can be GL_RGB, GL_RGBA, GL_RED, …, GL_DEPTH_COMPONENT

  9. Bitmaps and Images void glReadPixels(GLint x, GLsize y, GLsize w, GLsize h, GLenum format, GLenum type, void *array); Takes a snapshot of a w by h rectangle at x, y and stores it in an array;

  10. Bitmaps and Images void glCopyPixels(GLint x, GLint y, GLsizei w, GLsizei h, GLenum buffer); copies a w by h rectangular image from buffer at x, y and puts it at current raster position.

  11. Bitmaps and Pixels void glReadBuffer(GLenum buffer); void glDrawBuffer(GLenum buffer); Determines the buffer used for reading or drawing respectively.

  12. Bitmaps and Images • Buffers can be • GL_FRONT • GL_BACK • GL_FRONT_AND_BACK • GL_RIGHT_FRONT • GL_LEFT_FRONT • GL_RIGHT_FRONT • GL_LEFT_FRONT • …

  13. Bitmaps and Images • Pixel mapping • alters pixel values according to a map • allows you to make color adjustments • allows you to create false colors

  14. Bitmaps and Images void glPixelTransfer{i|f}(GLenum name, Type value); Defines how pixel mapping can occur i.e. – glPixelTransferi(GL_MAP_COLOR, GL_TRUE);

  15. Bitmaps and Images void glPixelMap{us|ui|f}v(GLenum map, GLint size, TYPE *array); Defines a map for translating pixel to new pixel values. Map can be GL_PIXEL_MAP_I_TO_R {G|B} or …R_TO_R, B_TO_B, G_TO_G

  16. Bitmaps and Images void glPixelZoom(GLfloat sx, sy); scales pixels in bitmap by factors sx and sy. sx, sy > 1 – enlarge sx,sy < 1 – reduce negative sx, sy invert the image

  17. Bitmaps and Images void gluScaleImage(GLenum format, GLint win, GLint hin, GLenum typein, void *imagein, GLint wout, GLint hout, GLenum typeout, void *imageout); Scales an image/bitmap from imagein and writes it to imageout.

  18. Bitmaps and Images • Image processing

More Related