Hi all,
(Mac OS X, Cocoa, C/C++, OpenGL, somewhat mathematically challenged.)
Project is a real-time (30fps) poker game, with a 2D view. The OpenGL view is set up for Orthographic projection using glOrtho; the camera is always looking directly down at the cards/table. To date, it's essentially been a 2D image composition engine.
My playing cards are pre-built textures (with alpha), rendered thusly:
glBegin(GL_TRIANGLE_STRIP);
glTexCoord2f(0.0, 0.0);
glVertex3d(startDraw_X, startDraw_Y, 0.0);
glTexCoord2f(1.0, 0.0);
glVertex3d(endDraw_X, startDraw_Y, 0.0);
glTexCoord2f(0.0, 1.0);
glVertex3d(startDraw_X, endDraw_Y, 0.0);
glTexCoord2f(1.0, 1.0);
glVertex3d (endDraw_X, endDraw_Y, 0.0);
glEnd();
This works well, and provides 1:1 pixel mapping, for high image quality.
QUESTION: how can I (cheaply, quickly) "flip" or distort my card using OpenGL? The rotation part isn't hard, but I'm having trouble with the perspective aspect.
Specifically, I have in mind the horizontal flipping action of UIViews in iPhone applications (e.g. Music). The UIView will appear to flip by shrinking horizontally, with the appearance of perspective (the "rear" coordinates of the view will shrink vertically.)
Thanks for any help or tips.