• Create Account

### #ActualJevi

Posted 25 October 2012 - 08:18 PM

I got it I forgot the all this is done slightly backwards so here is the working code if anyone wants to know

So I translate to the startx, starty then i rotate around it, I translate to -startx, -starty ( all that is done is g.rotate(..) ) then I translate to the current x,y coordinates of the object. As you can see in the following code those steps are implemented backwards in the code but are interpreted in the correct order by OGL. a little confusing but its not that bad . Thanks for all the help guys!!

@Override
public void render(Graphics g)
{
glPushMatrix();
glBegin(GL_POINTS);
glVertex2f(x, y);
glEnd();
glTranslatef(x - startx, y - starty, 0);
g.rotate(startx, starty, angle);
g.drawLines();
glPopMatrix();
}


### #3Jevi

Posted 25 October 2012 - 08:17 PM

I got it I forgot the all this is done slightly backwards so here is the working code if anyone wants to know

So I translate to the startx, starty then i rotate around it, I translate to -startx, -starty ( all that is done is g.rotate(..) ) then I translate to the current x,y coordinates of the object. As you can see in the following code those steps are implemented backwards in the code but are interpreted in the correct order by OGL. a little confusing but its not that bad . Thanks for all the help guys!!

@Override
public void render(Graphics g)
{
glPushMatrix();
glBegin(GL_POINTS);
glVertex2f(x, y);
glEnd();
glTranslatef(x - startx, y - starty, 0);
g.rotate(startx, starty, angle);
g.drawLines();
glPopMatrix();
}


### #2Jevi

Posted 25 October 2012 - 08:16 PM

I got it I forgot the all this is done slightly backwards so here is the working code if anyone wants to know

So I translate to the startx, starty then i rotate around it, I translate to -startx, -starty ( all that is done is g.rotate(..) ) then I translate to the current x,y coordinates of the object. As you can see in the following code those steps are implemented backwards in the code but are interpreted in the correct order by OGL. a little confusing but its not that bad

@Override
public void render(Graphics g)
{
glPushMatrix();
glBegin(GL_POINTS);
glVertex2f(x, y);
glEnd();
glTranslatef(x - startx, y - starty, 0);
g.rotate(startx, starty, angle);
g.drawLines();
glPopMatrix();
}


### #1Jevi

Posted 25 October 2012 - 08:14 PM

I got it I forgot the all this is done slightly backwards so here is the working code if anyone wants to know

@Override
public void render(Graphics g)
{