PDA

View Full Version : About the AUX_RGBImageRec structure



El_Segador
07-08-2003, 11:03 PM
Hi! Everyone!
How are you? I hope you are ok, because ill people rest, and if they rest they can't help, wow!
Well...Sorry...
I got a question about the structure called AUX_RGBImageRec. I use it to load a BMP picture in my program.
Well, I know that in this structure there is the x size, the y size and the data.
"Well what is your question young knight?"
"Well, my Lord...What the data field contain?"
In this field we can read the data of the bmp picture(I mean the color of each pixel) or also the file header and info header? Or nothing of all this?
Thank you for your answer.

Deiussum
07-09-2003, 04:18 AM
The data field will contain an unsigned char array of RGB data. For example pixel 1's RGB components will be data[0], data[1], data[2], for pixel 2 the RGB data is data[3], data[4], data[5], etc.

You should also probably be aware that glaux is kind of an outdated API and people generally advise to avoid it for various reasons. Although, for quick and dirty little demos, I've used still it myself for BMP loading from time to time.

[This message has been edited by Deiussum (edited 07-09-2003).]

El_Segador
07-09-2003, 03:36 PM
Is there another way to load Bmp, without using glaux' AUX_RGBImageRec structure?
Or may be this structure exist in glut or other librairies...
Else, your answer help me a lot thanks really.

[This message has been edited by El_Segador (edited 07-09-2003).]

Deiussum
07-10-2003, 04:18 AM
I like using my own image loading routines. Actually, I tend to prefer TGA over BMP, too. With TGA you can also include an alpha channel. If you search the forum, you'll find code for loading each of these formats. Nehe's also gives code for loading a TGA. There are a number of other image loading libraries as well, which I haven't really used much myself. Libraries like DevIL, glBmp, and SDL_image have image loading routines for various formats.

Some of the main problems with glaux is not only that it's outdated, but it is not well supported, even under Windows. VC++ comes with a glaux library, but it's usually harder to get something using glaux to compile with Borland, or some of the various GNU tools for Windows. And so far as I know it doesn't exist at all for platforms other than Windows.

This is one of those things that you'd think glut would have provided, but it doesn't, and I don't think any further development is being done on it anymore, so it's not likely to ever contain image loading functions.

[This message has been edited by Deiussum (edited 07-10-2003).]

El_Segador
07-13-2003, 05:05 PM
I got another question about the data field.
Well you know that when you read a bmp with a hexadecimal text you can see the info header file header and the value for each pixel. Well in the part of the data (the color of each pixel), the pixel are classify by the end, I mean, when you begin to read the information about the "first" pixel in the bmp file in fact you read the info of the last pixel of the picture, hum...Am I clear enough?
Well my question is, in the data field of the AUX_RGBImageRec structure, are the pixel classify in the same way? So when I read data[0]data[1] and data[2], do I read the info of the true first pixel of the picture, or the last?
Thanks to try to understand me lol, and thnaks to give me an asnwer.

Edito: sorry Deiussum I didn't see you reply. Well it's interesting, I saw the Nehe tutorial about loading different format. For the moment, the picture loading is not my priority so I will let this. I will look for a more usefull routine otherwise.

[This message has been edited by El_Segador (edited 07-13-2003).]

Deiussum
07-14-2003, 09:59 AM
Sorry I haven't responded sooner. Been away on vacation for a few days.

I think that the pixel data is stored in the same order that it's stored in the BMP file itself, but I'm not positive about this. Best thing to do would be to make a BMP where you know what the first and last pixels would be, and then read it in and see you get. http://www.opengl.org/discussion_boards/ubb/smile.gif

El_Segador
07-14-2003, 05:17 PM
Yeah it's a good idea I will try to do it.
Don't excuse yourself to be in holidays, enjoy!

El_Segador
07-15-2003, 11:49 PM
So I try to see where was the beginning and the and and I conclude this: the data array is symetric vertically at the bmp hexa file.
I mean when you edit a bmp with an hexadecimal editor and began to read the pixel value, you begin by the last pixel(the right bottom) and finish by the first(the left uppon) ok?
Well in the data array, the first pixel of this array seems to be the left bottom and the last the right uppon...
But I wonder if it's really important. In fact I load my picture and copy it to a structure that generate the data array ok? Well then when I recreate my data array and generate my bmp, I guess I should not care about the order (like I did'nt care during the loading...)
So i did another test and in fact, in the way I use the array I don't care about the order as I write the picture in the same I read it so...
If the information above is useful for someone it's cool, otherwise this topic its useless now...
Sorry to disturb you with my stories...

[This message has been edited by El_Segador (edited 07-16-2003).]