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)



You can use glDepthRange for this.
Render one object with depthrange set to 0-0.5
and the next one with depthrange set to 0.5-1.0

On 11/24/07, Stefan Dösinger <email@hidden> wrote:
> Am Samstag, 24. November 2007 12:43:23 schrieb Richard S. Wright Jr.:
> I think he wants to draw 2 3D objects, where one is always visible in front
> of
> the other, but both objects contain multiple primitives that should be
> ordered against themselves.
>
> One way I can think of is to render the text to a texture, either using fbos
> or glCopyTexImage2D. Then render the cube normally, draw the text from the
> texture with the depth test off, then continue normally. That way you can
> perform hidden surface removal on the fonts without depending on the depth
> values in the scenes where it is finally rendered to.
>
>
> > A typical way to do this is:
> >
> > 0. Clear color and depth buffers: glClear(GL_COLOR_BUFFER_BIT |
> > GL_DEPTH_BUFFER_BIT);
> > 1. Draw all 3D "Stuff"
> > 2. Turn off depth testing: glDisable(GL_DEPTH_TEST);
> > 3. Switch to ortho coordinate system, draw all 2D "Stuff" over top of
> > 3D Stuff
> > 4. Switch back to perspective coordinate system, turn depth testing
> > back on: glEnable(GL_DEPTH_TEST);
> > 5. Swap Buffers
> > 6. Repeat...
> >
> > You "should" draw all your 3D objects first, then the 2D elements over
> > top of them. Unless I am misunderstanding your ultimate goal.
>
>
>  _______________________________________________
> 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
>
 _______________________________________________
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: 
 >Re: glClear(GL_DEPTH_BUFFER_BIT) (From: Lorenzo <email@hidden>)
 >Re: glClear(GL_DEPTH_BUFFER_BIT) (From: "Richard S. Wright Jr." <email@hidden>)
 >Re: glClear(GL_DEPTH_BUFFER_BIT) (From: Stefan Dösinger <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.