Crash while rendering with openGL

I encountered a problem while trying to let openGL render a square.
Everytime i want to start the program the window opens for a very short amount of time and then closes.
After this, in the Java console is written following:

A fatal error has been detected by the Java Runtime Environment:

EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00000000692d0ed7, pid=1764, tid=0x00000000000019b0

JRE version: Java™ SE Runtime Environment (8.0_151-b12) (build 1.8.0_151-b12)

Java VM: Java HotSpot™ 64-Bit Server VM (25.151-b12 mixed mode windows-amd64 compressed oops)

Problematic frame:

C [nvoglv64.DLL+0xb80ed7]

Failed to write core dump. Minidumps are not enabled by default on client versions of Windows

An error report file with more information is saved as:

D:\Neuer Ordner\Dab\Mandelbrot\hs_err_pid1764.log

If you would like to submit a bug report, please visit:

http://bugreport.java.com/bugreport/crash.jsp

The crash happened outside the Java Virtual Machine in native code.

See problematic frame for where to report the bug.

The strange thing about this is that I have another project with some additional “features” like normals or textures, but here, I only need a black square for now.
I´m thankful for every advise you can give me.

Attached are the project in which the crash happens [Mandelbrot] with the all the crashlogs.
The working project is sadly too big, but only 3 MB big, so if you want to have it, just tell me how.

I have no experience in java, so I can’t really help you here but from a c++ point of view EXCEPTION_ACCESS_VIOLATION sounds like you try to read or write to a piece of memory that is not owned by the program. In c++ this usually happens if you try to access an array with an index that is out of its bounds or if an object is destroyed but you still have references or pointers to the address. The latter case typically occurs if a function returns a reference or pointer to a temporary object. Maybe this could also happen here, but I am not sure since java uses a garbage collection system.

There should be a debugger in java. Try to run your program with it and locate which piece of code causes the exception. In c++ there are breakpoints that trigger if an exception is thrown. Java should have a similar mechanism:

https://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftask-catching_exceptions.htm
https://stackoverflow.com/questions/3066199/break-when-exception-is-thrown

If you know exactly which line of code causes the crash it gets much easier to tackle down the problems origin.

Greetings

I already know that it is because I try to render a VAO which is emoty and it doesn´t occure if i comment out the line “GL11.glDrawElements(GL11.GL_TRIANGLES, rawModel.getVertexCount(), GL11.GL_UNSIGNED_INT, 0);”
But I need help where the vao is not loaded/not created even though I created it and loaded the vertices/indices to the VAO
Thanks for your help, even if you don´t know Java, I appreciate your try! :wink:

[QUOTE=Kommuntoffel;1291918]I already know that it is because I try to render a VAO which is emoty and it doesn´t occure if i comment out the line “GL11.glDrawElements(GL11.GL_TRIANGLES, rawModel.getVertexCount(), GL11.GL_UNSIGNED_INT, 0);”
But I need help where the vao is not loaded/not created even though I created it and loaded the vertices/indices to the VAO
Thanks for your help, even if you don´t know Java, I appreciate your try! ;)[/QUOTE]

Okay, you say that you have another program where everything works, so we could guess that OpenGL (driver issues, missing extensions etc.) is not the problem here. Even if you try to render an VAO that was never created, this should give you a black screen and an OpenGL error that must be queued but should not cause an access violation (at least that is my OGL experience in c++). So my candidate for the crash is the function call that you used inside the OpenGL instruction:

rawModel.getVertexCount()

Try to write the value to a temporary and use the temporary in the OpenGL instruction instead of the function call. Rerun the debugger. I would bet that now the line where you write to the temporary is causing the crash. If it is the case:

Check the value of rawModel at the time of the crash. Is it a valid object or not?

if yes: - Check if the function really does what you think it does
--------- Are all the internally used variables to calculate the vertex count valid or is there a wrong value
--------- Is there an array in the calculation? Check if an invalid index gets accessed (due to wrong internal variables)

if not: - Try to find the place where it gets invalidated and figure out why

If I had to make a guess (if it is really the function call that crashes) I would say that rawModel itself is not valid anymore. Otherwise the debugger should have stopped directly somewhere in the function call. If I am wrong and it is not the function call, I have no clue what else can be the problem :stuck_out_tongue:

Greetings