Sprite white out
Hi all,
This seems to have been asked before. But I need a method for Opengl iphone 1.1 i.e. works on a 3g.
I simply wish to draw any sprite with a complete white frame. I haven't got the ram to store every possible animated frame in white aswell.
My only current (and rubbish!) solution is to draw the sprite I require white multiple times with glBlendFunc( GL_SRC_ALPHA, GL_ONE );
Yeah, I know!. But it works!!! :-)
I *assume* there's a much better (more efficient) way to simply draw a white frame rather than multiple draws.
Cheers
This seems to have been asked before. But I need a method for Opengl iphone 1.1 i.e. works on a 3g.
I simply wish to draw any sprite with a complete white frame. I haven't got the ram to store every possible animated frame in white aswell.
My only current (and rubbish!) solution is to draw the sprite I require white multiple times with glBlendFunc( GL_SRC_ALPHA, GL_ONE );
Yeah, I know!. But it works!!! :-)
I *assume* there's a much better (more efficient) way to simply draw a white frame rather than multiple draws.
Cheers
use texture combiners to combine the constant color (1, 1, 1, 1) with the alpha from your sprite?
Hi OSC,
I kind of read about this method, but never found any code example or can be certain it's opengl 1.1 viable.....
Cheers
I kind of read about this method, but never found any code example or can be certain it's opengl 1.1 viable.....
Cheers
It works fine with OpenGL 1.1. Texture combiners are generally a giant pain to set up. Though if all you want to do is output a constant color that is probably not so bad. Maybe only like 10 lines of code? I don't really remember.
Normally you would use GL_MODULATE as your texture ENV mode which multiplies the vertex color against the texture color. You could use GL_ADD instead, but this would only work with specifically 100% white. You wouldn't be able to flash it any other color.
This is an OK article on texture combiners. You would only need to read like the first 1/4 of it maybe.
http://iphone-3d-programming.labs.oreilly.com/ch08.html
Normally you would use GL_MODULATE as your texture ENV mode which multiplies the vertex color against the texture color. You could use GL_ADD instead, but this would only work with specifically 100% white. You wouldn't be able to flash it any other color.
This is an OK article on texture combiners. You would only need to read like the first 1/4 of it maybe.
http://iphone-3d-programming.labs.oreilly.com/ch08.html
Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
assuming (SRC_ALPHA, ONE_MINUS_SRC_ALPHA) blending, something like
Code:
// switch to texture combiner mode
glTexEnvi(GL_TEXTURE_2D, GL_TEXTURE_ENV_MODE, GL_COMBINE);
// calculate color by REPLACE-ing with the CONSTANT TEXTURE_ENV_COLOR
glTexEnvi(GL_TEXTURE_2D, GL_TEXTURE_ENV_COLOR, (GLfloat[]){ 1, 1, 1, 1 });
glTexEnvi(GL_TEXTURE_2D, GL_COMBINE_RGB, GL_REPLACE);
glTexEnvi(GL_TEXTURE_2D, GL_SRC0_RGB, GL_CONSTANT);
glTexEnvi(GL_TEXTURE_2D, GL_OPERAND0_RGB, GL_SRC_COLOR);
// calculate alpha by REPLACE-ing with the alpha from the TEXTURE
glTexEnvi(GL_TEXTURE_2D, GL_COMBINE_ALPHA, GL_REPLACE);
glTexEnvi(GL_TEXTURE_2D, GL_SRC0_ALPHA, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_2D, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
Thanks guys,
I tried OSC snippet; and notice no difference. Is there anything else I need to set?
Currently 'playing' with it :-)
Cheers
I tried OSC snippet; and notice no difference. Is there anything else I need to set?
Currently 'playing' with it :-)
Cheers
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| OpenGL ES Textures Start White | demonpants | 5 | 5,994 |
Sep 3, 2009 06:40 AM Last Post: Skorche |
|
| xcode NO COLOR (black & white !) | imaumac | 3 | 3,503 |
Jan 14, 2009 10:10 PM Last Post: longjumper |
|

