OpenGL partial rendering of item for GUI

Started by
1 comment, last by ongamex92 6 years, 6 months ago

Hi again,

 

thanks to the good advise from the guys on this thread https://www.gamedev.net/forums/topic/692174-opengl-2d-gui-system-question/?tab=comments#comment-5356606 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?

 

Advertisement

You could use scissor:
https://www.khronos.org/registry/OpenGL-Refpages/es2.0/xhtml/glScissor.xml

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.

This topic is closed to new replies.

Advertisement