bool GraphicsContext3D::texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height, GC3Dint border, GC3Denum format, GC3Denum type, const void* pixels) { if (width && height && !pixels) { synthesizeGLError(INVALID_VALUE); return false; } GC3Denum openGLInternalFormat = internalformat; if (!isGLES2Compliant()) { if (type == GL_FLOAT) { if (format == GL_RGBA) openGLInternalFormat = GL_RGBA32F; else if (format == GL_RGB) openGLInternalFormat = GL_RGB32F; } else if (type == GL_HALF_FLOAT_OES) { if (format == GL_RGBA) openGLInternalFormat = GL_RGBA16F; else if (format == GL_RGB) openGLInternalFormat = GL_RGB16F; else if (format == GL_LUMINANCE) openGLInternalFormat = GL_LUMINANCE16F_ARB; else if (format == GL_ALPHA) openGLInternalFormat = GL_ALPHA16F_ARB; else if (format == GL_LUMINANCE_ALPHA) openGLInternalFormat = GL_LUMINANCE_ALPHA16F_ARB; type = GL_HALF_FLOAT; } } texImage2DDirect(target, level, openGLInternalFormat, width, height, border, format, type, pixels); return true; }
bool GraphicsContext3D::texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height, GC3Dint border, GC3Denum format, GC3Denum type, const void* pixels) { if (width && height && !pixels) { synthesizeGLError(INVALID_VALUE); return false; } texImage2DDirect(target, level, internalformat, width, height, border, format, type, pixels); return true; }
bool GraphicsContext3D::texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height, GC3Dint border, GC3Denum format, GC3Denum type, const void* pixels) { if (width && height && !pixels) { synthesizeGLError(INVALID_VALUE); return false; } GC3Denum openGLFormat = format; GC3Denum openGLInternalFormat = internalformat; #if !PLATFORM(IOS) if (type == GL_FLOAT) { if (format == GL_RGBA) openGLInternalFormat = GL_RGBA32F_ARB; else if (format == GL_RGB) openGLInternalFormat = GL_RGB32F_ARB; } else if (type == HALF_FLOAT_OES) { if (format == GL_RGBA) openGLInternalFormat = GL_RGBA16F_ARB; else if (format == GL_RGB) openGLInternalFormat = GL_RGB16F_ARB; else if (format == GL_LUMINANCE) openGLInternalFormat = GL_LUMINANCE16F_ARB; else if (format == GL_ALPHA) openGLInternalFormat = GL_ALPHA16F_ARB; else if (format == GL_LUMINANCE_ALPHA) openGLInternalFormat = GL_LUMINANCE_ALPHA16F_ARB; type = GL_HALF_FLOAT_ARB; } ASSERT(format != Extensions3D::SRGB8_ALPHA8_EXT); if (format == Extensions3D::SRGB_ALPHA_EXT) openGLFormat = GL_RGBA; else if (format == Extensions3D::SRGB_EXT) openGLFormat = GL_RGB; #endif texImage2DDirect(target, level, openGLInternalFormat, width, height, border, openGLFormat, type, pixels); return true; }