Sign in to follow this  
Followers 0
Lleran

VBO based GUI : controls & text.

2 posts in this topic

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.
[sharedmedia=gallery:images:2018]

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?
0

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
[code]

glBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, myIndicesBufferObject ); // bind indices, also stored on the GPU
glDrawElements( GL_TRIANGLES, count, GL_UNSIGNED_SHORT, 0 ); // render
glBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
[/code]
- 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.

Rick
0

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:

[xml]<Background>
<Border>
<TextButton/>
<TextButton/>
<TextButton/>
</Border>
<Some_other_batched_GUI/>
</Background>[/xml]

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 plans[img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]). Well, now I should to try implement this ideas.
Neverwinter Nights 2 GUI - this is my ideal[img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]
0

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
Sign in to follow this  
Followers 0