Results 1 to 8 of 8

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

  1. #1
    Senior 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
    Member 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
    Senior Member Frequent Contributor
    Join Date
    Aug 2001
    Location
    Italy
    Posts
    625

    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
    Senior Member Frequent Contributor
    Join Date
    Aug 2001
    Location
    Italy
    Posts
    625

    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,753

    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

Similar Threads

  1. Difficulty in reading values from depth buffer
    By Var2008 in forum OpenGL: Basic Coding
    Replies: 9
    Last Post: 07-21-2008, 10:14 AM
  2. Replies: 12
    Last Post: 05-25-2005, 12:42 PM
  3. reading back alpha values...
    By pixelate in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 02-01-2005, 05:21 PM
  4. Reading buffer values in fragment shader
    By MButchers in forum OpenGL: GLSL
    Replies: 2
    Last Post: 01-14-2005, 11:37 AM
  5. Error Reading File BMP File Size ?
    By Olumide in forum OpenGL: Advanced Coding
    Replies: 13
    Last Post: 01-31-2002, 10:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean