Jump to content
  • Advertisement
Sign in to follow this  
GroZZleR

Changing the way I think about the renderer...

This topic is 4863 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey all, I'm working on a 2D engine at the moment. While implementing various GUI widgets, an idea struck me. I currently render the scene directly to the window (a Windows window) then render my GUI elements ontop of that. But what if I allowed sprites to be rendered to various GUI elements themselves? I could have a "desktop" window which takes up the entire screen and various other child rendering windows for things like rear view windows, minimaps, 2D split screens and the like. Any thoughts or ideas? Anyone currently employ this strategy?

Share this post


Link to post
Share on other sites
Advertisement
what do you mean with child rendering windows? (Windows windows?) or custom gui windows

i would go with the first strategy rendering the map and draw the gui ontop of it

why would you spend more resources to do the same?

hm what you could do is rendering everything to these layers(how do they call it in opengl?)

and merge those when needed
so you render everything that changed its view and merge the pixels without rerendering the scene or the gui elements

Share this post


Link to post
Share on other sites
You can use texture render-targets so you would basically render to a texture rather than the window. You could have a widget that will allow to render to it. I don't see the need to be able to render to any widget (button or whatever) only those special widgets.

I'm sorry I can't remember more info but its a start, try to look it up on the web :)

Hope that offered some help

Share this post


Link to post
Share on other sites
I think a common term for the child rendering windows is viewports. It's really easy to do actually, and I can't see it making much of a difference to performance. But I was doing it in 3d, for split screen and the like, so it was a bit different. A mistake I made you might want to be aware of is I cleared the screen before rendering for each viewport out of habit. Not very clever.

EDIT: You don't need to render to texture to do it, you could just mask it with the stencil buffer. I didn't even need to do that because mine were all rectangular and were seperate, not a widgit or anything. I just had to set the glViewport right.

Share this post


Link to post
Share on other sites
Torque2D does exactly this I beleive. I thought about doing something similar in my 2D engine, but have abandoned the idea as pointless - in a twisted sort of way it makes sense. I've decided instead to use a special widget that can have a "render-to-texture" scene applied to them for minimaps, other camera views etc.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!