Java-Gaming.org Java4K winners: [ by our judges | by the community ]         
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  Print  
  [Solution] SWT + jogl -> z ordering issues  (Read 781 times)
0 Members and 2 Guests are viewing this topic.
Offline funsheep

JGO n00b
*

Posts: 13


Java games rock!


« on: 2008-09-11 03:58:20 »

Hi,

i'm trying to use jogl with SWT. Everything is up and running with the latest jogl-release from May 2008. Somehow i have problems with z ordering although GL_DEPTH_TEST is enabled.

Below you will find my GLContext creation code (copied from Snipped #209).
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
org.eclipse.swt.GLCanvas canvas = new GLCanvas(new GLData());

canvas.setCurrent();
GLContext glcontext = GLDrawableFactory.getFactory().createExternalGLContext();
glcontext.makeCurrent();

//do some rendering and enable GL_DEPTH_TEST

glcontext.release();
glcanvas.swapBuffers();


Since i couldn't find anything to correct this problem: Has someone a solution? Maybe its the same issue for which the GLJPanel was created? And no, i don't want to use SWT_AWT bridge.

[edit]
OS: Intel Linux 32 bit. Latest nvidia driver (173.xxx). And swt 3.3.2
[/edit]
Offline funsheep

JGO n00b
*

Posts: 13


Java games rock!


« Reply #1 on: 2008-09-12 03:48:17 »

Just for the records: Solution found!

Ok. This is really somewhat hidden (or i must read more javadoc). What the snipped #209 doesn't take into account: If the size of the depthbuffer is not set on the passed on GLData object, there is no! depthbuffer.

Corrected lines of code:
1  
2  
3  
4  
GLData gld = new GLData();
gld.depthSize = 4; //measured in bytes.

org.eclipse.swt.GLCanvas canvas = new GLCanvas(gld);


everything else as usual.

Hope this helps other people having the luck to just copy & paste the snipped and than wonder about the wired/ messed up rendering.

Regards,
funsheep
Offline xinaesthetic

Full Member
**

Posts: 207
Medals: 1



« Reply #2 on: 2008-09-12 05:44:33 »

Glad you found a solution; this may be useful to me at some point.  Actually, I must admit that it rang a bell from things I'd read before about (but not implemented myself yet) about setting  up Frame Buffer Objects, including explicitly creating the depth buffer, so I had a feeling it might've been something very similar (ie, that one shouldn't take presence of depthbuffer for granted) - perhaps I should've commented.
Pages: [1]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.101 seconds with 20 queries.