problem with Frustum.isAABBoxOutside

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

problem with Frustum.isAABBoxOutside

Nico Vink
I have some working rendering code, that I am now trying to optimize by introducing frustum culling. Basically, I
1) create a new instance of Frustum in my display loop
2) calculate the model-view matrix for a model I'm trying to render
3) multiply the projection matrix with that model-view matrix
4) call frustum.updateByPMV with the resulting matrix
5) call isAABBoxOutside with an AABBox that represents the bounding box for my model (in model space)

If I comment out the call to isAABBoxOutside, it runs fine (but obviously, without any culling going on). If I uncomment it, however, the JVM crashes when trying to render the first model after that call. The output is:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fff924f11ef, pid=1880, tid=51715
#
# JRE version: Java(TM) SE Runtime Environment (7.0_45-b18) (build 1.7.0_45-b18)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.45-b08 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# C  [GLEngine+0x1401ef]  gleRunVertexSubmitImmediate+0x27ef
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /Users/vinkware/NetBeansProjects/working-client/hs_err_pid1880.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

This is run on a 2012 MacBook Air with the Intel HD4000, running Mavericks.

Have I stumbled upon a bug, or am I grossly abusing the seemingly very useful Frustum class?
Reply | Threaded
Open this post in threaded view
|

Re: problem with Frustum.isAABBoxOutside

Nico Vink
p.s. I'm using JOGL 2.1.5-01.
Reply | Threaded
Open this post in threaded view
|

Re: problem with Frustum.isAABBoxOutside

Wade Walker
Administrator
Can you post the /Users/vinkware/NetBeansProjects/working-client/hs_err_pid1880.log file referred to in your above error message? This should have the call stack that might help debug things.
Reply | Threaded
Open this post in threaded view
|

Re: problem with Frustum.isAABBoxOutside

Wade Walker
Administrator
Maybe in the case where you cull an object, you're trying to render an uninitialized vertex buffer or some other uninitialized or empty GL object?
Reply | Threaded
Open this post in threaded view
|

Re: problem with Frustum.isAABBoxOutside

Nico Vink
Not sure if I'd run into forum limitations, so I've put it online at:

http://vinkware.com/hs_err_pid1880.log
Reply | Threaded
Open this post in threaded view
|

Re: problem with Frustum.isAABBoxOutside

Nico Vink
I haven't figured out exactly what I did wrong yet, but the problem is not caused by the call to isAABBoxOutside; instead, my method that creates the AABBox seems to have some side-effect.

I have a helper class to represent my model. It has a method that calculates the vertices of the model and creates the AABBox (provided it is necessary to recalculate the vertices and AABBox); when that method is called right before rendering, it works, but when it's called a few moments earlier, it crashes. I'll probably get to the bottom of this later this week, and will post if I find the error.



Reply | Threaded
Open this post in threaded view
|

Re: problem with Frustum.isAABBoxOutside

Wade Walker
Administrator
Are you sure it's a problem with calling Frustum.isAABBoxOutside() itself, or is it a problem with what you're doing to your model after Frustum.isAABBoxOutside() returns true? Since your crash is in glDrawArrays(), I assume that when Frustum.isAABBoxOutside() returns true, you're somehow cutting down your model, removing vertices for example, and this removal process makes the model inconsistent somehow (e.g. maybe now there are more primitives than there are vertices). Then when you call glDrawArrays() later, it crashes inside the driver because the driver code runs off the end of your vertex array trying to render too many primitives. Just an example, but this would be my first guess.
Reply | Threaded
Open this post in threaded view
|

Re: problem with Frustum.isAABBoxOutside

Nico Vink
My apologies; turns out I was just reading over the error a million times and still not seeing it. My model class ended up thinking it was already loaded into the buffer even though it wasn't. Thanks for taking the time to respond.
Reply | Threaded
Open this post in threaded view
|

Re: problem with Frustum.isAABBoxOutside

gouessej
Administrator
Thank you for the feedback. This kind of crash is often caused by an attempt of reading or writing beyond the limit or the capacity of a direct NIO buffer. Wade's guess was right.
Julien Gouesse | Personal blog | Website