My LWJGL Application is frozen at random .

Started by opendv, February 19, 2009, 08:22:15

Previous topic - Next topic

opendv

Hi, First I'm not american so I don't speak english well.
I'll thank if you try to understand me.


  I wrote basic code to init application and draw model.(like some example)
then I added my code and tested frequantly. Commonly, my program is run without any problem.
but I found that my application window was frozen at random after unknown time since it was run.
(one time, program is run well for 1 hours but other time program was frozen at random.)
I tried to find the reason but I didn't because always application was run in same condition.
so I examined my code but it is so simple code that the cause couldn't be it.
my program just include init program and draw simple model code. it doesn't have any loop sentence like 'infinity for' or 'while' except paint loop.
but applecation was frozen like thread is fallen infinity loop.(no response window)

I tried to solve this problem as this way.

first, I run my application and I didn't give any input.
shockingly application was frozen at random too.(application code just draw model without any other work.)

second,
when my program is frozen, I set break point in paint loop (paintGL()) as using eclipse.
but break point wasn't caught. namely, application thread was stopped or fallen infinity loop in other class,not my class.

I'm confused due to this problem. I'm worry about using LWJGL constantly.
perhaps, if you had ever had this problem like me and solved, help me please.

this is my code. if my code has any problem, advise me please. thanks.

TestView() throws LWJGLException, IOException
{
initGL();
while(!Display.isCloseRequested()){
paintGL();
}
Display.destroy();
}

private void paintGL()
{
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
GL11.glLoadIdentity();
GL11.glTranslatef(0, 0, -20f);
GL11.glBegin(GL11.GL_TRIANGLES);
GL11.glVertex3f(-10, 0, 0);
GL11.glVertex3f(0,10, 0);
GL11.glVertex3f(10, 0, 0);
GL11.glEnd();
Display.sync(60);
Display.update();
}

private void initGL(String name[]) throws LWJGLException, IOException
{
Display.setDisplayMode(new DisplayMode(640,480));
Display.create();
FloatBuffer ambientLight = FloatBuffer.wrap(new float[]{0f,0f,0f,0.0f});
FloatBuffer diffuseLight = FloatBuffer.wrap(new float[]{1f,1f,1f,1.0f});
FloatBuffer lightPos = FloatBuffer.wrap(new float[]{-30f,30f,-30f,1.0f});
FloatBuffer specular = FloatBuffer.wrap(new float[]{1.0f,1.0f,1.0f,1.0f});

GL11.glViewport(0,0,640,480);
GL11.glMatrixMode(GL11.GL_PROJECTION);
GLU.gluPerspective(45.0f,640.0f/480.0f,0.1f,1000.0f);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glLoadIdentity();
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glClearColor(0,0,0,0f);
GL11.glClearDepth(1.0f);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glFrontFace(GL11.GL_CCW);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glLight(GL11.GL_LIGHT0, GL11.GL_AMBIENT, ambientLight);
GL11.glLight(GL11.GL_LIGHT0, GL11.GL_DIFFUSE, diffuseLight);
GL11.glLight(GL11.GL_LIGHT0, GL11.GL_POSITION, lightPos);
GL11.glLight(GL11.GL_LIGHT0,GL11.GL_SPECULAR, specular);
GL11.glEnable(GL11.GL_LIGHT0);

GL11.glEnable(GL11.GL_COLOR_MATERIAL);
GL11.glColorMaterial(GL11.GL_FRONT,GL11.GL_AMBIENT_AND_DIFFUSE);
GL11.glMateriali(GL11.GL_FRONT,GL11.GL_SHININESS,10);
GL11.glDepthFunc(GL11.GL_LEQUAL);
GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);

GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_MODULATE);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
}

public static void main(final String args[]) throws LWJGLException, IOException
{
new TestView();
}

}

broumbroum

-Dorg.lwjgl.util.Debug=true please enable this debug mode and post some of the output you find !