Hello everybody,
I am not developping a game but a small CAD-oriented application. It is a mesh viewer/editor.
I use SWT for the general GUI and indeed LWJGL for interfacing the app with OpenGL.
I can display multiple meshes, each of them if stored in a VBO. When I render them, everything seems to be working correctly.
The comes when I want to use two different GLCanvas, and so two different contexts (one for viewing with a 3D display, translation, zoom and rotaton capabilities, the other, only 2D but with the possibility to orientate the view (front, back, left etc...)). These two contexts are used in two tabs (TabItem in SWT).
When I load my mesh, it is displayed correctly in the first tab (3D) but when I switch to the 2D tab, I get a crash. First I thought it was due to a missuse a VBOs, so for each meshm I generate two VBOs, one for viewing, one for editing. But I have still the same crash.
For now I only display a simple mesh of 4x4 quads. which means 5 nodes per row and column => 25 nodes, and 3 components by node => 75 floats. this is the size of the buffer declared as well. and for the quads, 4x4 = 16 quads, and 4 nodes per quads leads to 64 ints for the size of this buffer. this number is also correct for the buffer size.
So I do not really understand where it is going wrong when I use the two contexts. When I render the view, I call GLContext.setcurrent(mycanvas) and mycanvas.setcurrent().
so I must say that I running a bit out of ideas of where to find my mistake, so I post here since you may help me with this problem.
I used this snippet:
http://bingjava.appspot.com/snippet.jsp?id=389 to start using the GLCanvas. now it changed quite a lot : rendering only when needed in a separate method, which call setcontext, setcurrent and so on.
Thank you,
Pierre