comparison Framework/OpenGL/OpenGLTexture.cpp @ 1045:6a9300ecfa13

tests for context loss are now restricted to WebAssembly
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 09 Oct 2019 17:17:56 +0200
parents 1091b2adeb5a
children 2d8ab34c8c91
comparison
equal deleted inserted replaced
1044:b60d70e8b55c 1045:6a9300ecfa13
33 , height_(0) 33 , height_(0)
34 , context_(context) 34 , context_(context)
35 { 35 {
36 if (!context_.IsContextLost()) 36 if (!context_.IsContextLost())
37 { 37 {
38 // context is made current externally. Let's check this!
39 ORTHANC_CHECK_CURRENT_CONTEXT(context_);
40 // Generate a texture object 38 // Generate a texture object
41 glGenTextures(1, &texture_); 39 glGenTextures(1, &texture_);
42 if (texture_ == 0) 40 if (texture_ == 0)
43 { 41 {
44 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError, 42 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError,
51 { 49 {
52 try 50 try
53 { 51 {
54 if (!context_.IsContextLost()) 52 if (!context_.IsContextLost())
55 { 53 {
56 // context is made current externally. Let's check this!
57 ORTHANC_CHECK_CURRENT_CONTEXT(context_);
58 assert(texture_ != 0); 54 assert(texture_ != 0);
59 ORTHANC_OPENGL_TRACE_CURRENT_CONTEXT("About to call glDeleteTextures"); 55 ORTHANC_OPENGL_TRACE_CURRENT_CONTEXT("About to call glDeleteTextures");
60 glDeleteTextures(1, &texture_); 56 glDeleteTextures(1, &texture_);
61 } 57 }
62 } 58 }
82 } 78 }
83 79
84 void OpenGLTexture::Load(const Orthanc::ImageAccessor& image, 80 void OpenGLTexture::Load(const Orthanc::ImageAccessor& image,
85 bool isLinearInterpolation) 81 bool isLinearInterpolation)
86 { 82 {
87 // context is made current externally. Let's check this!
88 ORTHANC_CHECK_CURRENT_CONTEXT(context_);
89 if (!context_.IsContextLost()) 83 if (!context_.IsContextLost())
90 { 84 {
91 glPixelStorei(GL_UNPACK_ALIGNMENT, 1); // Disable byte-alignment restriction 85 glPixelStorei(GL_UNPACK_ALIGNMENT, 1); // Disable byte-alignment restriction
92 86
93 if (image.GetPitch() != image.GetBytesPerPixel() * image.GetWidth()) 87 if (image.GetPitch() != image.GetBytesPerPixel() * image.GetWidth())