Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
2 posts
|
I add joal 2.1 to eclipse, add to a EditorPart control, When I run it, I seed the 3D graphic.
Then I open other program, the window of other program will cover the part of 3D window. When I minimized the other program window, I will see the 3D graphic again, but only the area that covered by other windows before can rendering now. other area are frozen. sample code as follow, thanks. canvas.addListener(SWT.Resize, new Listener() { @Override public void handleEvent(Event event) { Rectangle bounds = canvas.getBounds(); float fAspect = (float) bounds.width / (float) bounds.height; canvas.setCurrent(); context.makeCurrent(); GL2 gl = context.getGL().getGL2(); gl.glViewport(0, 0, bounds.width, bounds.height); gl.glMatrixMode(GL2.GL_PROJECTION); gl.glLoadIdentity(); GLU glu = new GLU(); glu.gluPerspective(45.0f, fAspect, 0.5f, 400.0f); gl.glMatrixMode(GL2.GL_MODELVIEW); gl.glLoadIdentity(); context.release(); } }); canvas.addPaintListener(new PaintListener() { int rot = 1; public void paintControl(PaintEvent e) { if (!canvas.isDisposed()) { canvas.setCurrent(); context.makeCurrent(); GL2 gl = context.getGL().getGL2(); gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT); gl.glClearColor(.3f, .5f, .8f, 1.0f); gl.glLoadIdentity(); gl.glTranslatef(0.0f, 0.0f, -10.0f); float frot = rot; gl.glRotatef(0.15f * rot, 2.0f * frot, 10.0f * frot, 1.0f); gl.glRotatef(0.3f * rot, 3.0f * frot, 1.0f * frot, 1.0f); //rot++; gl.glPolygonMode(GL2.GL_FRONT_AND_BACK, GL2.GL_LINE); gl.glColor3f(0.9f, 0.9f, 0.9f); drawTorus(gl, 1, 1.9f + ((float) Math.sin((0.004f * frot))), 15, 15); canvas.swapBuffers(); context.release(); //display.asyncExec(this); } } }); context.makeCurrent(); GL2 gl = context.getGL().getGL2(); gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); gl.glColor3f(1.0f, 0.0f, 0.0f); gl.glHint(GL2.GL_PERSPECTIVE_CORRECTION_HINT, GL2.GL_NICEST); gl.glClearDepth(1.0); gl.glLineWidth(2); gl.glEnable(GL2.GL_DEPTH_TEST); context.release(); |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
2 posts
|
I found the bug, root cause is GraphicalViewerImpl hook the canvas.
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
6044 posts
|
In reply to this post by yymusic
Hi
Please use JOGL 2.3.2 if you want to get some help. GraphicalViewerImpl comes from GEF, I tried to use it 5 years ago but its version based on JOGL wasn't publicly available. I remind you that the Eclipse SWT OpenGL canvas is no longer maintained (since 2005) unlike JOGL SWT GLCanvas and NEWTCanvasSWT.
Julien Gouesse | Personal blog | Website
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
857 posts
|
In reply to this post by yymusic
I've done this sort of thing successfully before, it sounds like maybe you're doing custom processing on the paint events over the GL canvas (like to redraw GL where tooltips obscure the canvas) and are getting the draw regions inverted somehow.
|
Free forum by Nabble | Edit this page |