already_AddRefed<gfxImageSurface> SharedDeprecatedTextureHostOGL::GetAsSurface() { nsRefPtr<gfxImageSurface> surf = IsValid() ? mGL->GetTexImage(GetTextureHandle(), false, GetFormat()) : nullptr; return surf.forget(); }
//----------------------------------------------------------------------- void GraphicsContextGL4::SetTexture(int textureUnit, RenderTarget2D & textureIn) { POMDOG_ASSERT(!textures.empty()); POMDOG_ASSERT(textureUnit >= 0); POMDOG_ASSERT(textureUnit < static_cast<int>(textures.size())); constexpr GLenum textureType = GL_TEXTURE_2D; if (textures[textureUnit] && *textures[textureUnit] != textureType) { // Unbind texture SetTexture(textureUnit); } textures[textureUnit] = textureType; POMDOG_ASSERT(textureIn.NativeRenderTarget2D()); auto renderTargetGL4 = dynamic_cast<RenderTarget2DGL4*>(textureIn.NativeRenderTarget2D()); POMDOG_ASSERT(renderTargetGL4 != nullptr); ApplyTexture2D(textureUnit, renderTargetGL4->GetTextureHandle()); }
Texture::~Texture() { unsigned int textureID = 0; textureID = GetTextureHandle(); glDeleteTextures( 1, &textureID ); }