type_r503
2002.05.20, 02:24 PM
Hi all,
I seem to think there was a previous thread explaining this but I can't find it. I was wondering what the code was for creating a texture from an NSBitmapimageRep. What I have is
image = [NSBitmapImageRep imageRepWithContentsOfFile: [motionArray objectAtIndex:z]];
//bind data to texture
if(!image)
exit(20);
//create the texture
glGenTextures(1, &spriteData[x-1][y-1][z-1]);
//genreate texture with bitmap data
glBindTexture(GL_TEXTURE_2D, temp);
//generate the texture
glTexImage2D(GL_TEXTURE_2D, 0, 4,
[image pixelsWide], [image pixelsHigh],0,
GL_RGBA, [image bitsPerSample], [image bitmapData]);
thanks dudes.
I seem to think there was a previous thread explaining this but I can't find it. I was wondering what the code was for creating a texture from an NSBitmapimageRep. What I have is
image = [NSBitmapImageRep imageRepWithContentsOfFile: [motionArray objectAtIndex:z]];
//bind data to texture
if(!image)
exit(20);
//create the texture
glGenTextures(1, &spriteData[x-1][y-1][z-1]);
//genreate texture with bitmap data
glBindTexture(GL_TEXTURE_2D, temp);
//generate the texture
glTexImage2D(GL_TEXTURE_2D, 0, 4,
[image pixelsWide], [image pixelsHigh],0,
GL_RGBA, [image bitsPerSample], [image bitmapData]);
thanks dudes.