[OPENGL] My RAW file turns to mush as a texture?

Started by
1 comment, last by gimp 23 years, 2 months ago
Here is some code I''m using to load my raw file:
  
		SetBitDepth(24);
		SetWidth(256);
		SetHeight(256);
		SetAlphaDepth(0);
		Data.resize(DefaultFontSize * (GetBitDepth()/8));

		for (unsigned long i=0; i<DefaultFontSize; i++)
		{
			Data[i] = DefaultFont[i];
			Data[i+1] = DefaultFont[i];
			Data[i+2] = DefaultFont[i];
		}
  
DefaultFont has the raw file information in it. The data is a 256*256*8bit image. I''m loading it to a 24 bit image just for simplicity. This ''setup'' of the texture information is pretty much mirroring my bmp loader except that the bmp loader flips the image once loaded. Is there something about the raw file format that I''m not aware of? byte ordering etc? The image appears to be like static, not upside down or back to front... Many thanks Chris
Chris Brodie
Advertisement
There is no ordering in a raw file. You do what ever the hell you want that is why you shouldn''t use them unless you made them. The bitmap loader you copied from is for loading a 24 bpp bitmap. You are loading a 8 bpp image. Is all the pixel data for your raw image packed into one byte 3 red, 3 green, 2 blue? Is it using a lookup table? That is the problem with raw files. You just don''t know.

The fanatic is incorruptible: if he kills for an idea, he can just as well get himself killed for one; in either case, tyrant or martyr, he is a monster.
--EM Cioran

Opere Citato
"... we should have such an empire for liberty as she has never surveyed since the creation ..."Thomas Jefferson
for (unsigned long i=0; i = DefaultFont; Data[i+1] = DefaultFont; Data[i+2] = DefaultFont; } <br><br>shouldnt that be someit like<br>Data[ i*3 +0 ] Data[ i*3 +1 ] Data[ i*3 +2 ] </i> <br><br>http://members.xoom.com/myBollux

This topic is closed to new replies.

Advertisement