Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


VBO based GUI : controls & text.


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Lleran   Members   -  Reputation: 100

Like
0Likes
Like

Posted 27 March 2012 - 04:14 AM

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.
Gui_0


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?

Sponsor:

#2 spek   Prime Members   -  Reputation: 997

Like
0Likes
Like

Posted 27 March 2012 - 09:10 AM

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
                glBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
- 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

#3 Lleran   Members   -  Reputation: 100

Like
0Likes
Like

Posted 27 March 2012 - 01:06 PM

Thanks for reply and ideas. I thought for a moment...
GUI may be represented as:

<Background>
<Border>
<TextButton/>
<TextButton/>
<TextButton/>
</Border>
<Some_other_batched_GUI/>
</Background>


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 plansPosted Image). Well, now I should to try implement this ideas.
Neverwinter Nights 2 GUI - this is my idealPosted Image




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS