equal
deleted
inserted
replaced
87 |
87 |
88 if (m_previousFBO != m_thisFBO) { |
88 if (m_previousFBO != m_thisFBO) { |
89 ctx->d_ptr->current_fbo = m_thisFBO; |
89 ctx->d_ptr->current_fbo = m_thisFBO; |
90 glBindFramebuffer(GL_FRAMEBUFFER_EXT, m_thisFBO); |
90 glBindFramebuffer(GL_FRAMEBUFFER_EXT, m_thisFBO); |
91 } |
91 } |
|
92 |
|
93 // Set the default fbo for the context to m_thisFBO so that |
|
94 // if some raw GL code between beginNativePainting() and |
|
95 // endNativePainting() calls QGLFramebufferObject::release(), |
|
96 // painting will revert to the window surface's fbo. |
|
97 ctx->d_ptr->default_fbo = m_thisFBO; |
92 } |
98 } |
93 |
99 |
94 void QGLPaintDevice::ensureActiveTarget() |
100 void QGLPaintDevice::ensureActiveTarget() |
95 { |
101 { |
96 QGLContext* ctx = context(); |
102 QGLContext* ctx = context(); |
99 |
105 |
100 if (ctx->d_ptr->current_fbo != m_thisFBO) { |
106 if (ctx->d_ptr->current_fbo != m_thisFBO) { |
101 ctx->d_ptr->current_fbo = m_thisFBO; |
107 ctx->d_ptr->current_fbo = m_thisFBO; |
102 glBindFramebuffer(GL_FRAMEBUFFER_EXT, m_thisFBO); |
108 glBindFramebuffer(GL_FRAMEBUFFER_EXT, m_thisFBO); |
103 } |
109 } |
|
110 |
|
111 ctx->d_ptr->default_fbo = m_thisFBO; |
104 } |
112 } |
105 |
113 |
106 void QGLPaintDevice::endPaint() |
114 void QGLPaintDevice::endPaint() |
107 { |
115 { |
108 // Make sure the FBO bound at beginPaint is re-bound again here: |
116 // Make sure the FBO bound at beginPaint is re-bound again here: |
109 QGLContext *ctx = context(); |
117 QGLContext *ctx = context(); |
110 if (m_previousFBO != ctx->d_func()->current_fbo) { |
118 if (m_previousFBO != ctx->d_func()->current_fbo) { |
111 ctx->d_ptr->current_fbo = m_previousFBO; |
119 ctx->d_ptr->current_fbo = m_previousFBO; |
112 glBindFramebuffer(GL_FRAMEBUFFER_EXT, m_previousFBO); |
120 glBindFramebuffer(GL_FRAMEBUFFER_EXT, m_previousFBO); |
113 } |
121 } |
|
122 |
|
123 ctx->d_ptr->default_fbo = 0; |
114 } |
124 } |
115 |
125 |
116 QGLFormat QGLPaintDevice::format() const |
126 QGLFormat QGLPaintDevice::format() const |
117 { |
127 { |
118 return context()->format(); |
128 return context()->format(); |