Jump to content

  • Log In with Google      Sign In   
  • Create Account


Nested Projections & Transforms


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
4 replies to this topic

#1 SuperVGA   Members   -  Reputation: 1118

Like
0Likes
Like

Posted 30 April 2013 - 02:19 PM

Hi guys!
 
I'm at a point with my GUI framework exercise where I'd like to extend with an element that acts as a view into a 3D scene.
My secondmost basic element for now can do rotation, scaling and translations.
I'd like to be able to embed this new element into the more advanced one, meaning my otherwise simple projection-capable element
will be transformed along with its parent in the plane. I want it to be part of the transformation stack.
 
At the same time, I'd like whatever contents of the scene to be rendered onto this new, rectangular element as it normally would.
Do I push the viewport and projection bit attributes? What would be a decent way to accomplish this?
 
Thanks in advance, smile.png



Sponsor:

#2 SuperVGA   Members   -  Reputation: 1118

Like
0Likes
Like

Posted 01 May 2013 - 06:04 AM

... It would it require me to use FBOs, and render to a transformed rectangle, wouldn't it? :-|



#3 irreversible   Crossbones+   -  Reputation: 1235

Like
1Likes
Like

Posted 01 May 2013 - 07:08 AM

Yes, using an FBO provides a simple and elegant approach and is conveniently backwards compatible up to GL2.0 core. An alternative would be to draw your GUI elements on top of the 3D window every frame, or if you don't want to do that, using the stencil buffer or a discard mask when drawing the 3D scene.

 

For simplicity's sake, especially if you want to support all forms of shaders in your 3D scene (and you still want to do child/sibling window clipping on top of it), using an FBO is the simplest way to go.

 

You'd have the set up the FBO just like a regular window, set its viewport to the texture rect and just draw the scene. Don't worry about the texture copy - it's really cheap.



#4 irreversible   Crossbones+   -  Reputation: 1235

Like
1Likes
Like

Posted 01 May 2013 - 07:13 AM

In terms of transformations - I suggest providing the 3D scene its own transformation matrix stack and manage the GUI completely independently.

 

Note, however, that things get a little bit funkier if your 3D scene uses FBOs internally - just something to keep in mind.



#5 SuperVGA   Members   -  Reputation: 1118

Like
0Likes
Like

Posted 01 May 2013 - 07:52 AM

Yes, using an FBO provides a simple and elegant approach and is conveniently backwards compatible up to GL2.0 core. An alternative would be to draw your GUI elements on top of the 3D window every frame, or if you don't want to do that, using the stencil buffer or a discard mask when drawing the 3D scene.

 

For simplicity's sake, especially if you want to support all forms of shaders in your 3D scene (and you still want to do child/sibling window clipping on top of it), using an FBO is the simplest way to go.

 

You'd have the set up the FBO just like a regular window, set its viewport to the texture rect and just draw the scene. Don't worry about the texture copy - it's really cheap.

;) I thought so. I remember being annoyed with having to copy my texture, but if I do it right, I don't think the copy operation is actually required, although the GUI drawing would of course have to wait until after the scene is drawn, and I'll be unable to fire off all the primitives in one go. But that's a fair price to pay to be able to scale projections after rendering, besides being able to rotate everything.

I'm glad you advocate a solution allowing some backwards compatibility and easening the appearance of the overall structure. (Embedding a perspective projection inside an orthographic one seems messy, I think. smile.png )

 

In terms of transformations - I suggest providing the 3D scene its own transformation matrix stack and manage the GUI completely independently.

 

Note, however, that things get a little bit funkier if your 3D scene uses FBOs internally - just something to keep in mind.

Oh yes, about that.... tongue.png Naah, I'll get around to it eventually, -But it's fun to imagine.
I picture GUIs rendered onto surfaces in space, and the space to be viewed as part of a GUI... Like ID did in Doom 3, just with no theoretical recursion maximum.


Edited by SuperVGA, 01 May 2013 - 07:52 AM.





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