OpenGL OpenGL partial rendering of item for GUI

Recommended Posts

Hi again,


thanks to the good advise from the guys on this thread thanks guys!

I have my basic 2D GUI working now, buttons, windows/dialogs and sliders are working, now i want to port my scrollbox, listview controls to OpenGL, unfortunately i dont have an idea on how 'clipping' a rendered object works, 
in 2D canvas such as in 2D SDL or javascript canvas, what i did is for example on listview/listbox control, i draw all items in an offscreen canvas, and just Blit copy the visible area to screen based on the amount it was scrolled.  Since i dont think OpenGL has the BlitBlk style of partial rendering a texture/canvas, how should i approach implementing a control such as listview control?

Background, i want a 2D GUI control where there will be items inside (like a listview) that hides/clip when scrolled based on scroll value, any tips on how to do this on OpenGL?


Edited by cebugdev

Share this post

Link to post
Share on other sites

You could use scissor:

Basically with scissors you can define a single rectangle in screen space, and everything that is outside of it does not get rendered.

The idea is, when you render things that should be visible only in a window, or a list box area, you set the scissor rect to be position and sized so it covers the whole visible area.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now