|
|
Depht test active?
Hi,
Now I ported my OpenGL application from GLUT to GTK2 with gtkglext. I
changed nearly no OpenGL code, but the result looks very bad:
http://brachttal.net/tmp/depth_test1.jpg
It looks like there's no depth testing activated. But I created the
window with Gdk::GL::MODE_DEPTH and activated it with
glEnable(GL_DEPTH_TEST)..
Do you think it's a depth buffer problem or is also another problem
possible?
I use glScalef() to zoom in and zoom out. Could this be a problem?
Sometimes objects disapear while zooming. Is there a better way to
realize a zoom/camera near/far function? Is a better way to translate
the word into my direction than using glScalef()?
regards
Andreas
|
|
0
|
|
|
|
Reply
|
Andreas
|
8/3/2005 9:12:04 AM |
|
Andreas Volz wrote:
>
> http://brachttal.net/tmp/depth_test1.jpg
>
> It looks like there's no depth testing activated. But I created the
> window with Gdk::GL::MODE_DEPTH and activated it with
> glEnable(GL_DEPTH_TEST)..
>
What value does glGet(GL_DEPTH_BITS...) return?
--
<\___/>
/ O O \
\_____/ FTB. For email, remove my socks.
In science it often happens that scientists say, 'You know
that's a really good argument; my position is mistaken,'
and then they actually change their minds and you never
hear that old view from them again. They really do it.
It doesn't happen as often as it should, because scientists
are human and change is sometimes painful. But it happens
every day. I cannot recall the last time something like
that happened in politics or religion.
- Carl Sagan, 1987 CSICOP keynote address
|
|
0
|
|
|
|
Reply
|
fungus
|
8/3/2005 9:28:58 AM
|
|
Am Wed, 03 Aug 2005 11:28:58 +0200 schrieb fungus:
> Andreas Volz wrote:
> >
> > http://brachttal.net/tmp/depth_test1.jpg
> >
> > It looks like there's no depth testing activated. But I created the
> > window with Gdk::GL::MODE_DEPTH and activated it with
> > glEnable(GL_DEPTH_TEST)..
> >
>
> What value does glGet(GL_DEPTH_BITS...) return?
The problem was really the glScalef() function. Now I changed my resize
Callback to do a gluPerspective() call and a z translate before and now
zoom with glScale() works. (zpr lib did this before, so sorry for this
stupid problem...)
This is my new Rescale function:
glViewport(0, 0, width, height);
fAspect = (GLfloat) width / (GLfloat) height;
camera.reshape (width, height);
// Reset coordinate system
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
// Produce the perspective projection
gluPerspective(60.0f, fAspect, 1.0, 128.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -8.0); // initial camera position
So where is the difference between translating the world "near to me"
and glScale()?
regards
Andreas
|
|
0
|
|
|
|
Reply
|
Andreas
|
8/3/2005 9:49:07 AM
|
|
|
2 Replies
120 Views
(page loaded in 0.059 seconds)
|
|
|
|
|
|
|
|
|