开发者

Is there a fast way to grab an area of an OpenGL-ES scene and render that area as a picture-in-picture?

I have a bunch of game elements being drawn to the screen with OpenGL-ES and I'd like to be able to render a small rectangle in the bottom corner of the screen that shows, say, what's presently being displayed in the top left quarter of the screen.

In that way it's similar to a picture-in-picture from a tv, only the smaller picture would be showing part of the same thing the bigger picture is showing.

I'm comfortable with scaling in OpenGL-ES, but what I don't know how to do is get the proper rectangle of renderbuffer data and use that chunk as the data for an inset frame buffer for the next render pass. I imagine there's some trick along these lines to do this efficiently.

I've tried re-rendering the game elements at a smaller scale for this inset window and it just seems horribly inefficient 开发者_StackOverflowwhen the data is already elsewhere and just needs to be scaled down a bit.

I'm not sure I'm asking this clearly or in the right terms, So any and all illumination is welcome and appreciated - especially examples. Thank you!


Have a look at glCopyTexImage2D. It lets you copy a portion of the framebuffer into a texture. So the order of operation would be:

  1. Draw your scene normally
  2. Bind your picture-in-picture texture
  3. glCopyTexImage2D
  4. Draw a quad with that texture in the bottom corner
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜