@@ -311,16 +311,16 @@ namespace ouzel
311
311
if (!levels[level].data .empty ())
312
312
{
313
313
glTexImage2DProc (GL_TEXTURE_2D, static_cast <GLint>(level), static_cast <GLint>(oglInternalPixelFormat),
314
- static_cast <GLsizei>(levels[level].size .width ),
315
- static_cast <GLsizei>(levels[level].size .height ), 0 ,
316
- oglPixelFormat, oglPixelType, levels[level].data .data ());
314
+ static_cast <GLsizei>(levels[level].size .width ),
315
+ static_cast <GLsizei>(levels[level].size .height ), 0 ,
316
+ oglPixelFormat, oglPixelType, levels[level].data .data ());
317
317
}
318
318
else
319
319
{
320
320
glTexImage2DProc (GL_TEXTURE_2D, static_cast <GLint>(level), static_cast <GLint>(oglInternalPixelFormat),
321
- static_cast <GLsizei>(levels[level].size .width ),
322
- static_cast <GLsizei>(levels[level].size .height ), 0 ,
323
- oglPixelFormat, oglPixelType, nullptr );
321
+ static_cast <GLsizei>(levels[level].size .width ),
322
+ static_cast <GLsizei>(levels[level].size .height ), 0 ,
323
+ oglPixelFormat, oglPixelType, nullptr );
324
324
}
325
325
}
326
326
@@ -352,10 +352,10 @@ namespace ouzel
352
352
if (!levels[level].data .empty ())
353
353
{
354
354
glTexSubImage2DProc (GL_TEXTURE_2D, static_cast <GLint>(level), 0 , 0 ,
355
- static_cast <GLsizei>(levels[level].size .width ),
356
- static_cast <GLsizei>(levels[level].size .height ),
357
- oglPixelFormat, oglPixelType,
358
- levels[level].data .data ());
355
+ static_cast <GLsizei>(levels[level].size .width ),
356
+ static_cast <GLsizei>(levels[level].size .height ),
357
+ oglPixelFormat, oglPixelType,
358
+ levels[level].data .data ());
359
359
}
360
360
}
361
361
@@ -596,11 +596,14 @@ namespace ouzel
596
596
renderDevice.bindTexture (textureId, 0 );
597
597
598
598
glTexImage2DProc (GL_TEXTURE_2D, 0 , static_cast <GLint>(oglInternalPixelFormat),
599
- width, height, 0 ,
600
- oglPixelFormat, oglPixelType, nullptr );
599
+ width, height, 0 ,
600
+ oglPixelFormat, oglPixelType, nullptr );
601
601
602
602
// TODO: blit multisample render buffer to texture
603
603
glFramebufferTexture2DProc (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureId, 0 );
604
+
605
+ if ((error = glGetErrorProc ()) != GL_NO_ERROR)
606
+ throw DataError (" Failed to set frame buffer's color texture, error: " + std::to_string (error));
604
607
}
605
608
else
606
609
{
@@ -610,17 +613,26 @@ namespace ouzel
610
613
if (sampleCount > 1 && renderDevice.isMultisamplingSupported ())
611
614
{
612
615
glRenderbufferStorageMultisampleProc (GL_RENDERBUFFER,
613
- static_cast <GLsizei>(sampleCount),
614
- oglInternalPixelFormat,
615
- width, height);
616
+ static_cast <GLsizei>(sampleCount),
617
+ oglInternalPixelFormat,
618
+ width, height);
619
+
620
+ if ((error = glGetErrorProc ()) != GL_NO_ERROR)
621
+ throw DataError (" Failed to set color render buffer's multisample storage, error: " + std::to_string (error));
616
622
}
617
623
else
618
624
{
619
625
glRenderbufferStorageProc (GL_RENDERBUFFER, oglInternalPixelFormat,
620
- width, height);
626
+ width, height);
627
+
628
+ if ((error = glGetErrorProc ()) != GL_NO_ERROR)
629
+ throw DataError (" Failed to set color render buffer's storage, error: " + std::to_string (error));
621
630
}
622
631
623
632
glFramebufferRenderbufferProc (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, colorBufferId);
633
+
634
+ if ((error = glGetErrorProc ()) != GL_NO_ERROR)
635
+ throw DataError (" Failed to set frame buffer's color render buffer, error: " + std::to_string (error));
624
636
}
625
637
626
638
if (flags & Texture::DEPTH_BUFFER)
@@ -632,9 +644,12 @@ namespace ouzel
632
644
renderDevice.bindTexture (depthTextureId, 0 );
633
645
634
646
glTexImage2DProc (GL_TEXTURE_2D, 0 , GL_DEPTH_COMPONENT24,
635
- width, height, 0 ,GL_DEPTH_COMPONENT, GL_FLOAT, nullptr );
647
+ width, height, 0 ,GL_DEPTH_COMPONENT, GL_FLOAT, nullptr );
636
648
637
649
glFramebufferTexture2DProc (GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depthTextureId, 0 );
650
+
651
+ if ((error = glGetErrorProc ()) != GL_NO_ERROR)
652
+ throw DataError (" Failed to set frame buffer's depth texture, error: " + std::to_string (error));
638
653
}
639
654
else
640
655
{
@@ -644,17 +659,26 @@ namespace ouzel
644
659
if (sampleCount > 1 && renderDevice.isMultisamplingSupported ())
645
660
{
646
661
glRenderbufferStorageMultisampleProc (GL_RENDERBUFFER,
647
- static_cast <GLsizei>(sampleCount),
648
- GL_DEPTH_COMPONENT,
649
- width, height);
662
+ static_cast <GLsizei>(sampleCount),
663
+ GL_DEPTH_COMPONENT24,
664
+ width, height);
665
+
666
+ if ((error = glGetErrorProc ()) != GL_NO_ERROR)
667
+ throw DataError (" Failed to set depth render buffer's multisample storage, error: " + std::to_string (error));
650
668
}
651
669
else
652
670
{
653
- glRenderbufferStorageProc (GL_RENDERBUFFER, GL_DEPTH_COMPONENT,
654
- width, height);
671
+ glRenderbufferStorageProc (GL_RENDERBUFFER, GL_DEPTH_COMPONENT24,
672
+ width, height);
673
+
674
+ if ((error = glGetErrorProc ()) != GL_NO_ERROR)
675
+ throw DataError (" Failed to set depth render buffer's storage, error: " + std::to_string (error));
655
676
}
656
677
657
678
glFramebufferRenderbufferProc (GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depthBufferId);
679
+
680
+ if ((error = glGetErrorProc ()) != GL_NO_ERROR)
681
+ throw DataError (" Failed to set frame buffer's depth render buffer, error: " + std::to_string (error));
658
682
}
659
683
}
660
684
0 commit comments