3D Computer Game Design - PowerPoint PPT Presentation

1 / 16
About This Presentation
Title:

3D Computer Game Design

Description:

... left corner of the bitmap's rectangle ... Drawing the Bitmap. After you set the current ... Display 50 16x16 bitmaps in random locations during each frame ... – PowerPoint PPT presentation

Number of Views:269
Avg rating:3.0/5.0
Slides: 17
Provided by: tainc
Category:
Tags: bitmap | computer | design | game

less

Transcript and Presenter's Notes

Title: 3D Computer Game Design


1
????????3D Computer Game Design
  • Chapter 6
  • Bitmaps and Images with OpenGL
  • ????? ???

2
In this chapter, you will learn
  • How to use OpenGL bitmaps
  • OpenGL pixel functions
  • How to load and save the Targa image format

3
The OpenGL Bitmap
  • Bitmap
  • A rectangular array of pixels
  • One bit of information (a 0 or 1)
  • Example
  • 16 x 16 bitmaps
  • Drawn by OpenGL as the letter X

4
The OpenGL Bitmap
  • Draw the bitmap
  • At the lower-left corner
  • Working its way up, row by row
  • The bottom of the bitmap is the first set of data
  • The top of the bitmap is the last set of data

5
(No Transcript)
6
Positioning the Bitmap
  • The glRasterPos( ) function
  • Specify the current raster coordinates
  • Define the bottom-left corner of the bitmaps
    rectangle
  • Set the current raster coordinates to (30, 10)
  • glRasterPos2i(30, 10)

7
Drawing the Bitmap
  • After you set the current raster position
  • You can draw your bitmap with the glBitmap()
    function

8
Drawing the Bitmap
  • Draw your bitmap with glBitmap() function

void glBitmap(GLsizei width, GLsizei height,
GLfloat xOrigin, GLfloat yOrigin, GLfloat
xIncream, GLfloat yIncream, const GLubyte
Xbitmap) width and height in pixels at the
coordinates(xOrigin, yOrigin) relative to the
current raster position. The values xIncream and
yIncream specify step increments that are added
to the current raster position after the bitmap
is drawn.
9
An OpenGL Bitmap Example
  • Display 50 16x16 bitmaps in random locations
    during each frame

10
(No Transcript)
11
(No Transcript)
12
Targa Image Files
  • Targa image format
  • Simple to work with
  • Incorporate transparency
  • Other cool special effects

13
The Targa File Format
  • Two parts
  • The header and the data

14
Loading Targa Files
  • An example - LoadTGA
  • Load 24-bit and 32-bit compressed and
    uncompressed Targa images

15
Summary
  • You have learned about
  • How to set the current OpenGL raster position and
    draw the bitmaps
  • How to load and draw Targa images

16
References
  • Dave Astle and Kevin Hawkins, Beginning OpenGL
    Game Programming, 1st Edition, Course Technology
    PTR, 2004.
  • http//glbook.gamedev.net
Write a Comment
User Comments (0)
About PowerShow.com