void CubeMapTextureGLTest::imageFull() { if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::direct_state_access>()) CORRADE_SKIP(Extensions::GL::ARB::direct_state_access::string() + std::string(" is not supported.")); CubeMapTexture texture; texture.setStorage(1, TextureFormat::RGBA8, Vector2i{2, 2}) .setSubImage(0, {}, ImageReference3D{ColorFormat::RGBA, ColorType::UnsignedByte, Vector3i{2, 2, 6}, DataFull}); MAGNUM_VERIFY_NO_ERROR(); Image3D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte}); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(image.size(), Vector3i(2, 2, 6)); CORRADE_COMPARE_AS( Containers::ArrayReference<const UnsignedByte>(image.data<UnsignedByte>(), image.pixelSize()*image.size().product()), Containers::ArrayReference<const UnsignedByte>{DataFull}, TestSuite::Compare::Container); }
void CubeMapTextureGLTest::subImageQuery() { if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::get_texture_sub_image>()) CORRADE_SKIP(Extensions::GL::ARB::get_texture_sub_image::string() + std::string(" is not supported.")); /* I'm too lazy to call setSubImage() six times */ if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::direct_state_access>()) CORRADE_SKIP(Extensions::GL::ARB::direct_state_access::string() + std::string(" is not supported.")); CubeMapTexture texture; texture.setStorage(1, TextureFormat::RGBA8, Vector2i{4}) .setSubImage(0, {}, ImageReference3D{ColorFormat::RGBA, ColorType::UnsignedByte, {4, 4, 1}, SubDataComplete}); MAGNUM_VERIFY_NO_ERROR(); Image3D image = texture.subImage(0, Range3Di::fromSize({1, 1, 0}, {2, 2, 1}), {ColorFormat::RGBA, ColorType::UnsignedByte}); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(image.size(), Vector3i(2, 2, 1)); CORRADE_COMPARE_AS( Containers::ArrayReference<const UnsignedByte>(image.data<UnsignedByte>(), image.pixelSize()*image.size().product()), Containers::ArrayReference<const UnsignedByte>{Data}, TestSuite::Compare::Container); }