Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 9 of 9

Thread: Using glBitmap() and glDrawPixels()

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2001
    Location
    Domzale, Europe, Slovenia
    Posts
    6

    Using glBitmap() and glDrawPixels()

    I am trying to display various different formats with glDrawPixels(), like BMP(1bit,gray4bit,gray8bit,indexColor8bit,rgb24).
    Also trying to use glBitmap().

    Can someone please help me!

    AlesP
    AlesP

  2. #2
    Junior Member Newbie
    Join Date
    Apr 2001
    Location
    Domzale, Europe, Slovenia
    Posts
    6

    Re: Using glBitmap() and glDrawPixels()

    Can someone PLEASE help out a guy in need...i'm desperate!!!!
    AlesP

  3. #3
    Senior Member OpenGL Guru zed's Avatar
    Join Date
    Jul 2000
    Location
    S41.16.25 E173.16.21
    Posts
    2,609

    Re: Using glBitmap() and glDrawPixels()

    ive seen you post before but i cant understand what youre having problems with its very simple. perhaps something else is the problem?

    glRasterPos2i(0,0);
    glDrawPixels( image_width, image_height, format, type, pixels )

    ( im talking about the standard formats here )
    format + type can be various things eg

    format ->
    GL_RGB for a 24 bit image
    GL_RGBA for a 32 bit colour image
    GL_LUMINANCE for a grey scale image

    type ->
    GL_UNSIGNED_BYTE you supply the data as unsigned chars ie 0-255
    GL_FLOAT you supply the data as floats ie 0.0 - 1.0

  4. #4
    Junior Member Newbie
    Join Date
    Apr 2001
    Location
    Domzale, Europe, Slovenia
    Posts
    6

    Re: Using glBitmap() and glDrawPixels()

    Perhaps I forget to mention that I'm
    a beginner with C & openGL also.
    That is why I am having problem with a simple BMP loading.

    For example I would like to load Black & White BMP (1 bit) image with glDrawPixel function.
    I would like to process pixels on the image but I did not find out a simple example how to do that.

    To keep in mind, I am a C/GL starter but I'm trying.

    If you have some source example for this simple thing, I would be grateful to you!

    Thanks?
    AlesP

  5. #5
    Senior Member OpenGL Pro
    Join Date
    Oct 2000
    Location
    Fargo, ND
    Posts
    1,797

    Re: Using glBitmap() and glDrawPixels()

    OpenGL had no file loading functions. Do a search for code that can be used to load a BMP file. There are numerous examples, and it just takes a bit of searching.
    Deiussum
    Software Engineer and OpenGL enthusiast

  6. #6
    Junior Member Newbie
    Join Date
    Apr 2001
    Location
    sweden
    Posts
    5

    Re: Using glBitmap() and glDrawPixels()

    Check this out, this page has everything for us newbies.
    http://nehe.gamedev.net/opengl.asp
    Epicenter

  7. #7
    Junior Member Newbie
    Join Date
    Apr 2001
    Location
    Ljubljana, Slovenia
    Posts
    4

    Re: Using glBitmap() and glDrawPixels()

    for displaying 1bit image data (loaded for e.g. from BMP) u could use glBitmap(), but rather I'd use that for masking.
    For displaying you should use glDrawPixels
    , where u set the dimensions of the "image"
    you want to draw, pixel format... and pointer
    to pixel data.. for e.g. pixel data could be{RR1,GG1,BB1,RR2,GG2,BB2...}

    For drawing only pixel u could use glDrawPixel(1,1,format,type,data) ? but that seems lame.

    I am only a beginner, so if there are mistakes in my post, please correct them.

  8. #8
    Junior Member Newbie
    Join Date
    Apr 2001
    Location
    Domzale, Europe, Slovenia
    Posts
    6

    Re: Using glBitmap() and glDrawPixels()

    Thanks!
    AlesP

  9. #9
    Junior Member Newbie
    Join Date
    Apr 2001
    Location
    Domzale, Europe, Slovenia
    Posts
    6

    Re: Using glBitmap() and glDrawPixels()

    Thanks again!
    Next time I will post a link to simple sample I have created.
    AlesP

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •