Hi
I do:
for x < 128
for z < 128
returns a height map (y).
now I'd want to rotate (opengl glpoints glvertex2f) that with a given angle around the centre.
Any ideas/help?
Many thanks
Michael
2D mesh rotation
Started by mike4, Feb 25 2012 06:49 AM
1 reply to this topic
Ad:
#2 Members - Reputation: 296
Posted 27 February 2012 - 10:39 AM
Hi!
Build the mesh exactly the way you have, but before the rendering of the mesh do:
Move the center of height map to (0,0,0).
Okay… and since we are in OpenGL land, you actually have to do it in the reverse order.
(The matrices are pushed on a stack. What came last is executed first.)
Cheers!
Build the mesh exactly the way you have, but before the rendering of the mesh do:
Move the center of height map to (0,0,0).
glTranslatef(-64, 0, -64);Rotate around the y-axis.
glRotatef(angleInDegree, 0,1,0);Move back to the original position.
glTranslate(64, 0, 64);
Okay… and since we are in OpenGL land, you actually have to do it in the reverse order.
glTranslate(64, 0, 64); glRotatef(angleInDegree, 0,1,0); glTranslatef(-64, 0, -64);
(The matrices are pushed on a stack. What came last is executed first.)
Cheers!
Acagamics e.V. – IGDA Student Game Development Club (University of Magdeburg, Germany)


















