Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6628381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:07:29+00:00 2026-05-25T22:07:29+00:00

I have been reading articles about clipping now for hours now but I dont

  • 0

I have been reading articles about clipping now for hours now but I dont seem to find a solution for my problem.

This is my scenario:

Within an OpenGL ES environment (IOS,Android) I am having a 2D scene graph consisting of drawable objects, forming a tree.

Each tree node has its own spatial room with it’s own transformation matrix, and each node inherits its coordinate space to its children. Each node has a rectangular bounding box, but these bounding boxes are not axis aligned.

This setup works perfect to render a 2D scene graph, iterating through the tree, rendering each object and then it’s children.

Now comes my problem: I am looking for a way enable clipping on a node. With clipping enabled, children of a node should be clipped when leaving the area of the parent’s bounding box.

For example I wand to have a node containing a set of text nodes as children, which can be scrolled up and down withing it’s parents bounding box, and should be clipped when leaving the area of the parent’s bounding box.

Since bounding boxes are not axis aligned, I cannot use glScissor, which would be the easiest way.

I was thinking about using the stencil buffer and draw the filled bounding rectangle into it, when clipping is enabled and then enable the stencil buffer. This might workd but leads to another problem: What happens if a child inside a clipped node has clipping again ? – The stencil mask would have to be setup for the child, erasing the parents stencil mask.

Another solution I was thinking of, is to do the clipping in software. This would be possible, because within each node, clipping could be done relative easily in it’s own local coordinate space. The backdraw of this solution would be that clipping has to be implemented for each new node type that is implemented.

Can anybody here point me into the right direction?
What I am looking for is something like the functionality of glscissor for clipping non axis aligned rectangular areas.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T22:07:29+00:00Added an answer on May 25, 2026 at 10:07 pm

    The scissor box is a simple tool for simple needs. If you have less simple needs, then you’re going to have to use the less simple OpenGL mechanism for clipping: the stencil buffer.

    Assuming that you aren’t using the stencil buffer for anything else at present, you have access to 8 stencil bits. By giving each level in your scene graph a higher number than the last, you can assign each level its own stencil mask. Of course, if two siblings at the same depth level overlap, or simply are too close, then you’ve got a problem.

    Another alternative is to assign each node a number from 1 to 255. Using a stencil test of GL_EQUAL, you will be able to prevent the overlap issue above. However, this means that you can have no more than 255 nodes in your entire scene graph. Depending on your particular needs, this may be too much of a restriction.

    You can of course clear the stencil (and depth. Don’t try to clear just one of them) when you run out of bits via either method. But that can be somewhat costly, and it requires that you clear the depth, which you may not want to do.

    Another method is to use the increasing number and GL_EQUAL test only for non-axis-aligned nodes. You use the scissor box for most nodes, but if there is some rotation (whether on that node or inherited), then you use the stencil mask instead, bumping the mask counter as you process the graph. Again, you are limited to 256 nodes, but at least these are only for rotated nodes. Depending on your needs and how many rotated nodes there are, that may be sufficient.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ive tried reading as many articles about this as i can, but cannot find
I have been reading articles about state management in ASP.NET for few days for
I have been reading countless articles about how to architect a new MVC 3
Recently I have been reading up articles about DLL injection and I understand them
I have been reading lots of docs, blogs,articles.. talking about Mysql Replication and i
I have been reading about thread safe singletons and the implementation I find everywhere
I have been reading articles about asynchronous messaging between clients using MVC3 and the
I have been reading a couple of articles on stack overflow about aggreation and
I have been reading a lot of articles lately about programming practice, design and
I've been reading about the Gawker incident and several articles have cropped up regarding

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.