~ubuntu-branches/ubuntu/trusty/psychtoolbox-3/trusty-proposed

« back to all changes in this revision

Viewing changes to PsychSourceGL/Source/Common/Screen/SCREENCopyWindow.c

  • Committer: Package Import Robot
  • Author(s): Yaroslav Halchenko
  • Date: 2013-11-19 23:34:50 UTC
  • mfrom: (3.1.4 experimental)
  • Revision ID: package-import@ubuntu.com-20131119233450-f7nf92vb8qavjmk8
Tags: 3.0.11.20131017.dfsg1-3
Upload to unsable since fresh glew has arrived to sid!

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
 
42
42
PsychError SCREENCopyWindow(void) 
43
43
{
44
 
        PsychRectType                   sourceRect, targetRect, targetRectInverted;
 
44
        PsychRectType                   sourceRect, targetRect;
45
45
        PsychWindowRecordType   *sourceWin, *targetWin;
46
 
        GLdouble                                sourceVertex[2], targetVertex[2]; 
47
 
        double                                  t1;
48
 
        double                                  sourceRectWidth, sourceRectHeight;
49
46
        GLuint                                  srcFBO, dstFBO;
50
47
        GLenum                                  glerr;
51
48
        
151
148
 
152
149
                // Perform blit-operation: If blitting from a multisampled FBO into a non-multisampled one, this will also perform the
153
150
                // multisample resolve operation:
154
 
                glBlitFramebufferEXT(sourceRect[kPsychLeft], PsychGetHeightFromRect(sourceWin->rect) - sourceRect[kPsychBottom], sourceRect[kPsychRight], PsychGetHeightFromRect(sourceWin->rect) - sourceRect[kPsychTop],
155
 
                                                         targetRect[kPsychLeft], PsychGetHeightFromRect(targetWin->rect) - targetRect[kPsychBottom], targetRect[kPsychRight], PsychGetHeightFromRect(targetWin->rect) - targetRect[kPsychTop],
 
151
                glBlitFramebufferEXT((GLint) sourceRect[kPsychLeft], (GLint) (PsychGetHeightFromRect(sourceWin->rect) - sourceRect[kPsychBottom]), (GLint) sourceRect[kPsychRight], (GLint) (PsychGetHeightFromRect(sourceWin->rect) - sourceRect[kPsychTop]),
 
152
                                                         (GLint) targetRect[kPsychLeft], (GLint) (PsychGetHeightFromRect(targetWin->rect) - targetRect[kPsychBottom]), (GLint) targetRect[kPsychRight], (GLint) (PsychGetHeightFromRect(targetWin->rect) - targetRect[kPsychTop]),
156
153
                                                         GL_COLOR_BUFFER_BIT, GL_NEAREST);
157
154
 
158
155
                if (PsychPrefStateGet_Verbosity() > 5) {
221
218
                        PsychSetShader(targetWin, 0);
222
219
 
223
220
                        // Start position for pixel write is:
224
 
                        glRasterPos2f(targetRect[kPsychLeft], targetRect[kPsychBottom]);
 
221
                        glRasterPos2f((float) targetRect[kPsychLeft], (float) targetRect[kPsychBottom]);
225
222
                        
226
223
                        // Zoom factor if rectangle sizes don't match:
227
 
                        glPixelZoom(PsychGetWidthFromRect(targetRect) / PsychGetWidthFromRect(sourceRect), PsychGetHeightFromRect(targetRect) / PsychGetHeightFromRect(sourceRect));
 
224
                        glPixelZoom((float) (PsychGetWidthFromRect(targetRect) / PsychGetWidthFromRect(sourceRect)), (float) (PsychGetHeightFromRect(targetRect) / PsychGetHeightFromRect(sourceRect)));
228
225
                        
229
226
                        // Perform pixel copy operation:
230
 
                        glCopyPixels(sourceRect[kPsychLeft], PsychGetHeightFromRect(sourceWin->rect) - sourceRect[kPsychBottom], (int) PsychGetWidthFromRect(sourceRect), (int) PsychGetHeightFromRect(sourceRect), GL_COLOR);
 
227
                        glCopyPixels((int) sourceRect[kPsychLeft], (int) (PsychGetHeightFromRect(sourceWin->rect) - sourceRect[kPsychBottom]), (int) PsychGetWidthFromRect(sourceRect), (int) PsychGetHeightFromRect(sourceRect), GL_COLOR);
231
228
                        
232
229
                        // That's it.
233
230
                        glPixelZoom(1,1);
281
278
                glBindTexture(PsychGetTextureTarget(targetWin), targetWin->textureNumber);
282
279
                
283
280
                // Copy into texture:
284
 
                glCopyTexSubImage2D(PsychGetTextureTarget(targetWin), 0, targetRect[kPsychLeft], PsychGetHeightFromRect(targetWin->rect) - targetRect[kPsychBottom], sourceRect[kPsychLeft], PsychGetHeightFromRect(sourceWin->rect) - sourceRect[kPsychBottom],
 
281
                glCopyTexSubImage2D(PsychGetTextureTarget(targetWin), 0, (int) targetRect[kPsychLeft], (int) (PsychGetHeightFromRect(targetWin->rect) - targetRect[kPsychBottom]), (int) sourceRect[kPsychLeft], (int) (PsychGetHeightFromRect(sourceWin->rect) - sourceRect[kPsychBottom]),
285
282
                                                        (int) PsychGetWidthFromRect(sourceRect), (int) PsychGetHeightFromRect(sourceRect));
286
283
                
287
284
                // Unbind texture object:
307
304
                PsychSetShader(targetWin, 0);
308
305
 
309
306
                // Start position for pixel write is:
310
 
                glRasterPos2f(targetRect[kPsychLeft], targetRect[kPsychBottom]);
 
307
                glRasterPos2f((float) targetRect[kPsychLeft], (float) targetRect[kPsychBottom]);
311
308
                
312
309
                // Zoom factor if rectangle sizes don't match:
313
 
                glPixelZoom(PsychGetWidthFromRect(targetRect) / PsychGetWidthFromRect(sourceRect), PsychGetHeightFromRect(targetRect) / PsychGetHeightFromRect(sourceRect));
 
310
                glPixelZoom((float) (PsychGetWidthFromRect(targetRect) / PsychGetWidthFromRect(sourceRect)), (float) (PsychGetHeightFromRect(targetRect) / PsychGetHeightFromRect(sourceRect)));
314
311
                
315
312
                // Perform pixel copy operation:
316
 
                glCopyPixels(sourceRect[kPsychLeft], PsychGetHeightFromRect(sourceWin->rect) - sourceRect[kPsychBottom], (int) PsychGetWidthFromRect(sourceRect), (int) PsychGetHeightFromRect(sourceRect), GL_COLOR);
 
313
                glCopyPixels((int) sourceRect[kPsychLeft], (int) (PsychGetHeightFromRect(sourceWin->rect) - sourceRect[kPsychBottom]), (int) PsychGetWidthFromRect(sourceRect), (int) PsychGetHeightFromRect(sourceRect), GL_COLOR);
317
314
                
318
315
                // That's it.
319
316
                glPixelZoom(1,1);