Doxygen Source Code Documentation
        
Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search   
glut_bitmap.c
Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 #include <GL/glut.h>
00009 #include "glutint.h"
00010 #include "glutbitmap.h"
00011 
00012 void
00013 glutBitmapCharacter(GLUTbitmapFont font, int c)
00014 {
00015   BitmapCharPtr ch;
00016   BitmapFontPtr fontinfo = (BitmapFontPtr) font;
00017   GLint swapbytes, lsbfirst, rowlength;
00018   GLint skiprows, skippixels, alignment;
00019 
00020   if (c < fontinfo->first ||
00021     c >= fontinfo->first + fontinfo->num_chars)
00022     return;
00023   ch = fontinfo->ch[c - fontinfo->first];
00024   if (ch) {
00025     
00026     glGetIntegerv(GL_UNPACK_SWAP_BYTES, &swapbytes);
00027     glGetIntegerv(GL_UNPACK_LSB_FIRST, &lsbfirst);
00028     glGetIntegerv(GL_UNPACK_ROW_LENGTH, &rowlength);
00029     glGetIntegerv(GL_UNPACK_SKIP_ROWS, &skiprows);
00030     glGetIntegerv(GL_UNPACK_SKIP_PIXELS, &skippixels);
00031     glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment);
00032     
00033 
00034 
00035 
00036     glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE);
00037     glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE);
00038     glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
00039     glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
00040     glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
00041     glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
00042     glBitmap(ch->width, ch->height, ch->xorig, ch->yorig,
00043       ch->advance, 0, ch->bitmap);
00044     
00045     glPixelStorei(GL_UNPACK_SWAP_BYTES, swapbytes);
00046     glPixelStorei(GL_UNPACK_LSB_FIRST, lsbfirst);
00047     glPixelStorei(GL_UNPACK_ROW_LENGTH, rowlength);
00048     glPixelStorei(GL_UNPACK_SKIP_ROWS, skiprows);
00049     glPixelStorei(GL_UNPACK_SKIP_PIXELS, skippixels);
00050     glPixelStorei(GL_UNPACK_ALIGNMENT, alignment);
00051   }
00052 }