Texture loading code check.
Here is some code I am using to load RGB data into an array of GLubytes and I was just wondering if there were any problems with it
I think that's about all of the relevant code for this particular function
the textures are 256x256 pixels in size, all I want to know is "will this load the image data into the textures properly?"
Code:
// in HeightMapView.h
GLubyte lowestTexture [3] [256] [256];
GLubyte lowTexture [3] [256] [256];
GLubyte highTexture [3] [256] [256];
GLubyte highestTexture [3] [256] [256];
//in HeightMapView.m
-(void) loadAltitudePictureLowest: (NSString *) lowestName low: (NSString *) lowName high: (NSString *) highName highest: (NSString *) highestName
{
NSBitmapImageRep *bitmap;
NSImage *image;
long i;
long j;
int bitmapSize;
image = [ NSImage imageNamed: lowestName];
bitmap = [[NSBitmapImageRep alloc]initWithData: [ image TIFFRepresentation]];
bitmapSize = [bitmap size].width;
if (bitmap == nil)
{ NSLog(@"lowestTexture: not loaded!"); return;}
for (i = 0; i < bitmapSize; i++)
{
for( j = 0; j < bitmapSize; j++)
{
lowestTexture[0] [i] [j] = (GLubyte) ([bitmap bitmapData][(i+(j*bitmapSize))*24/8]);
lowestTexture[1] [i] [j] = (GLubyte) ([bitmap bitmapData][(i+(j*bitmapSize))*24/8+1]);
lowestTexture[2] [i] [j] = (GLubyte) ([bitmap bitmapData][(i+(j*bitmapSize))*24/8+2]);
}
}I think that's about all of the relevant code for this particular function
the textures are 256x256 pixels in size, all I want to know is "will this load the image data into the textures properly?"
-CarbonX
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Howto check whether Ipod is playing music | Bersaelor | 2 | 3,626 |
Jan 2, 2010 09:54 AM Last Post: Bersaelor |
|
| iPhone texture loading issue | yotryu | 0 | 3,121 |
Mar 11, 2009 03:40 AM Last Post: yotryu |
|
| Texture Mapping: Loading a texture from a .bmp file? | ishrock | 5 | 5,002 |
Dec 13, 2008 09:27 AM Last Post: ThemsAllTook |
|
| OpenGL Texture Loading & Sprites | corporatenewt | 2 | 10,597 |
Jan 30, 2008 12:39 PM Last Post: ynda20 |
|
| Texture Loading in Cocoa... | dave05 | 3 | 7,666 |
Dec 11, 2007 03:12 AM Last Post: DoG |
|

