Jump to content

  • Log In with Google      Sign In   
  • Create Account


ChaseRLewis

Member Since 30 Aug 2010
Offline Last Active Jun 26 2014 11:25 AM

#5150239 Tips for Programming a GUI

Posted by ChaseRLewis on 28 April 2014 - 09:29 PM

One note unless GUIWindow is this I recommend a UIPanel class. This is pretty much just a group of components that has a size and can organize children relative to its position. It lets you anchor points and you will need a margin / anchor property to make sure everything lines up unless you are only wanting to support 1 resolution. Another convenient figure is if you allow it to clip children. Then you can create scroll views. Most gui utilities support panels, grids, and other organizational items but you can get by with just a panel to be honest. Also by supporting children to organizational objects you can build together different parts to make more complicated components.  Also when you create your event system you can search through your items in a tree structure rather then a linear list. Also you NEED events / callbacks. If you are in c++ use FastDelegate as a base for your delegate system and build an event class. Most other languages have some sort of support for that otherwise.

 

Common components I use.

1. Textbox

2. Texture Button

3. Label

4. Progress Bar / Slider (these components internally will be very similar)

5. Scrollview




#4791077 Issue with creating a geometry shader for creating textured quads

Posted by ChaseRLewis on 27 March 2011 - 02:55 PM


You don't actually describe what the problem is. Is it not drawing anything? is the texture not showing? is the texture wrong?

Anyway, various things to think about:
As with someone else recently, you have "varying in" and "varying out". Both varying and in / out are storage qualifiers - I'm pretty sure it's not meant to be valid to use both of them. I'd suggest using in / out since varying is deprecated (and I'm not actually sure you can use varying in anything other than vertex / fragment shaders).

I assume "Texture" is a variable containing the location of the sampler retrieved via glGetUniformLocation, and that your BindTexture member correctly calls glActiveTexture and glBindTexture?

Note that you don't have to bind the array buffer as well as the vertex array in the draw call.

You don't appear to be calling glEnableVertexAttribArray anywhere.



Alright I looked into glEnableVertexAttribArray so that's fixed. However I still didn't get anything to show, so i messed with the shader. It seems that for some reason my final value of vec4 vPosition is getting overwritten somehow. If i manually set the height I get a perfect textured quad, but if i try to read it from the incoming vertex I can't see anything.





lol ok, found out the issue. I simply wasn't referencing my position through gl_in[] instead I was trying to reference through another variable. : P it's working perfectly now.




PARTNERS