Home > Mobile >  How make drawing restrictions in own gui window?
How make drawing restrictions in own gui window?

Time:07-01

I want make gui window, but i don't know how to restrict drawing. What i mean? When you scrolling window, some ui elements drawing, and some "being cut off". See in image this restrict? I need that: (IMAGE)

I find glScissor, but i don't know how to used it

CodePudding user response:

glScissor could work for exactly this purpose (scrolling).

It uses a per-fragment 'scissor test' to check whether a fragment is in the boundaries of the scissor box specified by glScissor. Nothing can be modified outside of the box, so this is a way to restrict drawing and rendering.

It takes in the position of the bottom left of the box as the first two parameters, and the last two are the width and height respectively. (You may have to call glEnable(GL_SCISSOR_TEST) first, as the scissor test is usually disabled.)

In this case, you can set the scissor box to the dimensions of the GUI window, so that you can cut off individual pixels of the GUI when the user scrolls.

  • Related