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 6575707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:25:16+00:00 2026-05-25T15:25:16+00:00

I am working on an OpenGL-based UI written in C. I have a hierarchy

  • 0

I am working on an OpenGL-based UI written in C. I have a hierarchy of controls — small square 2D boxes inside a scrollable region of a bigger control. Inside the small boxes 3D scenes are drawn. The 3D scene must be scissored within the small 2D boxes and the small 2D boxes must be scissored within the larger region.

glScissor() is an obvious candidate for making sure drawing takes places within the desired region. The problem is that I cannot simultaneously call glScissor() for the large region and then call glScissor() again for subregions inside the larger scissored region.

Example code to demonstrate what I want:

void drawBigBox() {
    glScissor( ... ); //set the bounds of the larger region
    for each little box {
        //these might be anywhere, but they should only be visible if inside the glScissor bounds
        drawLittleBoxes(); 
    }
}

void drawLittleBoxes() {
    //draw only inside little box -- Whoops! This replaces the big box bounds!
    //How can I meet this constraint while retaining the outer scissor region?
    glScissor( ... );
    draw3dScene();
}

Is there a simple way of doing what I want? Obviously I can also calculate the intersection of the small and large scissor boxes, or I could more carefully clip/project my 3D scene, but that is more complicated than an OpenGL call. Perhaps there is another approach to doing this that I am unaware of.

Thanks!

  • 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-25T15:25:17+00:00Added an answer on May 25, 2026 at 3:25 pm

    You could try to rely on glPush/PopAttribs calls to save and restore the scissor state. However, that was removed in 3.1, and the stack for attributes may not be as large as you need. So you should use an explicit stack.

    Just make some object that you use to set the current scissor state. Each layer as you go down the call stack pushes its scissor state, which uses an actual stack of scissor rectangles. I have a generalized version of this that also pushes transform matrices, blend parameters, and so forth.

    The object either has to be global GUI state, or bundled with some object that you pass to each of the functions.

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

Sidebar

Related Questions

I am working on an Android opengl lib and have hit a small issue.
I'm working in OpenGL, with VBOs, and I have a set of three lines
I'm working with sprite animation (OpenGL + C++). I have some trouble working with
I'm working on an android game with OpenGL, and I have a game update
Ahoy, I'm working on an OpenGL ES based game for Android using the NDK.
I'm working on a relatively simple 2D side-scrolling iPhone game. The controls are tilt-based.
I m working on OpenGL tester program for Android. So i have pretty havy
I am working on a linux-based c++ OpenGL application, utilizing the Nvidia 290.10 64bit
I am working on openGl in android and stuck with some issue. I have
I have an artsy opengl app that I am working on. The final product

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.