Jump to content
  • Advertisement
cebugdev

OpenGL OpenGL partial rendering of item for GUI

This topic is 410 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

 

Edited by cebugdev

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!