tiagoantunes

12-01-2008, 07:24 AM

Hi,

How can i rotate a single area in opengl? tks

How can i rotate a single area in opengl? tks

View Full Version : Rotate specific area

tiagoantunes

12-01-2008, 07:24 AM

Hi,

How can i rotate a single area in opengl? tks

How can i rotate a single area in opengl? tks

ZbuffeR

12-01-2008, 08:19 AM

Define "area" : image, portion of screen, object(s), ... ?

tiagoantunes

12-01-2008, 08:21 AM

i have a polygon consisting of several polygons, and I want to rotate one of these polygons. I think i have to use glLoadMatrix but im not sure/dont know how

thanks in advance

thanks in advance

_NK47

12-01-2008, 08:24 AM

matrix it is. glLoadMatrix specifies current matrix in current matrix stack f.e glMatrixMode(GL_MODELVIEW). whatever value you put in there your vertices will be "transformed" by this matrix. if you need to rotate objects you need to upload a rotation matrix then. also check glRotate().

tiagoantunes

12-01-2008, 08:28 AM

but how do I define this matrix to put in the glLoadMatrix ? I have a 6 vertice polygon that I want rotated, I know the world coordinates of its vertices and I was successful on rotating the entire polygon, but rotating this single polygon I cant do

_NK47

12-01-2008, 08:30 AM

this is advanced because you either need your own matrix class which performs matrix operations and stores the output in say GLfloat[16] array so you can just pass it to glLoadMatrix, but for writing a matrix class you need excellent math knowledge or you can reuse some matrix classes. there are plenty of them in open source 3d engines.

V-man

12-01-2008, 11:26 AM

Why do you want to use glLoadMatrix?

It would go something like this without glLoadMatrix

glPushMatrix();

glTranslatef(x, y, z);

RenderSomeThings();

glPushMatrix();

glRotatef(45.0, 0.0, 1.0, 0.0);

RenderMyArea();

glPopMatrix(); //Restore matrix

glPopMatrix(); //Restore matrix

I recommend the Red book. It explains the fundamentals of GL.

It would go something like this without glLoadMatrix

glPushMatrix();

glTranslatef(x, y, z);

RenderSomeThings();

glPushMatrix();

glRotatef(45.0, 0.0, 1.0, 0.0);

RenderMyArea();

glPopMatrix(); //Restore matrix

glPopMatrix(); //Restore matrix

I recommend the Red book. It explains the fundamentals of GL.

Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.