Anyone able to help me out with textures here?
I'm trying to put a texture onto an OpenGL object. Here's what I'm doing.
This is from where I'm setting everything up:
And here's from where I'm drawing it each time:
Before I did this I had a black circle but now I am not seeing anything. I know it's there because the collision is still being fired but I'm not seeing anything. It's invisible. Thanks to anyone who can help me here. If anyone has aim you can get ahold of me as well ICDBuschmaster on there. buschmaster@gmail.com on Google Chat. That might be able to help me more.
I'm trying to put a texture onto an OpenGL object. Here's what I'm doing.
This is from where I'm setting everything up:
Code:
glShadeModel(GL_SMOOTH);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glGenTextures(1, &texture[0]);
glBindTexture(GL_TEXTURE_2D, texture[0]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
NSString *path = [[NSBundle mainBundle] pathForResource:@"ball2" ofType:@"pvr4"];
NSData *texData = [[NSData alloc] initWithContentsOfFile:path];
// Instead of glTexImage2D, we have to use glCompressedTexImage2D
glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG, 256.0, 256.0, 0, (256.0 * 256.0) / 2, [texData bytes]);
[texData release];
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
// Enable blending
glEnable(GL_BLEND);
And here's from where I'm drawing it each time:
Code:
glLoadIdentity();
glEnable(GL_TEXTURE_2D);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glVertexPointer(2, GL_FLOAT, 0, circleVAR);
glTexCoordPointer(2, GL_FLOAT, 0, spriteTexcoords);
glDrawArrays(GL_TRIANGLE_FAN, 0, circleVAR_count - 1);
Before I did this I had a black circle but now I am not seeing anything. I know it's there because the collision is still being fired but I'm not seeing anything. It's invisible. Thanks to anyone who can help me here. If anyone has aim you can get ahold of me as well ICDBuschmaster on there. buschmaster@gmail.com on Google Chat. That might be able to help me more.