@@ -770,7 +770,7 @@ OpenGLRendererPCem::OpenGLRendererPCem(QWidget *parent)
770
770
771
771
parentWidget = parent;
772
772
773
- source.setRect (0 , 0 , 2048 , 2048 );
773
+ source.setRect (0 , 0 , 100 , 100 );
774
774
isInitialized = false ;
775
775
isFinalized = false ;
776
776
}
@@ -1075,11 +1075,18 @@ OpenGLRendererPCem::onBlit(int buf_idx, int x, int y, int w, int h)
1075
1075
destination.width () * devicePixelRatio (),
1076
1076
destination.height () * devicePixelRatio ());
1077
1077
#endif
1078
+
1079
+ if (source.width () != w || source.height () != h) {
1080
+ glw.glBindTexture (GL_TEXTURE_2D, scene_texture.id );
1081
+ glw.glTexImage2D (GL_TEXTURE_2D, 0 , (GLenum) QOpenGLTexture::RGBA8_UNorm, w, h, 0 , (GLenum) QOpenGLTexture::BGRA, (GLenum) QOpenGLTexture::UInt32_RGBA8_Rev, NULL );
1082
+ glw.glBindTexture (GL_TEXTURE_2D, 0 );
1083
+ }
1084
+
1078
1085
source.setRect (x, y, w, h);
1079
1086
1080
1087
glw.glBindTexture (GL_TEXTURE_2D, scene_texture.id );
1081
1088
glw.glPixelStorei (GL_UNPACK_ROW_LENGTH, 2048 );
1082
- glw.glTexSubImage2D (GL_TEXTURE_2D, 0 , x, y , w, h, (GLenum) QOpenGLTexture::BGRA, (GLenum) QOpenGLTexture::UInt32_RGBA8_Rev, (const void *) ((uintptr_t ) imagebufs[buf_idx].get () + (uintptr_t ) (2048 * 4 * y + x * 4 )));
1089
+ glw.glTexSubImage2D (GL_TEXTURE_2D, 0 , 0 , 0 , w, h, (GLenum) QOpenGLTexture::BGRA, (GLenum) QOpenGLTexture::UInt32_RGBA8_Rev, (const void *) ((uintptr_t ) imagebufs[buf_idx].get () + (uintptr_t ) (2048 * 4 * y + x * 4 )));
1083
1090
glw.glPixelStorei (GL_UNPACK_ROW_LENGTH, 0 );
1084
1091
glw.glBindTexture (GL_TEXTURE_2D, 0 );
1085
1092
@@ -1369,10 +1376,10 @@ OpenGLRendererPCem::render()
1369
1376
pass->state .tex_coords [7 ] = maxy;
1370
1377
1371
1378
// create input tex coords
1372
- minx = video_rect. x / 2048 . f ;
1373
- miny = video_rect. y / 2048 . f ;
1374
- maxx = (video_rect. x + video_rect. w ) / ( float ) 2048 . f ;
1375
- maxy = (video_rect. y + video_rect. h ) / ( float ) 2048 . f ;
1379
+ minx = 0 ;
1380
+ miny = 0 ;
1381
+ maxx = 1 ;
1382
+ maxy = 1 ;
1376
1383
1377
1384
GLfloat tex_coords[] = { minx, miny, minx, maxy, maxx, miny, maxx, maxy };
1378
1385
0 commit comments