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 8 of 8

Thread: Loading *.rgb file and Reading the Pixel values

  1. #1
    Junior Member Regular Contributor
    Join Date
    Jul 2003
    Location
    Bangalore, Karnataka, India
    Posts
    123

    Loading *.rgb file and Reading the Pixel values

    Dear All,

    How to load an rgb file and store pixel values from the file.
    glReadPixels reads the pixels from an image only.
    Once I read the image, I want to store in an array,

    Please tell me .

    I am new to OPENGL.


    Regrds

  2. #2
    Intern Contributor
    Join Date
    Jan 2001
    Location
    Irving TX USA
    Posts
    58

    Re: Loading *.rgb file and Reading the Pixel values

    nehe.gamedev.net - lesson 6 I think is the one where he loads a bitmap. You just have to know the BITMAPHEADER structure, that's read from the file first, the rest is RGB data.

    That's actually commonplace in OpenGL is that the image data is read into in array or pointer and then passed to, for example, glTexture2D.

  3. #3
    Junior Member Newbie
    Join Date
    Jul 2003
    Location
    Perpignan, France
    Posts
    15

    Re: Loading *.rgb file and Reading the Pixel values

    If you want more informations about bmp format there are good web site that explain you how it's made, so you can easierly use them. The Nehe Tut are very good to learn such a thing.

  4. #4
    Advanced Member Frequent Contributor
    Join Date
    Aug 2001
    Location
    Italy
    Posts
    628

    Re: Loading *.rgb file and Reading the Pixel values

    Ah, so rgb files are actually, windows bmp files...
    Well, I learnt something.

  5. #5
    Junior Member Newbie
    Join Date
    Jul 2003
    Location
    Perpignan, France
    Posts
    15

    Re: Loading *.rgb file and Reading the Pixel values

    Well in fact I'm not sure...
    Well let me see a seconde plize...
    Oh Yeah! Exact. It seems that is not the same thing. Well I look in Paint Shop Pro (to make it quick) and RGB file or not at the same range than the BMP so I guess the are construct differently.But I don't how.
    So sorry for my answer, and sorry I'm not an expert about it, I will look at it.
    Thanks Obli.

  6. #6
    Guest

    Re: Loading *.rgb file and Reading the Pixel values

    RGB file contain just that. simple red green and blue data for each pixel location.

    very simple to open and read. as suggested check out the NehE tuts.

    JA

  7. #7
    Advanced Member Frequent Contributor
    Join Date
    Aug 2001
    Location
    Italy
    Posts
    628

    Re: Loading *.rgb file and Reading the Pixel values

    So it's a easy to use raw data file format...
    Layout?

    ushort width
    ushort height
    ubyte channels
    uchar bytesPerChannel
    [array of of (width)x(height)x(channels) entries (bytesPerChannel) bytes wide]

    Is it?
    If it is so simple I will add it to my todo list... having more and more formats avaiable to choose is simply good.

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

    Re: Loading *.rgb file and Reading the Pixel values

    www.wotsit.org. The place to go for file format specifications
    Deiussum
    Software Engineer and OpenGL enthusiast

Posting Permissions

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