Jump to content
Site Stability Read more... ×
  • Advertisement
Sign in to follow this  

VBO based GUI : controls & text.

This topic is 2764 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

I need advice about user interface implementation. Let's suppose that group of controls represented as single VBO buffer. For exaple (in rendering order): background - border - some icon.

Now I desire to add vbo based text (it represented as single VBO buffer too, therefore I have 2 VBO buffers). How can I implement rendering order like this: 'background - border - text - some icon' using 2 VBO buffers?

Share this post

Link to post
Share on other sites
That doesn't sound like a very flexible solution. Normally you would disable Z-testing, and then just draw the individual components in the order as you mentioned. It's possible to put everything in one (or more) VBO's, and render subparts though. By using offsets, or indices. For example, if you go for indices, you could:
- Create 1 VBO containing ALL geometry
- For each thing, create a buffer with the indices (usually 4 ints referring to the corner vertices)
- Activate the VBO
- apply border material, render border , using the indices that refer to the border quad

glBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, myIndicesBufferObject ); // bind indices, also stored on the GPU
glDrawElements( GL_TRIANGLES, count, GL_UNSIGNED_SHORT, 0 ); // render

- apply background material, render background, using the indices that refer to the background quad
- ...and so on...
- Disable the VBO

This also allows to hide or move around subparts. Before drawing a subpart, you can apply other materials, and call glTranslate/glScale or whatever transformation. I wonder if it's worth the trouble though, since a GUI usually only contains a relative small amount of simple quads.


Share this post

Link to post
Share on other sites
Thanks for reply and ideas. I thought for a moment...
GUI may be represented as:


Also it may be represented as (in rendering order): 'Background - Border - TextButton - TextButton - TextButton - Some_other_batched_GUI. So, it's necessary to have some VBO buffers: (Background + Border) - (Button) - (Text) - (Button) - (Text) - (Button) - (Text) - (Some_other_batched_GUI). Yes, this isn't ideally, but this case isn't ordinary\frequent too (Creating text processor isn't in my planssmile.png). Well, now I should to try implement this ideas.
Neverwinter Nights 2 GUI - this is my idealsmile.png

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!