Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: glClear(GL_DEPTH_BUFFER_BIT)



Hi Lorenzo,

If you just disable the depth test before drawing drawing the scrolling text, and enable it again afterwards you should be able to accomplish what you want without loosing the contents of your depth buffer.

Hope this helps,
Daniel

Lorenzo wrote:
Hi,
I have to draw a cube in a 3D space using a perspective camera,
then a scrolling text using an orthogonal camera. In some case, when the
cube is too close, it intersects scrolling the text, even if I use 2
cameras. So I used a trick: when I set the ortho camera, before I draw the
scrolling text, I call again glClear(GL_DEPTH_BUFFER_BIT). It works very
well. I do

    clear color buffer and depth buffer
    set camera 1 (perspective)
    draw the cube
    set camera 2 (ortho)
    clear depth buffer
    draw the scrolling text
    draw other objects (?)
    flush

The problem is that now I have not longer my depth buffer, so I can't
properly draw any other 3D object, not even if I re-set the camera 1.
I cannot change the drawing object order because I can't know in advance.
Reading-Writing the z buffer is time consuming, so please have you a good
idea to draw as on different layers?



Best Regards

-- Daniel Koch -+- Graphics Technology Lead -+- TransGaming Technologies email@hidden +1 613.244.1111 x352 www.transgaming.com _______________________________________________ Do not post admin requests to the list. They will be ignored. Mac-opengl mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/mac-opengl/email@hidden

This email sent to email@hidden
References: 
 >glClear(GL_DEPTH_BUFFER_BIT) (From: Lorenzo <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.