Re: jogl 2
Posted by Xerxes Rånby on May 24, 2012; 10:23am
URL: https://forum.jogamp.org/jogl-2-tp4013001p4013274.html
2012-05-24 10:56, sindroide [via jogamp] skrev:
> jButton1.setText("Rotate");
> jButton1.addActionListener(new java.awt.event.ActionListener() {
> public void actionPerformed(java.awt.event.ActionEvent evt) {
> for(int i=1; i<361; i++) {
> rot+=1;
> }
>
You bug is in your actionPerformed.
This code will increase rot with 360 for each click of the button:
rot=360.0
rot=720.0
rot=1080.0
rot=1440.0
rot=1800.0
... etc
Replace this part with:
public void actionPerformed(java.awt.event.ActionEvent evt) {
rot+=.2%360;
}
and you will get what you want:
rot=0.2
rot=0.4
rot=0.6000000000000001
rot=0.8
rot=1.0
rot=1.2
rot=1.4
...
Cheers
Xerxes