Hey folks i have little problem!
Maybe someone has a solution for this.
I have a normal Jogl program which rotates two triangles.
(Sourcecode listed down there)
The problem is that the memory the programm is using slowly increases its value (shown in the windows task-Manager)
Started at 27Mb and after 10 minutes it reaches 80Mb. Any idea?
I have the newest jogl version.
Sorry for that english
import java.awt.*;
import java.awt.event.*;
import net.java.games.jogl.*;
public class AnimJOGLApp
{
static Animator animator;
public static void main(String[] args)
{
Frame frame = new Frame("AnimJOGLApp");
//Animator für Bewegung
//GLCanvas für Anzeige
GLCanvas canvas = GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities());
canvas.addGLEventListener(new AnimGLEventListener());
frame.add(canvas);
//Animator mit Zeichenfläche initialisieren
animator = new Animator(canvas);
frame.setSize( 400,
400);
frame.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
animator.stop();
System.exit(0);
}
});
frame.setVisible(true);
//Animation starten
animator.start();
}
}
import net.java.games.jogl.*;
public class AnimGLEventListener implements GLEventListener
{
float tri = 0.0f;
public void init(GLDrawable drawable)
{
}
public void display(GLDrawable drawable)
{
GL gl = drawable.getGL();
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
gl.glLoadIdentity();
gl.glTranslatef(-0.4f,0.0f,0.0f);
gl.glRotatef(tri,0.0f,1.0f,0.0f);
gl.glBegin(GL.GL_TRIANGLE_FAN);
gl.glColor3f(1.0f,0.0f,0.0f);
gl.glVertex3f(-0.2f,0.0f,0.0f);
gl.glColor3f(0.0f,1.0f,0.0f);
gl.glVertex3f(0.2f,0.0f,0.0f);
gl.glColor3f(0.0f,0.0f,1.0f);
gl.glVertex3f(0.0f,0.6f,0.0f);
gl.glEnd();
gl.glLoadIdentity();
gl.glTranslatef(0.4f,0.0f,0.0f);
gl.glRotatef(tri,1.0f,0.0f,0.0f);
gl.glBegin(GL.GL_TRIANGLE_FAN);
gl.glColor3f(1.0f,0.0f,0.0f);
gl.glVertex3f(-0.2f,0.0f,0.0f);
gl.glColor3f(0.0f,1.0f,0.0f);
gl.glVertex3f(0.2f,0.0f,0.0f);
gl.glColor3f(0.0f,0.0f,1.0f);
gl.glVertex3f(0.0f,0.6f,0.0f);
gl.glEnd();
if(tri < 360.f)
tri += 0.5f;
else
tri = 0.0f;
}
public void reshape(GLDrawable drawable, int x, int y, int width, int height)
{
}
public void displayChanged(GLDrawable drawable, boolean modeChanged, boolean deviceChanged)
{
}
}