We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › clipping, loadimage, zbuffer
Page Index Toggle Pages: 1
clipping, loadimage, zbuffer (Read 632 times)
clipping, loadimage, zbuffer
Aug 16th, 2006, 3:05pm
 
Hi,
I'm rewriting an old sketch from v68 to 0115 (I want to put in some new ideas). I've ran into some problems.
So far I have this (use e-s-d-f to move and rotate, use q-a to zoom). The image below the applet is what it should look like.

The first problem I run into is clipping. I've tried to use perspective to prevent clipping. I just copied the example and altered the zNear and zFar. ZNear works fine but I'm getting no good result on the zFar values (as in nothing seems to happen). I've also noticed that the values have a different effect for openGL and P3D.
Are there other ways than perspective to prevent clipping

I fixed this by scaling down everything 30%.

Second problem is the loadimage when exporting as an applet. The applet seems to load only the top quarter of the images, the rest is jibberish (use q to zoom in). This worked fine in the old sketch.
I've read somewhere that loadimage should occur in the setup part of the sketch, which is the case in my sketch (classes that do the loading are instanciated in the setup).

Third problem is the zbuffer in openGL. Is there anyway to clear it... as in the P3D Code:
for(int i=0;i<pixels.length;i++) g.zbuffer[i] = MAX_FLOAT;
Zooming in too far in openGL sometimes causes the buttons to disappear.
Re: clipping, loadimage, zbuffer
Reply #1 - Aug 16th, 2006, 10:51pm
 
Code:

import javax.media.opengl.*;

GL gl;

...setup...
gl=((PGraphicsGL)g).gl;

...draw...

gl.glClear(GL.GL_DEPTH_BUFFER_BIT);
Re: clipping, loadimage, zbuffer
Reply #2 - Aug 17th, 2006, 7:10pm
 
ah ... thanks :-)
Page Index Toggle Pages: 1