Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

AaronWizardstar

Member Since 10 Jul 2011
Offline Last Active May 14 2013 03:32 PM
-----

Topics I've Started

Managing pop-up GUI items

12 May 2013 - 05:49 PM

In a GUI system, what would be a good way to represent pop-up items such as menus and dialog boxes?

 
My GUI system is based on trees of widgets, e.g. a panel has a button has a label. Now I need widgets that are on top of other widgets instead of just inside them. Some pop-ups are modal, like dialog boxes, but some pop-ups like collapsable menus would only block the widgets directly under them.
 
One idea I had was to have all my widget trees in a stack. The tree for my main interface would live at the bottom, and any pop-ups would be additional trees pushed on to the stack. A widget tree could also have a flag for whether it's modal or not, likely kept in its root widget.
 
I'd also want to position some pop-ups relative to another widget, like a menu that's under a button. I'm not sure how I'd be able to do that aside from working out the screen coordinates of the parent widget. I wouldn't make the pop-up an actual child of the parent widget, since that relationship is for widgets contained by other widgets.

How much of Boost do you use?

28 April 2013 - 09:56 AM

I needed a certain kind of library and saw one of Boost's libraries recommended over and over, so I've began installing Boost.
 
Having Boost has led me to thinking about all the other libraries in Boost I could be using. Like replacing all my maps with unordered_maps and replacing all my iterator-based for lines with foreach. It's a bit overwhelming since Boost introduces so many attractive features, but I have to learn its libraries first and also figure out where they fit into my existing code.
 
"Boostifying" a project would probably be impractical if it has a deadline or is made by a team, so I'm asking more from the perspective of an individual hobbyist developer.
 
So to all of those whose projects depend on Boost, how much of its libraries do you actually use?

Indexing pixels in monochrome FreeType glyph

14 February 2013 - 12:51 AM

I need to render some monochrome (not greyscale, not antialiased) FreeType fonts, with the ultimate goal of implementing distance field fonts. I don't know how to properly access a monochrome glyph's pixels though.

 

For a greyscale glyph I can get the pixel at (x, y) with glyph.bitmap.buffer[(glyph->bitmap.width * y) + x].  I can't figure out what the equivalent offset is for a monochrome glyph though beyond it having something to do with the glyph's bitmap.pitch value.


Handling transparency for sprites with holes in them

30 January 2013 - 05:03 PM

Attached File  grafix.png   31.45K   17 downloads

 

My game's look is inspired by raycaster shooters like Wolfenstein and first-person-perspective RPGs like the Might & Magic series. Instead of models I'm going to have flat textured quads. That means I'm going to have to handle transparencies just to accommodate sprites with holes in them.
 
So far I'm able to get by with the discard command in my fragment shader, though since that leaves jagged edges I'm forced to adopt a heavily pixelated look. The heavily pixelated look would likely match the flatish structure of my scenes, but I was hoping for something a bit more...linear filtered. Not that this would apply to my low-res placeholder graphics.
 
In this case I believe my options are either to buckle down and sort the transparent quads, or do some kind of fullscreen anti-aliasing. Sorting might be easy due to the fact that it's just quads all the time, while fullscreen anti-aliasing may be something I want to support anyway. Are there any other options I'd have?

Sprite batching and other sprite rendering techniques

25 January 2013 - 09:05 PM

I'm considering how to efficiently render 2D sprites. I'm trying to keep things forward compatible for OpenGL 3+, but I'm limited to OpenGL 2.

 

I'd have a mixture of static and dynamic sprites.

  • Some sprites would be completely static; e.g. map tiles
  • Moving sprites would have dynamic transforms
  • Animated sprites would have dynamic texture coordinates; I'm using a texture atlas
  • A sprite may be both moving and animated (of course)
  • A sprite may be able to move but only does so infrequently; e.g. doors that swing only when opened
  • The lifetime of a sprite may be dynamic; some sprites may exist for the whole duration of the game, others may be added and later removed from the scene mid-game

A strategy I've used is having a global VBO representing a single unit-sized quad. This unit quad is rendered multiple times for each sprite, where I provide my shader a transformation matrix as well as offset and scale uniforms for the texture coordinates.

 

I've read that batching sprites, where I get the world-space coordinates and final texture co-ordinates of all sprites and jam them into a single VBO, is normally the way to go performance-wise. The simplest(?) batching method that I understand is using a GL_STREAM_DRAW VBO that gets the vertex data of all sprites with a glBufferData call each frame, possibly using an additional GL_STATIC_DRAW VBO with all the sprites that I know are static and persistent.

 

Would sprite batching be significantly more performant than my unit-quad VBO approach? If so, is the method of sprite batching I described an efficient implementation of batching given my requirements for sprite behaviour?


PARTNERS