Search code examples
javaopenglrenderinglwjgl

OpenGL Rendering Within Rectangle


Is there any way I can render sprites, text, etc., but have part of it not rendered so that it is all contained in a rectangle? This would be applied to scroll views and textfields for example.


Solution

  • If it's a screen aligned rectangle, then using a scissor rect is the best solution. See: https://www.khronos.org/opengles/sdk/docs/man/xhtml/glScissor.xml