![]() |
|
Sprite white out - Printable Version +- iDevGames Forums (http://www.idevgames.com/forums) +-- Forum: Development Zone (/forum-3.html) +--- Forum: iPhone, iPad & iPod Game Development (/forum-11.html) +--- Thread: Sprite white out (/thread-9010.html) |
Sprite white out - markhula - May 29, 2011 06:25 AM 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 RE: Sprite white out - OneSadCookie - May 29, 2011 08:06 AM use texture combiners to combine the constant color (1, 1, 1, 1) with the alpha from your sprite? RE: Sprite white out - markhula - May 29, 2011 08:55 AM 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 RE: Sprite white out - Skorche - May 29, 2011 09:53 AM 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 RE: Sprite white out - OneSadCookie - May 29, 2011 10:05 AM assuming (SRC_ALPHA, ONE_MINUS_SRC_ALPHA) blending, something like Code: // switch to texture combiner modeRE: Sprite white out - markhula - May 29, 2011 11:47 AM Thanks guys, I tried OSC snippet; and notice no difference. Is there anything else I need to set? Currently 'playing' with it :-) Cheers |