Matrix help please
Monkey Forums/Monkey Programming/Matrix help please
| ||
Im trying to change the bouncyaliens demo so that all the aliens are simply rotated 90 degrees to the right, but are in the same position on the screen as they are supposed to be this is my rendering code: PushMatrix Scale DeviceWidth/WIDTH,DeviceHeight/HEIGHT For Local sprite:=Eachin sprites Translate sprite.x,sprite.y Rotate(90) DrawImage image,0,0,sprite.f Next PopMatrix but the aliens dont behave as they did before my changes |
| ||
You need to do a PushMatrix/PopMatrix around each sprite.PushMatrix Scale DeviceWidth/WIDTH,DeviceHeight/HEIGHT For Local sprite:=Eachin sprites PushMatrix Translate sprite.x,sprite.y Rotate(90) DrawImage image,0,0,sprite.f PopMatrix Next PopMatrix |
| ||
In addition to Warpy, use also Rotate before Translate. |
| ||
no, that isn't what he wants to do |
| ||
thanks BTW the matrix thingy is a bit confusing, Im used to OpenGL where you do the identity matrix to reset everything is this right? -There is a stack of matrices -The one on the top is used to affect drawing of images -when you pop a matrix off you get a blank matrix (identity) if there are no other matrices on the stack, -if you pushed one on the stack you get the next matrix when you pop one off please tell me which ones are wrong |
| ||
That's right. |
| ||
wha? that was a just guess - lol Also it seems you have to push a matrix onto an empty stack or you get a crash when you try to draw something (at least with HTML5) |
| ||
That shouldn't happen. Do you mean, if you pop the first matrix off the stack? |
| ||
yes EDIT - Hmm I think the crash may have occured when I used pop on an empty stack I like to test the limits of things before I use them properly |