Waaaaaw! Thank you very much, bobjob. I really appreciate your kind help and explanations!
I've just gone through your FBO demo and I understand what happens, thank you.
1. Load all Main textures, keep a copy of them all unchanged.
Which textures precisely? The main scene and/or ... ?
2. generate 2 FBO's with a new texture wrapped to each one, ill attach another example, but i think its best to understand the tutorial as well as go through the lwjgl version of it (the link from before).
Do you mean empty texture when saying new texture?
3. before starting draw the main scene texture onto both of the FBOs (as these are the textures that will be manipulated during runtime).
We'll "edit" only one of the 2 FBOs, right?
4. When manipulating the scene (again this wont make much sence till you go through the tutorial):
you would bind the first FBO.
a. "Cut out" Images would be drawn before the main scene, at a z = 1 (therefore closer to the viewer) with the color mask set to false.
b. the second FBO texture (copy of the scene) would be drawn at z = 0.
c. "stairs" would be drawn after the scene but still with a z = 1 (same 'z' as "cut out" images).
a. Do you mean :
#1 : drawing on a single QUAD (altering a single texture during runtime)
or
#2 : using several QUADS with different textures for each imprint/impact (added one after the other)
I'd prefer method #1 since method #2 requires a lot of processing for almost nothing (storing every imprint...), doesn't it? What would you advise me to do?
Same remarks and questions go for point (b)
#1 : drawing on a single QUAD (altering a single texture during runtime)
or
#2 : using several QUADS with different textures for step of the stears (added one after the other)
then you would draw the first FBO onto the second. (this is done because if you draw the scene onto the new scene, Im guessing there will be errors, its good to have the "temp" copy refering to step (b)).
I can't understand yet why it's necessary drawing the 1st FBO on the second FBO (=unchanged scene texture). Maybe I'll realize later what would happen without using the 2nd FBO. Maybe you mean making FBO#2 an exact copy of FBO#1. I'm not sure I understand what you really mean here.
Note: The way the stairs are drawn can be different, you could disable depthTesting, and not worry about its z value, but it might be confusing tryn to track weather on not depth testing is currently enabled, so I suggest just do it the way i explained for starters, you can always tweek the code later.
OK
As for collision detection, Im guessing that will be per pixel, so you would need to get the value of each indivual pixel you want to test at a time, and check if its alpha value is = 0, or if you want you could make it if alpha < 0.25f (as that should be close enough). The 0.25f would also look cool, cuz you could have them going through semi-transperant tunnels and not getting blocked
For collision detection and so on, I think I should use a 2-dimensions array as told earlier because each pixel has several properties (not only transparent or not, but also destructible or not, maybe destructible in only one direction (left to right, right to left, from top to bottom, and so on) maybe a terrain area on which lemmings drop through, ....). Handling collision using alpha values is not enough, so I have to handle collision in a separate array, regardless of graphics. However using alpha values like 0.25f for tunnels is a great idea, thank you!
You have actually tempted me to make my own online turn bassed Worms game, as a side project.
Great!!!
I do think the use of FBO is a really good idea since it would also allow me to upscale/downscale a level depending on display resolution without having to worry about resolution when drawing the scene with lemmings, handling collision detection and so on. To do this I'd also have to draw the other sprites into the FBO? What do you think about this feature?
Thank you very much Bobjob. You're an excellent teacher