LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: smitty1276 on June 27, 2004, 06:07:01

Title: Window.update() causing crash
Post by: smitty1276 on June 27, 2004, 06:07:01
I just started toying with LWJGL, and I think I like it.

I'm having some problems however... when I run my app it crashes with an "Abnormal program termination" messagebox.  If I comment out the Window.update() call in my render() method, it will work.

Any idea what I might be doing wrong? If this weren't my fault, I assume someone else would have mentioned it.
Title: Window.update() causing crash
Post by: smitty1276 on June 27, 2004, 06:32:46
It may not be Window.update() afterall (or anymore, whichever you prefer).

Check this out...

This is one of my methods...

private void render() {
   System.err.println("Render");//**
   GL11.glClear(GL11.GL_COLOR_BUFFER_BIT |   GL11.GL_DEPTH_BUFFER_BIT);
   GL11.glLoadIdentity();

   GL11.glTranslatef(0.0f, 0.0f, -250.0f);
   GL11.glPushMatrix();
   GL11.glRotatef(rot, 0.0f, 0.0f, 1.0f);
   GL11.glColor3f(0.7f, 0.3f, 0.3f);
   theSphere.draw(25.0f, 15, 15);
   GL11.glPopMatrix();

   rot += 1.0f;
   System.err.println("End render... Rot = " + rot);//**

}


rot is an instance member variable. When I give it no access-specifier (package access), the program crashes with a blank window and the System.err.println ends up printing "End render... Rot = 100.0" EVERY TIME!!!  If I change the increment value to 2.0f, it reports that rot = 200.0.

Basically, it crashes after 100 frames every time, without displaying a thing.

Interestingly, it DOESN'T crash if I comment out the Window.update() line.


Here's where it gets weird...

If I add the public access specifier in front of rot's declaration, the program runs great.  It displays my little rotating sphere, and runs until I tell it to stop... rot's value has been in the thousands with no problems.

What could be causing this?
Title: Window.update() causing crash
Post by: Matzon on June 27, 2004, 09:33:14
can you post the full source code? - this sounds weird.
What OS ? Graphics card and drivers?
Title: Window.update() causing crash
Post by: elias on June 27, 2004, 10:24:04
Definitely sounds like some memory corruption problem. Are you using buffers anywhere?

- elias
Title: Window.update() causing crash
Post by: smitty1276 on June 28, 2004, 05:03:33
I think it's resolved... though, I'm not sure exactly why it's resolved.

I'll get back to you if anything like that shows up again.