I get the following error using VBOs and GlDrawArrays() and with pBuffers…not sure if all of those are the cause or if only the first two.
The VM basically crashes with the above error…ie a hard crash with no log in Windows, in Linux 32 bit I got a log that pointed me to GlDrawArrays() as the crash stop point.
I’ve attached a compressed zip file to this post which I hope someone can test out for me…it contains a test project showing the issue.
The file is a NetBeans project but I changed the extension to .jar so I could upload it to this forum.
Take the file VboGlDrawArraysCrash.jar and RENAME it to VboGlDrawArraysCrash.zip and then extract the data to your desktop.
You need to update the jogl library paths within the project it get it to work. This code uses a modified version of the JOGLUTILS library to load 3DS files…the modifications are my VBO additions that I’ve not yet submitted for JOGLUTILS updates. I believe the VBOs are correct, and you can see what I do with setting them up in the model3ds/Model3DS.java file.
Here is a description of the code that you will see…I have a VboGlDrawArraysCrash.java code that basically sets up the panel containing a render panel on the left (areas/renderer/RenderPanel.java) and a JPanel with two pulldowns on the right side. In the left RenderPanel I display a BufferedImage obtained from a pBuffer that is generated in the renderer.
The renderer draws either a 3DS model or a Cube based on what you select in the “Area” pulldown: 3D Vehicle or Flat Plate. There are corresponding classes that render these two things: areas/vehicle/VehicleArea.java and areas/vehicle/FlatPlateArea.java. Each of these classes has a drawGL() method that does the drawing.
Ok, here are the instructions that will get you to CRASH your VM.
- Start the viewer
- select “Flat Plate” from the Area pulldown - it is defaulted to 3D Vehicle
- Change Resolution to anything you want.
- select “3D Vehicle” from the Area pulldown - ie. go back to where you started.
The above crashes the VM…initially I thought the cause was the of changing the resolution of the pBuffer (which is what the Resolution pulldown does) and it may be related but I don’t see why. In my case I recreate the pBuffer to fit the new resolution selection because the setSize() of the pBuffer is not yet implemented.
Clearly if you are viewing a 3DS vehicle (in this case a tie fighter) then the VBOs and GlDrawArrays() are working because you see them.
I can change to the Flat Plate view and back to 3D vehicle view multiple times and all things are rendered correctly. I can even change the resolution while I’m in the 3D Vehicle view and it works correctly. I can also switch to the flat plate view and change resolution and it also works…but now if in the flat plate view I switch resolutions and then change back to the 3D view then I get the VM crash…it just makes no sense what the cause is.
Even though I have multiple classes for rendering, I basically have the following simple code for the renderer:
void display() {
if (3D selected) {
DrawModel3DS();
} else if (Flat Plate Selected) {
DrawFlatPlate();
}
}
So it is not like creating any new GLJPanel or new VBOs…I’ve created all of those things once and I simply switch which I display. It seems to work except for the once case above where I switch resolutions while in Flat Plate mode and then change the view to the 3D vehicle mode. If I’m in the 3D vehicle mode and change resolutions and then go to flat plate mode then it is still fine.
I’ve lost my mind…this is crazy. BTW, I know VBOs are the issue here because I can change my rendering from VBOs to Immediate mode rendering and everything works fine…only if I use the VBOs in the 3D model do I get the crash and it seems to occur in my render method at the glDrawArrays() calls.
Any thoughts???