views:

356

answers:

1

Hello, I am trying to create a generic list box in OpenGl ES (for the iPhone/iTouch) and I am running into a bit of a conundrum with clipping the ListBoxItems. Each ListBoxItem object will know how to draw itself. The ListBox I am making will just draw each one after another. But what if the number of items is larger than the ListBox? I will need to be able to scroll (not a problem) the ListBoxItems up and down. It will be a smooth scroll, so there will be times when a ListBoxItem will be half (or more, or less) visible and the other portion will be hidden because it is "outside" the ListBox area. How do I get this clipping to work correctly when I am making my ListBox widget?

Thanks for any help or links you have,

~Eric

+1  A: 

If you need to crop your rendering use glScissor!

  void glScissor( GLint x,
    GLint y,
    GLsizei width,
    GLsizei height )
Gerald Kaszuba
Don't forget to enable scissor testing with glEnable(GL_SCISSOR_TEST); and disable once you're done.
codelogic
Thanks for the quick help Gerald. Also, thanks for the backup codelogic.
EToreo