Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Need advice on own windowing toolkit

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member Regular Contributor
    Join Date
    Sep 2013

    Need advice on own windowing toolkit


    I am currently working on writing my own windowing toolkit. I do this just for fun and for the honor; I want to learn more about OpenGL and programming in general and I think this will be learning a lot throughout this project.

    Unfortunately I ran into a little problem and I would like to ask for some help on this. I decided to use a recursive structure for the GUI components; they are nested into each other like a tree.
    GUI example:

    GUI as a component tree:

    My problem is that I need to do some clipping in the GUI. The child of a component should never extend over the boundary box of its parent component. If I have a window and some buttons inside the buttons should not be drawn outside of the window if the window is resized to be very small.

    I personally know of 2 ways of doing this clipping; scissor-test and stencil-test. I tried with scissor test and it works so far, but my problem is, that I try to store all the rendering data for all components in one big VBO, each time I want to apply a scissor test I have to make another draw call. If the component tree is very high instead of wide this would result in awful performance I guess.
    I haven worked too much with stencil tests yet, but I thought these could potentially make it a little better.

    So, after that wall of text, these are my questions:
    1) Would using stencil test be a better idea for clipping? (And why?)
    2) If stencil tests would be better, can you give me an advice on how to use them properly for this task?
    3) Is there some other way I could do this that I just dont know about?

    Thank you very much for the answers, I really appreciate the help.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	GUI Example.jpg 
Views:	238 
Size:	12.1 KB 
ID:	1214   Click image for larger version. 

Name:	ComponentTree Example.jpg 
Views:	232 
Size:	12.4 KB 
ID:	1215  

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts