Thank you, but I think I`ll stick to Alex's version until I get a better understanding of GL and game programming. This is my first Python and game programming project. If anyone is interested, here are teh sources for what I have done so far: http://www.nyuu.ro/misc/Zelda-test02.zip (ignore the frozen application, that's for a few friends)
On Feb 4, 12:28 am, "Txema Vicente" <[EMAIL PROTECTED]> wrote: > Doing that kind of transformations is not the same thing as inverting the > texture, as Alex told you. > Inverting the texture, you will have an inverted texture forever, that you > can use as any image. > > Sure that is easier, I should not tell you about transformations. Do it with > textures. > > I didn't think it. Big mouth. But, as I did throw the snowball, I will give > you a clue. > > If you want to play with opengl transformations, note that you are not > transforming the image at all, you are transforming the entire view. Each > time you want to see a flipped image, you have to modify the view. You can > have a different view for each image. Endless possibilities, more > complexity. > > First thing is that when you rotate or scale the view, you have to know > where the origin is (0,0). If you did not move it (or after calling > glLoadIdentity()), it is at bottom left corner. If you scale the view -1 at > x, now when you blit the image at (x,y) it will be flipped but blitted > outside your monitor, mirrored at -x. > > If now you are doing: > img.blit (x,y,0) > > You could do this to see the same results: > glLoadIdentity() # to ensure initial view > glTranslatef(x,y,0) # put the origin here (view in modified) > img.blit(0,0,0) > > The same thing, more elegant: > glPushMatrix() # get a new copy of the view > glTranslatef(x,y,0) > img.blit(0,0,0) > glPopMatrix() # restore the original view > > and this to see the flipped image: > glPushMatrix() > glTranslatef(x,y,0) > glScalef(-1,1,1) # or glRotate(180,0,1,0) > img.blit(0,0,0) # or img.blit(img.width,0,0), to get the > same position. > glPopMatrix() > > The origin is the key here, and you better translate it to the center or the > image (play with half image sizes, translate to x+width/2, y+height/2, then > scale or rotate and finally blit at (-width/2, -height/2,0)). > > You can survive knowing only about glLoadIdentity, glTranslatef, glScalef > and glRotatef. > Lots of tutorials out there. Good luck. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pyglet-users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pyglet-users?hl=en -~----------~----~----~----~------~----~------~--~---
