MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / resolveTo

Method resolveTo

Engine/source/gfx/gl/gfxGLWindowTarget.cpp:83–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81}
82
83void GFXGLWindowTarget::resolveTo(GFXTextureObject* obj)
84{
85 AssertFatal(dynamic_cast<GFXGLTextureObject*>(obj), "GFXGLTextureTarget::resolveTo - Incorrect type of texture, expected a GFXGLTextureObject");
86 GFXGLTextureObject* glTexture = static_cast<GFXGLTextureObject*>(obj);
87
88 if( GFXGL->mCapabilities.copyImage )
89 {
90 if(mBackBufferColorTex.getWidth() == glTexture->getWidth()
91 && mBackBufferColorTex.getHeight() == glTexture->getHeight()
92 && mBackBufferColorTex.getFormat() == glTexture->getFormat())
93 {
94 glCopyImageSubData(
95 static_cast<GFXGLTextureObject*>(mBackBufferColorTex.getPointer())->getHandle(), GL_TEXTURE_2D, 0, 0, 0, 0,
96 glTexture->getHandle(), GL_TEXTURE_2D, 0, 0, 0, 0,
97 getSize().x, getSize().y, 1);
98 return;
99 }
100 }
101
102 PRESERVE_FRAMEBUFFER();
103
104 if(!mCopyFBO)
105 {
106 glGenFramebuffers(1, &mCopyFBO);
107 }
108
109 glBindFramebuffer(GL_DRAW_FRAMEBUFFER, mCopyFBO);
110 glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, glTexture->getHandle(), 0);
111
112 glBindFramebuffer(GL_READ_FRAMEBUFFER, mBackBufferFBO);
113
114 glBlitFramebuffer(0, 0, getSize().x, getSize().y,
115 0, 0, glTexture->getWidth(), glTexture->getHeight(), GL_COLOR_BUFFER_BIT, GL_NEAREST);
116}
117
118inline void GFXGLWindowTarget::_setupAttachments()
119{

Callers

nothing calls this directly

Calls 6

getSizeFunction · 0.85
getWidthMethod · 0.45
getHeightMethod · 0.45
getFormatMethod · 0.45
getHandleMethod · 0.45
getPointerMethod · 0.45

Tested by

no test coverage detected