I am working on an Android application where I am using a single OpenGL ES instance. In some instances, I am drawing a custom (rectangular) dialog ontop of everything else, with scrolling text, lines, etc. The dialog does not take up the whole screen, and I am drawing content that is larger than the dialog box, which is scrolling across the dialog, like a marquee.
Of course, since I am drawing this dialog last (ontop of every other view), all the vertices I am drawing are going to be visible, but I would like to tell OpenGL to not draw outside of the dialog rectangle for any of its rendering commands. Like this...
Most of my drawing is done with glDrawArrays(...)
using FloatBuffer
arrays. What I would like is a way to specify to OpenGL that I want any drawing to be invisible outside of a specified region.
I don't know much about culling, but this seems to be very related to what I'm looking for. However, culling seems to only be for skipping the drawing of triangles that wouldn't be "seen" from the camera view in a 3D, whereas I would like to 'skip' the drawing of any triangles outside of an arbitrary rectangle within the viewport.