Jump to content

  • Log In with Google      Sign In   
  • Create Account


Render to texture efficiency

  • You cannot reply to this topic
4 replies to this topic

#1 gchris6810   Members   -  Reputation: 207

Like
0Likes
Like

Posted 09 June 2014 - 01:06 PM

Hi,

 

I am working on creating a level editor that contains 4 unique views (3 plan views and 1 3D view). I was thinking that rather than lots of context switching to update all 4 views simultaneously I could partition a single window and have all draw calls mapped to 4 textures, that could then be mapped to the relevant parts of the window. I have a few questions:

 

1. Is it possible to do this and make it look correct?

2. Is swapping between textures any faster than swapping between windows?

3. Is there a better way to do this than those I have suggested?

 

Thanks in advance.



Sponsor:

#2 Kaptein   Prime Members   -  Reputation: 1844

Like
2Likes
Like

Posted 09 June 2014 - 02:27 PM

1. Definitely

2. Probably, maybe. Yes.

3. There's a godzillion ways of doing just about anything. I think splitting a screen from a single context into 4 viewports make complete sense, and shouldn't be very complicated to do.

 

4 textures sounds good.

 

For the viewport separation, I think glViewport() can singlehandedly do all of this for you.

See: http://www.opengl.org/sdk/docs/man/docbook4/xhtml/glViewport.xml

But, I'm not completely sure. If it doesn't work that way, just use matrix-fu to align the coordinate systems correctly.


Edited by Kaptein, 09 June 2014 - 02:28 PM.


#3 swiftcoder   Senior Moderators   -  Reputation: 9612

Like
3Likes
Like

Posted 09 June 2014 - 02:30 PM


For the viewport separation, I think glViewport() can singlehandedly do all of this for you.

You'll probably need to use glScissor() as well, to avoid overwriting the other viewports.


Tristam MacDonald - Software Engineer @Amazon - [swiftcoding]


#4 gchris6810   Members   -  Reputation: 207

Like
0Likes
Like

Posted 09 June 2014 - 02:41 PM

The separate viewports option sounds like a much better idea. I'll go with that.



#5 mhagain   Crossbones+   -  Reputation: 7436

Like
1Likes
Like

Posted 09 June 2014 - 05:41 PM

If you need to draw the same geometry to different viewports you can handle all 4 in a single draw call by adding a geometry shader and writing to gl_ViewportIndex.  See http://www.ecse.rpi.edu/~wrf/wiki/ComputerGraphicsFall2013/SuperBible/SB6/code/src/multiviewport/multiviewport.cpp for some sample code.


It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.






PARTNERS