Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

rotos

Clearing the viewport

This topic is 5566 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is there any way to clear just the area of the screne covered by the viewport. I''m implementing a gui system, but need to clear the depth value of a window before draing 3d stuff on top. glClear clears the entire window, not just the viewport.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Don''t know why you''re doing it, but if you must.. simply glClear(GL_DEPTH_BUFFER); Just don''t pass GL_COLOR_DEPTH_BUFFER, only use the GL_DEPTH_BUFFER and it''ll only clear that one.

Share this post


Link to post
Share on other sites
I don't suppose glScissor would help. . . The spec says it restricts drawing to the area specified by the scissor, but I guess clearing doesn't really mean drawing. . .

You could always disable the depth test and render a quad to the depth buffer at the maximum extent of your frustum in ortho mode.

[edited by - Ostsol on September 23, 2003 6:31:06 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by Ostsol
I don''t suppose glScissor would help. . . The spec says it restricts drawing to the area specified by the scissor, but I guess clearing doesn''t really mean drawing. . .


glScissors will restrict the area cleared by glClear. Taken from MSDN on glClear.
quote:

The pixel-ownership test, the scissor test, dithering, and the buffer writemasks affect the operation of glClear. The scissor box bounds the cleared region.


Note that the viewport alone does not affect glClear.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!