Render to texture efficiency

Started by
3 comments, last by 21st Century Moose 9 years, 11 months ago

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.

Advertisement

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.


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. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

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

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.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

This topic is closed to new replies.

Advertisement