OpenGL glScalef
I'm trying to scale down a quad (assume lower left is at origin and it's a 10x10 square). I'm using GL_TRIANGLE_STRIP with 4 vertices to render it. Using glScalef will shrink/grow it relative to the origin since that's the lower left corner. If I want to have the quad shrink grow based on the exact center of that quad, what approach would I take?
Note: I'm using a glOrthof projection instead of glFrustrum.
Also, is this the right forum to ask OpenGL ES graphics questions?
Note: I'm using a glOrthof projection instead of glFrustrum.
Also, is this the right forum to ask OpenGL ES graphics questions?
Asking Open GL ES questions here is fine.
Your quad is actually growing and shrinking relative to the origin (0, 0, 0). If your quad is growing and shrinking relative to its bottom left corner then that would suggest the lower left corner happens to be on the origin. If you were to move the vertices so that they were spread equally around the origin this should fix your problem.
Hopefully that should be clear enough. I would emphasise that you really need to understand how transforms work before you proceed any further.
Your quad is actually growing and shrinking relative to the origin (0, 0, 0). If your quad is growing and shrinking relative to its bottom left corner then that would suggest the lower left corner happens to be on the origin. If you were to move the vertices so that they were spread equally around the origin this should fix your problem.
Code:
top right = 1.0, 1.0
top left = -1.0, 1.0
bottom left = -1.0, -1.0
bottom right = 1.0, -1.0
If moving your actual vertex coordinates is inconvenient, you can always translate before (or after) scaling.
backslash, your suggestion worked. Also, I'll review transforms.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| problems with glScalef() | ghettotek | 3 | 4,173 |
Feb 11, 2003 02:50 AM Last Post: kelvin |
|

