From 7ffd1851ddf98c9da3077c63cfa611d74438639d Mon Sep 17 00:00:00 2001 From: domrjchen Date: Thu, 24 Feb 2022 14:22:46 +0800 Subject: [PATCH 1/2] Change the consts in GLDefines.h from GL::XXX to GL_XXX. --- src/platform/android/VideoSurface.cpp | 2 +- src/platform/web/VideoSequenceReader.cpp | 2 +- src/rendering/filters/CornerPinFilter.cpp | 10 +- .../filters/DisplacementMapFilter.cpp | 2 +- src/rendering/filters/LayerFilter.cpp | 30 +- src/rendering/filters/MotionBlurFilter.cpp | 4 +- .../filters/glow/GlowMergeFilter.cpp | 2 +- test/GLUtilTest.cpp | 12 +- tgfx/src/core/vectors/web/WebMask.cpp | 3 +- .../gpu/opengl/GLAssembledWebGLInterface.cpp | 4 +- tgfx/src/gpu/opengl/GLBlend.cpp | 50 +- tgfx/src/gpu/opengl/GLBuffer.cpp | 8 +- tgfx/src/gpu/opengl/GLCaps.cpp | 58 +- tgfx/src/gpu/opengl/GLDefines.h | 1474 ++++++++--------- tgfx/src/gpu/opengl/GLDrawer.cpp | 40 +- tgfx/src/gpu/opengl/GLInterface.cpp | 2 +- tgfx/src/gpu/opengl/GLProgram.cpp | 2 +- tgfx/src/gpu/opengl/GLProgramDataManager.cpp | 2 +- tgfx/src/gpu/opengl/GLRenderTarget.cpp | 60 +- tgfx/src/gpu/opengl/GLState.cpp | 210 +-- tgfx/src/gpu/opengl/GLSurface.cpp | 4 +- tgfx/src/gpu/opengl/GLTexture.cpp | 12 +- tgfx/src/gpu/opengl/GLUniformHandler.cpp | 4 +- tgfx/src/gpu/opengl/GLUtil.cpp | 65 +- tgfx/src/gpu/opengl/GLYUVTexture.cpp | 2 +- .../gpu/opengl/eagl/EAGLHardwareTexture.mm | 12 +- tgfx/src/gpu/opengl/eagl/EAGLNV12Texture.mm | 8 +- tgfx/src/gpu/opengl/eagl/EAGLWindow.mm | 22 +- tgfx/src/gpu/opengl/webgl/WebGLWindow.cpp | 10 +- tgfx/src/platform/web/NativeTextureBuffer.cpp | 3 +- web/src/pag_wasm_bindings.cpp | 6 +- 31 files changed, 1063 insertions(+), 1062 deletions(-) diff --git a/src/platform/android/VideoSurface.cpp b/src/platform/android/VideoSurface.cpp index 311cc96268..e2cccc171a 100644 --- a/src/platform/android/VideoSurface.cpp +++ b/src/platform/android/VideoSurface.cpp @@ -164,7 +164,7 @@ bool VideoSurface::attachToContext(JNIEnv* env, tgfx::Context* context) { } auto gl = tgfx::GLContext::Unwrap(context); tgfx::GLSampler sampler = {}; - sampler.target = GL::TEXTURE_EXTERNAL_OES; + sampler.target = GL_TEXTURE_EXTERNAL_OES; sampler.format = tgfx::PixelFormat::RGBA_8888; gl->genTextures(1, &sampler.id); if (sampler.id == 0) { diff --git a/src/platform/web/VideoSequenceReader.cpp b/src/platform/web/VideoSequenceReader.cpp index d1d7d02ac1..f30348c06e 100644 --- a/src/platform/web/VideoSequenceReader.cpp +++ b/src/platform/web/VideoSequenceReader.cpp @@ -85,7 +85,7 @@ std::shared_ptr VideoSequenceReader::readTexture(Frame targetFram if (texture == nullptr) { texture = tgfx::GLTexture::MakeRGBA(cache->getContext(), width, height); } - auto& glInfo = std::static_pointer_cast(texture)->getGLInfo(); + auto& glInfo = std::static_pointer_cast(texture)->glSampler(); videoReader.call("renderToTexture", val::module_property("GL"), glInfo.id); lastFrame = targetFrame; return texture; diff --git a/src/rendering/filters/CornerPinFilter.cpp b/src/rendering/filters/CornerPinFilter.cpp index 12357c55f3..61b560b81c 100644 --- a/src/rendering/filters/CornerPinFilter.cpp +++ b/src/rendering/filters/CornerPinFilter.cpp @@ -143,15 +143,15 @@ void CornerPinFilter::bindVertices(const tgfx::GLInterface* gl, const FilterSour if (filterProgram->vertexArray > 0) { gl->bindVertexArray(filterProgram->vertexArray); } - gl->bindBuffer(GL::ARRAY_BUFFER, filterProgram->vertexBuffer); - gl->bufferData(GL::ARRAY_BUFFER, vertices.size() * sizeof(float), &vertices[0], GL::STREAM_DRAW); - gl->vertexAttribPointer(static_cast(positionHandle), 2, GL::FLOAT, GL::FALSE, + gl->bindBuffer(GL_ARRAY_BUFFER, filterProgram->vertexBuffer); + gl->bufferData(GL_ARRAY_BUFFER, vertices.size() * sizeof(float), &vertices[0], GL_STREAM_DRAW); + gl->vertexAttribPointer(static_cast(positionHandle), 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), static_cast(0)); gl->enableVertexAttribArray(static_cast(positionHandle)); - gl->vertexAttribPointer(textureCoordHandle, 3, GL::FLOAT, GL::FALSE, 5 * sizeof(float), + gl->vertexAttribPointer(textureCoordHandle, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), reinterpret_cast(2 * sizeof(float))); gl->enableVertexAttribArray(textureCoordHandle); - gl->bindBuffer(GL::ARRAY_BUFFER, 0); + gl->bindBuffer(GL_ARRAY_BUFFER, 0); } } // namespace pag diff --git a/src/rendering/filters/DisplacementMapFilter.cpp b/src/rendering/filters/DisplacementMapFilter.cpp index f66ebf7bbe..b82130185e 100644 --- a/src/rendering/filters/DisplacementMapFilter.cpp +++ b/src/rendering/filters/DisplacementMapFilter.cpp @@ -121,7 +121,7 @@ void DisplacementMapFilter::onUpdateParams(const tgfx::GLInterface* gl, const tgfx::Rect& contentBounds, const tgfx::Point&) { auto* pagEffect = reinterpret_cast(effect); auto mapTextureID = GetTextureID(mapSurface->getTexture().get()); - ActiveGLTexture(gl, GL::TEXTURE1, GL::TEXTURE_2D, mapTextureID); + ActiveGLTexture(gl, GL_TEXTURE1, GL_TEXTURE_2D, mapTextureID); gl->uniform2f(useForDisplacementHandle, pagEffect->useForHorizontalDisplacement->getValueAt(layerFrame), pagEffect->useForVerticalDisplacement->getValueAt(layerFrame)); diff --git a/src/rendering/filters/LayerFilter.cpp b/src/rendering/filters/LayerFilter.cpp index e0532db3d7..8a10551c83 100644 --- a/src/rendering/filters/LayerFilter.cpp +++ b/src/rendering/filters/LayerFilter.cpp @@ -205,13 +205,13 @@ void LayerFilter::update(Frame frame, const tgfx::Rect& inputBounds, const tgfx: static void EnableMultisample(const tgfx::GLInterface* gl, bool usesMSAA) { if (usesMSAA && gl->caps->multisampleDisableSupport) { - gl->enable(GL::MULTISAMPLE); + gl->enable(GL_MULTISAMPLE); } } static void DisableMultisample(const tgfx::GLInterface* gl, bool usesMSAA) { if (usesMSAA && gl->caps->multisampleDisableSupport) { - gl->disable(GL::MULTISAMPLE); + gl->disable(GL_MULTISAMPLE); } } @@ -226,19 +226,19 @@ void LayerFilter::draw(tgfx::Context* context, const FilterSource* source, auto gl = tgfx::GLContext::Unwrap(context); EnableMultisample(gl, needsMSAA()); gl->useProgram(filterProgram->program); - gl->enable(GL::BLEND); - gl->blendEquation(GL::FUNC_ADD); - gl->blendFunc(GL::ONE, GL::ONE_MINUS_SRC_ALPHA); - gl->bindFramebuffer(GL::FRAMEBUFFER, target->frameBufferID); + gl->enable(GL_BLEND); + gl->blendEquation(GL_FUNC_ADD); + gl->blendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + gl->bindFramebuffer(GL_FRAMEBUFFER, target->frameBufferID); gl->viewport(0, 0, target->width, target->height); - ActiveGLTexture(gl, GL::TEXTURE0, GL::TEXTURE_2D, source->textureID); - gl->uniformMatrix3fv(vertexMatrixHandle, 1, GL::FALSE, target->vertexMatrix.data()); - gl->uniformMatrix3fv(textureMatrixHandle, 1, GL::FALSE, source->textureMatrix.data()); + ActiveGLTexture(gl, GL_TEXTURE0, GL_TEXTURE_2D, source->textureID); + gl->uniformMatrix3fv(vertexMatrixHandle, 1, GL_FALSE, target->vertexMatrix.data()); + gl->uniformMatrix3fv(textureMatrixHandle, 1, GL_FALSE, source->textureMatrix.data()); onUpdateParams(gl, contentBounds, filterScale); auto vertices = computeVertices(contentBounds, transformedBounds, filterScale); bindVertices(gl, source, target, vertices); - gl->drawArrays(GL::TRIANGLE_STRIP, 0, 4); + gl->drawArrays(GL_TRIANGLE_STRIP, 0, 4); if (filterProgram->vertexArray > 0) { gl->bindVertexArray(0); } @@ -280,16 +280,16 @@ void LayerFilter::bindVertices(const tgfx::GLInterface* gl, const FilterSource* if (filterProgram->vertexArray > 0) { gl->bindVertexArray(filterProgram->vertexArray); } - gl->bindBuffer(GL::ARRAY_BUFFER, filterProgram->vertexBuffer); - gl->bufferData(GL::ARRAY_BUFFER, vertices.size() * sizeof(float), &vertices[0], GL::STREAM_DRAW); - gl->vertexAttribPointer(static_cast(positionHandle), 2, GL::FLOAT, GL::FALSE, + gl->bindBuffer(GL_ARRAY_BUFFER, filterProgram->vertexBuffer); + gl->bufferData(GL_ARRAY_BUFFER, vertices.size() * sizeof(float), &vertices[0], GL_STREAM_DRAW); + gl->vertexAttribPointer(static_cast(positionHandle), 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), static_cast(0)); gl->enableVertexAttribArray(static_cast(positionHandle)); - gl->vertexAttribPointer(textureCoordHandle, 2, GL::FLOAT, GL::FALSE, 4 * sizeof(float), + gl->vertexAttribPointer(textureCoordHandle, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), reinterpret_cast(2 * sizeof(float))); gl->enableVertexAttribArray(textureCoordHandle); - gl->bindBuffer(GL::ARRAY_BUFFER, 0); + gl->bindBuffer(GL_ARRAY_BUFFER, 0); } bool LayerFilter::needsMSAA() const { diff --git a/src/rendering/filters/MotionBlurFilter.cpp b/src/rendering/filters/MotionBlurFilter.cpp index aa3feef9e5..d6ee92d94b 100644 --- a/src/rendering/filters/MotionBlurFilter.cpp +++ b/src/rendering/filters/MotionBlurFilter.cpp @@ -138,8 +138,8 @@ void MotionBlurFilter::onUpdateParams(const tgfx::GLInterface* gl, const tgfx::R auto scaling = (previousMatrix.getScaleX() != currentMatrix.getScaleX() || previousMatrix.getScaleY() != currentMatrix.getScaleY()); - gl->uniformMatrix3fv(prevTransformHandle, 1, GL::FALSE, previousGLMatrix.data()); - gl->uniformMatrix3fv(transformHandle, 1, GL::FALSE, currentGLMatrix.data()); + gl->uniformMatrix3fv(prevTransformHandle, 1, GL_FALSE, previousGLMatrix.data()); + gl->uniformMatrix3fv(transformHandle, 1, GL_FALSE, currentGLMatrix.data()); gl->uniform1f(velCenterHandle, scaling ? 0.0f : 0.5f); gl->uniform1f(maxDistanceHandle, (MOTION_BLUR_SCALE_FACTOR - 1.0) * 0.5f); } diff --git a/src/rendering/filters/glow/GlowMergeFilter.cpp b/src/rendering/filters/glow/GlowMergeFilter.cpp index 2912333f3e..ce6df58176 100644 --- a/src/rendering/filters/glow/GlowMergeFilter.cpp +++ b/src/rendering/filters/glow/GlowMergeFilter.cpp @@ -68,6 +68,6 @@ void GlowMergeFilter::onUpdateParams(const tgfx::GLInterface* gl, const tgfx::Re // TODO(domrjchen): 下面这行之前写成了 gl->uniform1i(progressHandle, 1), 会导致 glError, // 暂时注释掉。目前的发光效果跟 AE 也没有对齐,后面重写发光效果时时再修复。 // gl->uniform1i(blurTextureHandle, 1); - ActiveGLTexture(gl, GL::TEXTURE1, GL::TEXTURE_2D, blurTextureID); + ActiveGLTexture(gl, GL_TEXTURE1, GL_TEXTURE_2D, blurTextureID); } } // namespace pag diff --git a/test/GLUtilTest.cpp b/test/GLUtilTest.cpp index f4e48b64d7..4a633fc69b 100644 --- a/test/GLUtilTest.cpp +++ b/test/GLUtilTest.cpp @@ -36,9 +36,9 @@ std::vector> vendors = { {"Imagination Technologies", GLVendor::Imagination}, }; const unsigned char* glGetStringMock(unsigned name) { - if (name == GL::VENDOR) { + if (name == GL_VENDOR) { return reinterpret_cast(vendors[i].first.c_str()); - } else if (name == GL::VERSION) { + } else if (name == GL_VERSION) { if (i != 0) { return reinterpret_cast("2.0"); } else { @@ -49,20 +49,20 @@ const unsigned char* glGetStringMock(unsigned name) { } void getIntegervMock(unsigned pname, int* params) { - if (pname == GL::MAX_TEXTURE_SIZE) { + if (pname == GL_MAX_TEXTURE_SIZE) { *params = 1024; } } void glGetInternalformativMock(unsigned target, unsigned, unsigned pname, int, int* params) { - if (target != GL::RENDERBUFFER) { + if (target != GL_RENDERBUFFER) { return; } - if (pname == GL::NUM_SAMPLE_COUNTS) { + if (pname == GL_NUM_SAMPLE_COUNTS) { *params = 2; return; } - if (pname == GL::SAMPLES) { + if (pname == GL_SAMPLES) { params[0] = 4; params[1] = 8; } diff --git a/tgfx/src/core/vectors/web/WebMask.cpp b/tgfx/src/core/vectors/web/WebMask.cpp index 64bec3e344..35dc22552c 100644 --- a/tgfx/src/core/vectors/web/WebMask.cpp +++ b/tgfx/src/core/vectors/web/WebMask.cpp @@ -19,6 +19,7 @@ #include "WebMask.h" #include "WebTextBlob.h" #include "WebTypeface.h" +#include "gpu/opengl/GLContext.h" #include "gpu/opengl/GLTexture.h" using namespace emscripten; @@ -41,7 +42,7 @@ std::shared_ptr WebMask::makeTexture(Context* context) const { if (texture == nullptr) { return nullptr; } - auto& glInfo = std::static_pointer_cast(texture)->getGLInfo(); + auto& glInfo = std::static_pointer_cast(texture)->glSampler(); const auto* gl = GLContext::Unwrap(context); gl->bindTexture(glInfo.target, glInfo.id); webMask.call("update", val::module_property("GL")); diff --git a/tgfx/src/gpu/opengl/GLAssembledWebGLInterface.cpp b/tgfx/src/gpu/opengl/GLAssembledWebGLInterface.cpp index f785ad4b57..e9864f2468 100644 --- a/tgfx/src/gpu/opengl/GLAssembledWebGLInterface.cpp +++ b/tgfx/src/gpu/opengl/GLAssembledWebGLInterface.cpp @@ -22,11 +22,11 @@ namespace tgfx { static unsigned GetErrorFake() { - return GL::NO_ERROR; + return GL_NO_ERROR; } static unsigned CheckFramebufferStatusFake(unsigned) { - return GL::FRAMEBUFFER_COMPLETE; + return GL_FRAMEBUFFER_COMPLETE; } static void InitVertexArray(const GLProcGetter* getter, GLInterface* interface, diff --git a/tgfx/src/gpu/opengl/GLBlend.cpp b/tgfx/src/gpu/opengl/GLBlend.cpp index 16a1178104..6709537ff1 100644 --- a/tgfx/src/gpu/opengl/GLBlend.cpp +++ b/tgfx/src/gpu/opengl/GLBlend.cpp @@ -345,21 +345,21 @@ static void HandleBlendModes(FragmentShaderBuilder* fsBuilder, const std::string } static constexpr std::pair> kBlendCoeffMap[] = { - {BlendMode::Clear, {GL::ZERO, GL::ZERO}}, - {BlendMode::Src, {GL::ONE, GL::ZERO}}, - {BlendMode::Dst, {GL::ZERO, GL::ONE}}, - {BlendMode::SrcOver, {GL::ONE, GL::ONE_MINUS_SRC_ALPHA}}, - {BlendMode::DstOver, {GL::ONE_MINUS_DST_ALPHA, GL::ONE}}, - {BlendMode::SrcIn, {GL::DST_ALPHA, GL::ZERO}}, - {BlendMode::DstIn, {GL::ZERO, GL::SRC_ALPHA}}, - {BlendMode::SrcOut, {GL::ONE_MINUS_DST_ALPHA, GL::ZERO}}, - {BlendMode::DstOut, {GL::ZERO, GL::ONE_MINUS_SRC_ALPHA}}, - {BlendMode::SrcATop, {GL::DST_ALPHA, GL::ONE_MINUS_SRC_ALPHA}}, - {BlendMode::DstATop, {GL::ONE_MINUS_DST_ALPHA, GL::SRC_ALPHA}}, - {BlendMode::Xor, {GL::ONE_MINUS_DST_ALPHA, GL::ONE_MINUS_SRC_ALPHA}}, - {BlendMode::Plus, {GL::ONE, GL::ONE}}, - {BlendMode::Modulate, {GL::ZERO, GL::SRC_COLOR}}, - {BlendMode::Screen, {GL::ONE, GL::ONE_MINUS_SRC_COLOR}}}; + {BlendMode::Clear, {GL_ZERO, GL_ZERO}}, + {BlendMode::Src, {GL_ONE, GL_ZERO}}, + {BlendMode::Dst, {GL_ZERO, GL_ONE}}, + {BlendMode::SrcOver, {GL_ONE, GL_ONE_MINUS_SRC_ALPHA}}, + {BlendMode::DstOver, {GL_ONE_MINUS_DST_ALPHA, GL_ONE}}, + {BlendMode::SrcIn, {GL_DST_ALPHA, GL_ZERO}}, + {BlendMode::DstIn, {GL_ZERO, GL_SRC_ALPHA}}, + {BlendMode::SrcOut, {GL_ONE_MINUS_DST_ALPHA, GL_ZERO}}, + {BlendMode::DstOut, {GL_ZERO, GL_ONE_MINUS_SRC_ALPHA}}, + {BlendMode::SrcATop, {GL_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA}}, + {BlendMode::DstATop, {GL_ONE_MINUS_DST_ALPHA, GL_SRC_ALPHA}}, + {BlendMode::Xor, {GL_ONE_MINUS_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA}}, + {BlendMode::Plus, {GL_ONE, GL_ONE}}, + {BlendMode::Modulate, {GL_ZERO, GL_SRC_COLOR}}, + {BlendMode::Screen, {GL_ONE, GL_ONE_MINUS_SRC_COLOR}}}; bool BlendAsCoeff(BlendMode blendMode, unsigned* first, unsigned* second) { for (const auto& pair : kBlendCoeffMap) { @@ -423,20 +423,20 @@ using CoeffHandler = void (*)(FragmentShaderBuilder* fsBuilder, const char* srcC const char* dstColorName); static constexpr std::pair kCoeffHandleMap[] = { - {GL::ONE, CoeffHandler_ONE}, - {GL::SRC_COLOR, CoeffHandler_SRC_COLOR}, - {GL::ONE_MINUS_SRC_COLOR, CoeffHandler_ONE_MINUS_SRC_COLOR}, - {GL::DST_COLOR, CoeffHandler_DST_COLOR}, - {GL::ONE_MINUS_DST_COLOR, CoeffHandler_ONE_MINUS_DST_COLOR}, - {GL::SRC_ALPHA, CoeffHandler_SRC_ALPHA}, - {GL::ONE_MINUS_SRC_ALPHA, CoeffHandler_ONE_MINUS_SRC_ALPHA}, - {GL::DST_ALPHA, CoeffHandler_DST_ALPHA}, - {GL::ONE_MINUS_DST_ALPHA, CoeffHandler_ONE_MINUS_DST_ALPHA}}; + {GL_ONE, CoeffHandler_ONE}, + {GL_SRC_COLOR, CoeffHandler_SRC_COLOR}, + {GL_ONE_MINUS_SRC_COLOR, CoeffHandler_ONE_MINUS_SRC_COLOR}, + {GL_DST_COLOR, CoeffHandler_DST_COLOR}, + {GL_ONE_MINUS_DST_COLOR, CoeffHandler_ONE_MINUS_DST_COLOR}, + {GL_SRC_ALPHA, CoeffHandler_SRC_ALPHA}, + {GL_ONE_MINUS_SRC_ALPHA, CoeffHandler_ONE_MINUS_SRC_ALPHA}, + {GL_DST_ALPHA, CoeffHandler_DST_ALPHA}, + {GL_ONE_MINUS_DST_ALPHA, CoeffHandler_ONE_MINUS_DST_ALPHA}}; static bool AppendPorterDuffTerm(FragmentShaderBuilder* fsBuilder, unsigned coeff, const std::string& colorName, const std::string& srcColorName, const std::string& dstColorName, bool hasPrevious) { - if (GL::ZERO == coeff) { + if (GL_ZERO == coeff) { return hasPrevious; } else { if (hasPrevious) { diff --git a/tgfx/src/gpu/opengl/GLBuffer.cpp b/tgfx/src/gpu/opengl/GLBuffer.cpp index efcd6a4aa4..ef6afe662e 100644 --- a/tgfx/src/gpu/opengl/GLBuffer.cpp +++ b/tgfx/src/gpu/opengl/GLBuffer.cpp @@ -43,10 +43,10 @@ std::shared_ptr GLBuffer::Make(Context* context, const uint16_t* buffe glBuffer = Resource::Wrap(context, new GLBuffer(buffer, length)); gl->genBuffers(1, &glBuffer->_bufferID); if (buffer) { - gl->bindBuffer(GL::ELEMENT_ARRAY_BUFFER, glBuffer->_bufferID); - gl->bufferData(GL::ELEMENT_ARRAY_BUFFER, static_cast(sizeof(uint16_t) * length), - buffer, GL::STATIC_DRAW); - gl->bindBuffer(GL::ELEMENT_ARRAY_BUFFER, 0); + gl->bindBuffer(GL_ELEMENT_ARRAY_BUFFER, glBuffer->_bufferID); + gl->bufferData(GL_ELEMENT_ARRAY_BUFFER, static_cast(sizeof(uint16_t) * length), + buffer, GL_STATIC_DRAW); + gl->bindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); } return glBuffer; } diff --git a/tgfx/src/gpu/opengl/GLCaps.cpp b/tgfx/src/gpu/opengl/GLCaps.cpp index a1169ad240..d64ed36369 100644 --- a/tgfx/src/gpu/opengl/GLCaps.cpp +++ b/tgfx/src/gpu/opengl/GLCaps.cpp @@ -86,7 +86,7 @@ GLInfo::GLInfo(GLGetString* getString, GLGetStringi* getStringi, GLGetIntegerv* getIntegerv(getIntegerv), getInternalformativ(getInternalformativ), getShaderPrecisionFormat(getShaderPrecisionFormat) { - auto versionString = (const char*)getString(GL::VERSION); + auto versionString = (const char*)getString(GL_VERSION); auto glVersion = GetGLVersion(versionString); version = GL_VER(glVersion.majorVersion, glVersion.minorVersion); standard = GetGLStandard(versionString); @@ -123,14 +123,14 @@ void GLInfo::fetchExtensions() { if (indexed) { if (getStringi) { int extensionCount = 0; - getIntegerv(GL::NUM_EXTENSIONS, &extensionCount); + getIntegerv(GL_NUM_EXTENSIONS, &extensionCount); for (int i = 0; i < extensionCount; ++i) { - const char* ext = reinterpret_cast(getStringi(GL::EXTENSIONS, i)); + const char* ext = reinterpret_cast(getStringi(GL_EXTENSIONS, i)); extensions.emplace_back(ext); } } } else { - auto text = reinterpret_cast(getString(GL::EXTENSIONS)); + auto text = reinterpret_cast(getString(GL_EXTENSIONS)); eatSpaceSepStrings(&extensions, text); } } @@ -146,12 +146,12 @@ static bool IsMediumFloatFp32(const GLInfo& ctxInfo) { // We're on a desktop GL that doesn't have precision info. Assume they're all 32bit float. return true; } - // glGetShaderPrecisionFormat doesn't accept GL::GEOMETRY_SHADER as a shader type. Hopefully the + // glGetShaderPrecisionFormat doesn't accept GL_GEOMETRY_SHADER as a shader type. Hopefully the // geometry shaders don't have lower precision than vertex and fragment. - for (unsigned shader : {GL::FRAGMENT_SHADER, GL::VERTEX_SHADER}) { + for (unsigned shader : {GL_FRAGMENT_SHADER, GL_VERTEX_SHADER}) { int range[2]; int bits; - ctxInfo.getShaderPrecisionFormat(shader, GL::MEDIUM_FLOAT, range, &bits); + ctxInfo.getShaderPrecisionFormat(shader, GL_MEDIUM_FLOAT, range, &bits); if (range[0] < 127 || range[1] < 127 || bits < 23) { return false; } @@ -162,7 +162,7 @@ static bool IsMediumFloatFp32(const GLInfo& ctxInfo) { GLCaps::GLCaps(const GLInfo& info) { standard = info.standard; version = info.version; - vendor = GetVendorFromString((const char*)info.getString(GL::VENDOR)); + vendor = GetVendorFromString((const char*)info.getString(GL_VENDOR)); floatIs32Bits = IsMediumFloatFp32(info); switch (standard) { case GLStandard::GL: @@ -177,8 +177,8 @@ GLCaps::GLCaps(const GLInfo& info) { default: break; } - info.getIntegerv(GL::MAX_TEXTURE_SIZE, &maxTextureSize); - info.getIntegerv(GL::MAX_TEXTURE_IMAGE_UNITS, &maxFragmentSamplers); + info.getIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize); + info.getIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &maxFragmentSamplers); initFSAASupport(info); initFormatMap(info); } @@ -273,32 +273,32 @@ void GLCaps::initWebGLSupport(const GLInfo& info) { } void GLCaps::initFormatMap(const GLInfo& info) { - pixelFormatMap[PixelFormat::RGBA_8888].format.sizedFormat = GL::RGBA8; - pixelFormatMap[PixelFormat::RGBA_8888].format.externalFormat = GL::RGBA; + pixelFormatMap[PixelFormat::RGBA_8888].format.sizedFormat = GL_RGBA8; + pixelFormatMap[PixelFormat::RGBA_8888].format.externalFormat = GL_RGBA; pixelFormatMap[PixelFormat::RGBA_8888].swizzle = Swizzle::RGBA(); if (textureRedSupport) { - pixelFormatMap[PixelFormat::ALPHA_8].format.sizedFormat = GL::R8; - pixelFormatMap[PixelFormat::ALPHA_8].format.externalFormat = GL::RED; + pixelFormatMap[PixelFormat::ALPHA_8].format.sizedFormat = GL_R8; + pixelFormatMap[PixelFormat::ALPHA_8].format.externalFormat = GL_RED; pixelFormatMap[PixelFormat::ALPHA_8].swizzle = Swizzle::RRRR(); - // Shader output swizzles will default to RGBA. When we've use GL::RED instead of GL::ALPHA to + // Shader output swizzles will default to RGBA. When we've use GL_RED instead of GL_ALPHA to // implement PixelFormat::ALPHA_8 we need to swizzle the shader outputs so the alpha channel // gets written to the single component. pixelFormatMap[PixelFormat::ALPHA_8].outputSwizzle = Swizzle::AAAA(); - pixelFormatMap[PixelFormat::GRAY_8].format.sizedFormat = GL::R8; - pixelFormatMap[PixelFormat::GRAY_8].format.externalFormat = GL::RED; + pixelFormatMap[PixelFormat::GRAY_8].format.sizedFormat = GL_R8; + pixelFormatMap[PixelFormat::GRAY_8].format.externalFormat = GL_RED; pixelFormatMap[PixelFormat::GRAY_8].swizzle = Swizzle::RRRA(); - pixelFormatMap[PixelFormat::RG_88].format.sizedFormat = GL::RG8; - pixelFormatMap[PixelFormat::RG_88].format.externalFormat = GL::RG; + pixelFormatMap[PixelFormat::RG_88].format.sizedFormat = GL_RG8; + pixelFormatMap[PixelFormat::RG_88].format.externalFormat = GL_RG; pixelFormatMap[PixelFormat::RG_88].swizzle = Swizzle::RGRG(); } else { - pixelFormatMap[PixelFormat::ALPHA_8].format.sizedFormat = GL::ALPHA8; - pixelFormatMap[PixelFormat::ALPHA_8].format.externalFormat = GL::ALPHA; + pixelFormatMap[PixelFormat::ALPHA_8].format.sizedFormat = GL_ALPHA8; + pixelFormatMap[PixelFormat::ALPHA_8].format.externalFormat = GL_ALPHA; pixelFormatMap[PixelFormat::ALPHA_8].swizzle = Swizzle::AAAA(); - pixelFormatMap[PixelFormat::GRAY_8].format.sizedFormat = GL::LUMINANCE8; - pixelFormatMap[PixelFormat::GRAY_8].format.externalFormat = GL::LUMINANCE; + pixelFormatMap[PixelFormat::GRAY_8].format.sizedFormat = GL_LUMINANCE8; + pixelFormatMap[PixelFormat::GRAY_8].format.externalFormat = GL_LUMINANCE; pixelFormatMap[PixelFormat::GRAY_8].swizzle = Swizzle::RGBA(); - pixelFormatMap[PixelFormat::RG_88].format.sizedFormat = GL::LUMINANCE8_ALPHA8; - pixelFormatMap[PixelFormat::RG_88].format.externalFormat = GL::LUMINANCE_ALPHA; + pixelFormatMap[PixelFormat::RG_88].format.sizedFormat = GL_LUMINANCE8_ALPHA8; + pixelFormatMap[PixelFormat::RG_88].format.externalFormat = GL_LUMINANCE_ALPHA; pixelFormatMap[PixelFormat::RG_88].swizzle = Swizzle::RARA(); } // If we don't have texture swizzle support then the shader generator must insert the @@ -335,10 +335,10 @@ void GLCaps::initColorSampleCount(const GLInfo& info) { if (UsesInternalformatQuery(standard, info, version)) { int count = 0; unsigned format = pixelFormatMap[pixelFormat].format.internalFormatRenderBuffer; - info.getInternalformativ(GL::RENDERBUFFER, format, GL::NUM_SAMPLE_COUNTS, 1, &count); + info.getInternalformativ(GL_RENDERBUFFER, format, GL_NUM_SAMPLE_COUNTS, 1, &count); if (count) { int* temp = new int[count]; - info.getInternalformativ(GL::RENDERBUFFER, format, GL::SAMPLES, count, temp); + info.getInternalformativ(GL_RENDERBUFFER, format, GL_SAMPLES, count, temp); // GL has a concept of MSAA rasterization with a single sample but we do not. if (temp[count - 1] == 1) { --count; @@ -356,9 +356,9 @@ void GLCaps::initColorSampleCount(const GLInfo& info) { // count. int maxSampleCnt = 1; if (MSFBOType::ES_IMG_MsToTexture == msFBOType) { - info.getIntegerv(GL::MAX_SAMPLES_IMG, &maxSampleCnt); + info.getIntegerv(GL_MAX_SAMPLES_IMG, &maxSampleCnt); } else if (MSFBOType::None != msFBOType) { - info.getIntegerv(GL::MAX_SAMPLES, &maxSampleCnt); + info.getIntegerv(GL_MAX_SAMPLES, &maxSampleCnt); } // Chrome has a mock GL implementation that returns 0. maxSampleCnt = std::max(1, maxSampleCnt); diff --git a/tgfx/src/gpu/opengl/GLDefines.h b/tgfx/src/gpu/opengl/GLDefines.h index 57018f74a0..0770f825fd 100644 --- a/tgfx/src/gpu/opengl/GLDefines.h +++ b/tgfx/src/gpu/opengl/GLDefines.h @@ -4,7 +4,7 @@ // // Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. // -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file +// Licensed under the Apache License, Version 2.0 (the "License") you may not use this file // except in compliance with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 @@ -18,891 +18,889 @@ #pragma once -#include -#include - -namespace GL { -#undef FALSE -#undef TRUE +namespace tgfx { +#ifndef GL_TRUE // The following constants consist of the intersection of GL constants -// exported by GLES 1.0, GLES 2.0, and desktop GL required by the system. +// exported by GLES 1.0, GLES 2.0, GLES 3.0, and desktop GL required by the system. -static constexpr unsigned DEPTH_BUFFER_BIT = 0x00000100; -static constexpr unsigned STENCIL_BUFFER_BIT = 0x00000400; -static constexpr unsigned COLOR_BUFFER_BIT = 0x00004000; +#define GL_DEPTH_BUFFER_BIT 0x00000100 +#define GL_STENCIL_BUFFER_BIT 0x00000400 +#define GL_COLOR_BUFFER_BIT 0x00004000 // Boolean -static constexpr unsigned FALSE = 0; -static constexpr unsigned TRUE = 1; +#define GL_FALSE 0 +#define GL_TRUE 1 // BeginMode -static constexpr unsigned POINTS = 0x0000; -static constexpr unsigned LINES = 0x0001; -static constexpr unsigned LINE_LOOP = 0x0002; -static constexpr unsigned LINE_STRIP = 0x0003; -static constexpr unsigned TRIANGLES = 0x0004; -static constexpr unsigned TRIANGLE_STRIP = 0x0005; -static constexpr unsigned TRIANGLE_FAN = 0x0006; +#define GL_POINTS 0x0000 +#define GL_LINES 0x0001 +#define GL_LINE_LOOP 0x0002 +#define GL_LINE_STRIP 0x0003 +#define GL_TRIANGLES 0x0004 +#define GL_TRIANGLE_STRIP 0x0005 +#define GL_TRIANGLE_FAN 0x0006 // Basic OpenGL blend equations -static constexpr unsigned FUNC_ADD = 0x8006; -static constexpr unsigned BLEND_EQUATION = 0x8009; -static constexpr unsigned BLEND_EQUATION_RGB = 0x8009; /* same as BLEND_EQUATION */ -static constexpr unsigned BLEND_EQUATION_ALPHA = 0x883D; -static constexpr unsigned FUNC_SUBTRACT = 0x800A; -static constexpr unsigned FUNC_REVERSE_SUBTRACT = 0x800B; +#define GL_FUNC_ADD 0x8006 +#define GL_BLEND_EQUATION 0x8009 +#define GL_BLEND_EQUATION_RGB 0x8009 /* same as BLEND_EQUATION */ +#define GL_BLEND_EQUATION_ALPHA 0x883D +#define GL_FUNC_SUBTRACT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT 0x800B // KHR_blend_equation_advanced -static constexpr unsigned SCREEN = 0x9295; -static constexpr unsigned OVERLAY = 0x9296; -static constexpr unsigned DARKEN = 0x9297; -static constexpr unsigned LIGHTEN = 0x9298; -static constexpr unsigned COLORDODGE = 0x9299; -static constexpr unsigned COLORBURN = 0x929A; -static constexpr unsigned HARDLIGHT = 0x929B; -static constexpr unsigned SOFTLIGHT = 0x929C; -static constexpr unsigned DIFFERENCE = 0x929E; -static constexpr unsigned EXCLUSION = 0x92A0; -static constexpr unsigned MULTIPLY = 0x9294; -static constexpr unsigned HSL_HUE = 0x92AD; -static constexpr unsigned HSL_SATURATION = 0x92AE; -static constexpr unsigned HSL_COLOR = 0x92AF; -static constexpr unsigned HSL_LUMINOSITY = 0x92B0; +#define GL_SCREEN 0x9295 +#define GL_OVERLAY 0x9296 +#define GL_DARKEN 0x9297 +#define GL_LIGHTEN 0x9298 +#define GL_COLORDODGE 0x9299 +#define GL_COLORBURN 0x929A +#define GL_HARDLIGHT 0x929B +#define GL_SOFTLIGHT 0x929C +#define GL_DIFFERENCE 0x929E +#define GL_EXCLUSION 0x92A0 +#define GL_MULTIPLY 0x9294 +#define GL_HSL_HUE 0x92AD +#define GL_HSL_SATURATION 0x92AE +#define GL_HSL_COLOR 0x92AF +#define GL_HSL_LUMINOSITY 0x92B0 // BlendingFactorDest -static constexpr unsigned ZERO = 0; -static constexpr unsigned ONE = 1; -static constexpr unsigned SRC_COLOR = 0x0300; -static constexpr unsigned ONE_MINUS_SRC_COLOR = 0x0301; -static constexpr unsigned SRC_ALPHA = 0x0302; -static constexpr unsigned ONE_MINUS_SRC_ALPHA = 0x0303; -static constexpr unsigned DST_ALPHA = 0x0304; -static constexpr unsigned ONE_MINUS_DST_ALPHA = 0x0305; +#define GL_ZERO 0 +#define GL_ONE 1 +#define GL_SRC_COLOR 0x0300 +#define GL_ONE_MINUS_SRC_COLOR 0x0301 +#define GL_SRC_ALPHA 0x0302 +#define GL_ONE_MINUS_SRC_ALPHA 0x0303 +#define GL_DST_ALPHA 0x0304 +#define GL_ONE_MINUS_DST_ALPHA 0x0305 // BlendingFactorSrc -static constexpr unsigned DST_COLOR = 0x0306; -static constexpr unsigned ONE_MINUS_DST_COLOR = 0x0307; -static constexpr unsigned SRC_ALPHA_SATURATE = 0x0308; +#define GL_DST_COLOR 0x0306 +#define GL_ONE_MINUS_DST_COLOR 0x0307 +#define GL_SRC_ALPHA_SATURATE 0x0308 // ExtendedBlendFactors -static constexpr unsigned SRC1_COLOR = 0x88F9; -static constexpr unsigned ONE_MINUS_SRC1_COLOR = 0x88FA; +#define GL_SRC1_COLOR 0x88F9 +#define GL_ONE_MINUS_SRC1_COLOR 0x88FA // SRC1_ALPHA -static constexpr unsigned ONE_MINUS_SRC1_ALPHA = 0x88FB; +#define GL_ONE_MINUS_SRC1_ALPHA 0x88FB // Separate Blend Functions -static constexpr unsigned BLEND_DST_RGB = 0x80C8; -static constexpr unsigned BLEND_SRC_RGB = 0x80C9; -static constexpr unsigned BLEND_DST_ALPHA = 0x80CA; -static constexpr unsigned BLEND_SRC_ALPHA = 0x80CB; -static constexpr unsigned CONSTANT_COLOR = 0x8001; -static constexpr unsigned ONE_MINUS_CONSTANT_COLOR = 0x8002; -static constexpr unsigned CONSTANT_ALPHA = 0x8003; -static constexpr unsigned ONE_MINUS_CONSTANT_ALPHA = 0x8004; -static constexpr unsigned BLEND_COLOR = 0x8005; +#define GL_BLEND_DST_RGB 0x80C8 +#define GL_BLEND_SRC_RGB 0x80C9 +#define GL_BLEND_DST_ALPHA 0x80CA +#define GL_BLEND_SRC_ALPHA 0x80CB +#define GL_CONSTANT_COLOR 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#define GL_BLEND_COLOR 0x8005 // Buffer Objects -static constexpr unsigned ARRAY_BUFFER = 0x8892; -static constexpr unsigned ELEMENT_ARRAY_BUFFER = 0x8893; -static constexpr unsigned DRAW_INDIRECT_BUFFER = 0x8F3F; -static constexpr unsigned TEXTURE_BUFFER = 0x8C2A; -static constexpr unsigned ARRAY_BUFFER_BINDING = 0x8894; -static constexpr unsigned ELEMENT_ARRAY_BUFFER_BINDING = 0x8895; -static constexpr unsigned DRAW_INDIRECT_BUFFER_BINDING = 0x8F43; -static constexpr unsigned VERTEX_ARRAY_BINDING = 0x85B5; -static constexpr unsigned PIXEL_PACK_BUFFER = 0x88EB; -static constexpr unsigned PIXEL_UNPACK_BUFFER = 0x88EC; - -static constexpr unsigned PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM = 0x78EC; -static constexpr unsigned PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM = 0x78ED; - -static constexpr unsigned STREAM_DRAW = 0x88E0; -static constexpr unsigned STREAM_READ = 0x88E1; -static constexpr unsigned STATIC_DRAW = 0x88E4; -static constexpr unsigned STATIC_READ = 0x88E5; -static constexpr unsigned DYNAMIC_DRAW = 0x88E8; -static constexpr unsigned DYNAMIC_READ = 0x88E9; - -static constexpr unsigned BUFFER_SIZE = 0x8764; -static constexpr unsigned BUFFER_USAGE = 0x8765; - -static constexpr unsigned CURRENT_VERTEX_ATTRIB = 0x8626; +#define GL_ARRAY_BUFFER 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER 0x8893 +#define GL_DRAW_INDIRECT_BUFFER 0x8F3F +#define GL_TEXTURE_BUFFER 0x8C2A +#define GL_ARRAY_BUFFER_BINDING 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 +#define GL_DRAW_INDIRECT_BUFFER_BINDING 0x8F43 +#define GL_VERTEX_ARRAY_BINDING 0x85B5 +#define GL_PIXEL_PACK_BUFFER 0x88EB +#define GL_PIXEL_UNPACK_BUFFER 0x88EC + +#define GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM 0x78EC +#define GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM 0x78ED + +#define GL_STREAM_DRAW 0x88E0 +#define GL_STREAM_READ 0x88E1 +#define GL_STATIC_DRAW 0x88E4 +#define GL_STATIC_READ 0x88E5 +#define GL_DYNAMIC_DRAW 0x88E8 +#define GL_DYNAMIC_READ 0x88E9 + +#define GL_BUFFER_SIZE 0x8764 +#define GL_BUFFER_USAGE 0x8765 + +#define GL_CURRENT_VERTEX_ATTRIB 0x8626 // CullFaceMode -static constexpr unsigned FRONT = 0x0404; -static constexpr unsigned BACK = 0x0405; -static constexpr unsigned FRONT_AND_BACK = 0x0408; +#define GL_FRONT 0x0404 +#define GL_BACK 0x0405 +#define GL_FRONT_AND_BACK 0x0408 // EnableCap -static constexpr unsigned TEXTURE_2D = 0x0DE1; -static constexpr unsigned TEXTURE_RECTANGLE = 0x84F5; -static constexpr unsigned CULL_FACE = 0x0B44; -static constexpr unsigned BLEND = 0x0BE2; -static constexpr unsigned DITHER = 0x0BD0; -static constexpr unsigned STENCIL_TEST = 0x0B90; -static constexpr unsigned DEPTH_TEST = 0x0B71; -static constexpr unsigned SCISSOR_TEST = 0x0C11; -static constexpr unsigned POLYGON_OFFSET_FILL = 0x8037; -static constexpr unsigned SAMPLE_ALPHA_TO_COVERAGE = 0x809E; -static constexpr unsigned SAMPLE_COVERAGE = 0x80A0; -static constexpr unsigned POLYGON_SMOOTH = 0x0B41; -static constexpr unsigned POLYGON_STIPPLE = 0x0B42; -static constexpr unsigned COLOR_LOGIC_OP = 0x0BF2; -static constexpr unsigned COLOR_TABLE = 0x80D0; -static constexpr unsigned INDEX_LOGIC_OP = 0x0BF1; -static constexpr unsigned VERTEX_PROGRAM_POINT_SIZE = 0x8642; -static constexpr unsigned FRAMEBUFFER_SRGB = 0x8DB9; -static constexpr unsigned SHADER_PIXEL_LOCAL_STORAGE = 0x8F64; -static constexpr unsigned SAMPLE_SHADING = 0x8C36; +#define GL_TEXTURE_2D 0x0DE1 +#define GL_TEXTURE_RECTANGLE 0x84F5 +#define GL_CULL_FACE 0x0B44 +#define GL_BLEND 0x0BE2 +#define GL_DITHER 0x0BD0 +#define GL_STENCIL_TEST 0x0B90 +#define GL_DEPTH_TEST 0x0B71 +#define GL_SCISSOR_TEST 0x0C11 +#define GL_POLYGON_OFFSET_FILL 0x8037 +#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E +#define GL_SAMPLE_COVERAGE 0x80A0 +#define GL_POLYGON_SMOOTH 0x0B41 +#define GL_POLYGON_STIPPLE 0x0B42 +#define GL_COLOR_LOGIC_OP 0x0BF2 +#define GL_COLOR_TABLE 0x80D0 +#define GL_INDEX_LOGIC_OP 0x0BF1 +#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 +#define GL_FRAMEBUFFER_SRGB 0x8DB9 +#define GL_SHADER_PIXEL_LOCAL_STORAGE 0x8F64 +#define GL_SAMPLE_SHADING 0x8C36 // ErrorCode -static constexpr unsigned NO_ERROR = 0; -static constexpr unsigned INVALID_ENUM = 0x0500; -static constexpr unsigned INVALID_VALUE = 0x0501; -static constexpr unsigned INVALID_OPERATION = 0x0502; -static constexpr unsigned OUT_OF_MEMORY = 0x0505; -static constexpr unsigned CONTEXT_LOST = 0x300E; +#define GL_NO_ERROR 0 +#define GL_INVALID_ENUM 0x0500 +#define GL_INVALID_VALUE 0x0501 +#define GL_INVALID_OPERATION 0x0502 +#define GL_OUT_OF_MEMORY 0x0505 +#define GL_CONTEXT_LOST 0x300E // FrontFaceDirection -static constexpr unsigned CW = 0x0900; -static constexpr unsigned CCW = 0x0901; +#define GL_CW 0x0900 +#define GL_CCW 0x0901 // GetPName -static constexpr unsigned ALIASED_POINT_SIZE_RANGE = 0x846D; -static constexpr unsigned ALIASED_LINE_WIDTH_RANGE = 0x846E; -static constexpr unsigned CULL_FACE_MODE = 0x0B45; -static constexpr unsigned FRONT_FACE = 0x0B46; -static constexpr unsigned DEPTH_RANGE = 0x0B70; -static constexpr unsigned DEPTH_WRITEMASK = 0x0B72; -static constexpr unsigned DEPTH_CLEAR_VALUE = 0x0B73; -static constexpr unsigned DEPTH_FUNC = 0x0B74; -static constexpr unsigned STENCIL_CLEAR_VALUE = 0x0B91; -static constexpr unsigned STENCIL_FUNC = 0x0B92; -static constexpr unsigned STENCIL_FAIL = 0x0B94; -static constexpr unsigned STENCIL_PASS_DEPTH_FAIL = 0x0B95; -static constexpr unsigned STENCIL_PASS_DEPTH_PASS = 0x0B96; -static constexpr unsigned STENCIL_REF = 0x0B97; -static constexpr unsigned STENCIL_VALUE_MASK = 0x0B93; -static constexpr unsigned STENCIL_WRITEMASK = 0x0B98; -static constexpr unsigned STENCIL_BACK_FUNC = 0x8800; -static constexpr unsigned STENCIL_BACK_FAIL = 0x8801; -static constexpr unsigned STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802; -static constexpr unsigned STENCIL_BACK_PASS_DEPTH_PASS = 0x8803; -static constexpr unsigned STENCIL_BACK_REF = 0x8CA3; -static constexpr unsigned STENCIL_BACK_VALUE_MASK = 0x8CA4; -static constexpr unsigned STENCIL_BACK_WRITEMASK = 0x8CA5; -static constexpr unsigned VIEWPORT = 0x0BA2; -static constexpr unsigned SCISSOR_BOX = 0x0C10; -static constexpr unsigned COLOR_CLEAR_VALUE = 0x0C22; -static constexpr unsigned COLOR_WRITEMASK = 0x0C23; -static constexpr unsigned UNPACK_ALIGNMENT = 0x0CF5; -static constexpr unsigned PACK_ALIGNMENT = 0x0D05; -static constexpr unsigned PACK_REVERSE_ROW_ORDER = 0x93A4; -static constexpr unsigned MAX_TEXTURE_SIZE = 0x0D33; -static constexpr unsigned TEXTURE_MIN_LOD = 0x813A; -static constexpr unsigned TEXTURE_MAX_LOD = 0x813B; -static constexpr unsigned TEXTURE_BASE_LEVEL = 0x813C; -static constexpr unsigned TEXTURE_MAX_LEVEL = 0x813D; -static constexpr unsigned MAX_VIEWPORT_DIMS = 0x0D3A; -static constexpr unsigned SUBPIXEL_BITS = 0x0D50; -static constexpr unsigned RED_BITS = 0x0D52; -static constexpr unsigned GREEN_BITS = 0x0D53; -static constexpr unsigned BLUE_BITS = 0x0D54; -static constexpr unsigned ALPHA_BITS = 0x0D55; -static constexpr unsigned DEPTH_BITS = 0x0D56; -static constexpr unsigned STENCIL_BITS = 0x0D57; -static constexpr unsigned POLYGON_OFFSET_UNITS = 0x2A00; -static constexpr unsigned POLYGON_OFFSET_FACTOR = 0x8038; -static constexpr unsigned TEXTURE_BINDING_2D = 0x8069; -static constexpr unsigned TEXTURE_BINDING_RECTANGLE = 0x84F6; -static constexpr unsigned SAMPLE_BUFFERS = 0x80A8; -static constexpr unsigned SAMPLES = 0x80A9; -static constexpr unsigned SAMPLE_COVERAGE_VALUE = 0x80AA; -static constexpr unsigned SAMPLE_COVERAGE_INVERT = 0x80AB; -static constexpr unsigned RENDERBUFFER_COVERAGE_SAMPLES = 0x8CAB; -static constexpr unsigned RENDERBUFFER_COLOR_SAMPLES = 0x8E10; -static constexpr unsigned MAX_MULTISAMPLE_COVERAGE_MODES = 0x8E11; -static constexpr unsigned MULTISAMPLE_COVERAGE_MODES = 0x8E12; -static constexpr unsigned MAX_TEXTURE_BUFFER_SIZE = 0x8C2B; - -static constexpr unsigned NUM_COMPRESSED_TEXTURE_FORMATS = 0x86A2; -static constexpr unsigned COMPRESSED_TEXTURE_FORMATS = 0x86A3; +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E +#define GL_CULL_FACE_MODE 0x0B45 +#define GL_FRONT_FACE 0x0B46 +#define GL_DEPTH_RANGE 0x0B70 +#define GL_DEPTH_WRITEMASK 0x0B72 +#define GL_DEPTH_CLEAR_VALUE 0x0B73 +#define GL_DEPTH_FUNC 0x0B74 +#define GL_STENCIL_CLEAR_VALUE 0x0B91 +#define GL_STENCIL_FUNC 0x0B92 +#define GL_STENCIL_FAIL 0x0B94 +#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 +#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 +#define GL_STENCIL_REF 0x0B97 +#define GL_STENCIL_VALUE_MASK 0x0B93 +#define GL_STENCIL_WRITEMASK 0x0B98 +#define GL_STENCIL_BACK_FUNC 0x8800 +#define GL_STENCIL_BACK_FAIL 0x8801 +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 +#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 +#define GL_STENCIL_BACK_REF 0x8CA3 +#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 +#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 +#define GL_VIEWPORT 0x0BA2 +#define GL_SCISSOR_BOX 0x0C10 +#define GL_COLOR_CLEAR_VALUE 0x0C22 +#define GL_COLOR_WRITEMASK 0x0C23 +#define GL_UNPACK_ALIGNMENT 0x0CF5 +#define GL_PACK_ALIGNMENT 0x0D05 +#define GL_PACK_REVERSE_ROW_ORDER 0x93A4 +#define GL_MAX_TEXTURE_SIZE 0x0D33 +#define GL_TEXTURE_MIN_LOD 0x813A +#define GL_TEXTURE_MAX_LOD 0x813B +#define GL_TEXTURE_BASE_LEVEL 0x813C +#define GL_TEXTURE_MAX_LEVEL 0x813D +#define GL_MAX_VIEWPORT_DIMS 0x0D3A +#define GL_SUBPIXEL_BITS 0x0D50 +#define GL_RED_BITS 0x0D52 +#define GL_GREEN_BITS 0x0D53 +#define GL_BLUE_BITS 0x0D54 +#define GL_ALPHA_BITS 0x0D55 +#define GL_DEPTH_BITS 0x0D56 +#define GL_STENCIL_BITS 0x0D57 +#define GL_POLYGON_OFFSET_UNITS 0x2A00 +#define GL_POLYGON_OFFSET_FACTOR 0x8038 +#define GL_TEXTURE_BINDING_2D 0x8069 +#define GL_TEXTURE_BINDING_RECTANGLE 0x84F6 +#define GL_SAMPLE_BUFFERS 0x80A8 +#define GL_SAMPLES 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT 0x80AB +#define GL_RENDERBUFFER_COVERAGE_SAMPLES 0x8CAB +#define GL_RENDERBUFFER_COLOR_SAMPLES 0x8E10 +#define GL_MAX_MULTISAMPLE_COVERAGE_MODES 0x8E11 +#define GL_MULTISAMPLE_COVERAGE_MODES 0x8E12 +#define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B + +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 // Compressed Texture Formats -static constexpr unsigned COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0; -static constexpr unsigned COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1; -static constexpr unsigned COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2; -static constexpr unsigned COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3; - -static constexpr unsigned COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 0x8C00; -static constexpr unsigned COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 0x8C01; -static constexpr unsigned COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 0x8C02; -static constexpr unsigned COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 0x8C03; - -static constexpr unsigned COMPRESSED_RGBA_PVRTC_2BPPV2_IMG = 0x9137; -static constexpr unsigned COMPRESSED_RGBA_PVRTC_4BPPV2_IMG = 0x9138; - -static constexpr unsigned COMPRESSED_ETC1_RGB8 = 0x8D64; - -static constexpr unsigned COMPRESSED_R11_EAC = 0x9270; -static constexpr unsigned COMPRESSED_SIGNED_R11_EAC = 0x9271; -static constexpr unsigned COMPRESSED_RG11_EAC = 0x9272; -static constexpr unsigned COMPRESSED_SIGNED_RG11_EAC = 0x9273; - -static constexpr unsigned COMPRESSED_RGB8_ETC2 = 0x9274; -static constexpr unsigned COMPRESSED_SRGB8 = 0x9275; -static constexpr unsigned COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1 = 0x9276; -static constexpr unsigned COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1 = 0x9277; -static constexpr unsigned COMPRESSED_RGBA8_ETC2 = 0x9278; -static constexpr unsigned COMPRESSED_SRGB8_ALPHA8_ETC2 = 0x9279; - -static constexpr unsigned COMPRESSED_LUMINANCE_LATC1 = 0x8C70; -static constexpr unsigned COMPRESSED_SIGNED_LUMINANCE_LATC1 = 0x8C71; -static constexpr unsigned COMPRESSED_LUMINANCE_ALPHA_LATC2 = 0x8C72; -static constexpr unsigned COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2 = 0x8C73; - -static constexpr unsigned COMPRESSED_RED_RGTC1 = 0x8DBB; -static constexpr unsigned COMPRESSED_SIGNED_RED_RGTC1 = 0x8DBC; -static constexpr unsigned COMPRESSED_RED_GREEN_RGTC2 = 0x8DBD; -static constexpr unsigned COMPRESSED_SIGNED_RED_GREEN_RGTC2 = 0x8DBE; - -static constexpr unsigned COMPRESSED_3DC_X = 0x87F9; -static constexpr unsigned COMPRESSED_3DC_XY = 0x87FA; - -static constexpr unsigned COMPRESSED_RGBA_BPTC_UNORM = 0x8E8C; -static constexpr unsigned COMPRESSED_SRGB_ALPHA_BPTC_UNORM = 0x8E8D; -static constexpr unsigned COMPRESSED_RGB_BPTC_SIGNED_FLOAT = 0x8E8E; -static constexpr unsigned COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT = 0x8E8F; - -static constexpr unsigned COMPRESSED_RGBA_ASTC_4x4 = 0x93B0; -static constexpr unsigned COMPRESSED_RGBA_ASTC_5x4 = 0x93B1; -static constexpr unsigned COMPRESSED_RGBA_ASTC_5x5 = 0x93B2; -static constexpr unsigned COMPRESSED_RGBA_ASTC_6x5 = 0x93B3; -static constexpr unsigned COMPRESSED_RGBA_ASTC_6x6 = 0x93B4; -static constexpr unsigned COMPRESSED_RGBA_ASTC_8x5 = 0x93B5; -static constexpr unsigned COMPRESSED_RGBA_ASTC_8x6 = 0x93B6; -static constexpr unsigned COMPRESSED_RGBA_ASTC_8x8 = 0x93B7; -static constexpr unsigned COMPRESSED_RGBA_ASTC_10x5 = 0x93B8; -static constexpr unsigned COMPRESSED_RGBA_ASTC_10x6 = 0x93B9; -static constexpr unsigned COMPRESSED_RGBA_ASTC_10x8 = 0x93BA; -static constexpr unsigned COMPRESSED_RGBA_ASTC_10x10 = 0x93BB; -static constexpr unsigned COMPRESSED_RGBA_ASTC_12x10 = 0x93BC; -static constexpr unsigned COMPRESSED_RGBA_ASTC_12x12 = 0x93BD; - -static constexpr unsigned COMPRESSED_SRGB8_ALPHA8_ASTC_4x4 = 0x93D0; -static constexpr unsigned COMPRESSED_SRGB8_ALPHA8_ASTC_5x4 = 0x93D1; -static constexpr unsigned COMPRESSED_SRGB8_ALPHA8_ASTC_5x5 = 0x93D2; -static constexpr unsigned COMPRESSED_SRGB8_ALPHA8_ASTC_6x5 = 0x93D3; -static constexpr unsigned COMPRESSED_SRGB8_ALPHA8_ASTC_6x6 = 0x93D4; -static constexpr unsigned COMPRESSED_SRGB8_ALPHA8_ASTC_8x5 = 0x93D5; -static constexpr unsigned COMPRESSED_SRGB8_ALPHA8_ASTC_8x6 = 0x93D6; -static constexpr unsigned COMPRESSED_SRGB8_ALPHA8_ASTC_8x8 = 0x93D7; -static constexpr unsigned COMPRESSED_SRGB8_ALPHA8_ASTC_10x5 = 0x93D8; -static constexpr unsigned COMPRESSED_SRGB8_ALPHA8_ASTC_10x6 = 0x93D9; -static constexpr unsigned COMPRESSED_SRGB8_ALPHA8_ASTC_10x8 = 0x93DA; -static constexpr unsigned COMPRESSED_SRGB8_ALPHA8_ASTC_10x10 = 0x93DB; -static constexpr unsigned COMPRESSED_SRGB8_ALPHA8_ASTC_12x10 = 0x93DC; -static constexpr unsigned COMPRESSED_SRGB8_ALPHA8_ASTC_12x12 = 0x93DD; +#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 +#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 +#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 +#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 + +#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00 +#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01 +#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02 +#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03 + +#define GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG 0x9137 +#define GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG 0x9138 + +#define GL_COMPRESSED_ETC1_RGB8 0x8D64 + +#define GL_COMPRESSED_R11_EAC 0x9270 +#define GL_COMPRESSED_SIGNED_R11_EAC 0x9271 +#define GL_COMPRESSED_RG11_EAC 0x9272 +#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273 + +#define GL_COMPRESSED_RGB8_ETC2 0x9274 +#define GL_COMPRESSED_SRGB8 0x9275 +#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1 0x9276 +#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1 0x9277 +#define GL_COMPRESSED_RGBA8_ETC2 0x9278 +#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2 0x9279 + +#define GL_COMPRESSED_LUMINANCE_LATC1 0x8C70 +#define GL_COMPRESSED_SIGNED_LUMINANCE_LATC1 0x8C71 +#define GL_COMPRESSED_LUMINANCE_ALPHA_LATC2 0x8C72 +#define GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2 0x8C73 + +#define GL_COMPRESSED_RED_RGTC1 0x8DBB +#define GL_COMPRESSED_SIGNED_RED_RGTC1 0x8DBC +#define GL_COMPRESSED_RED_GREEN_RGTC2 0x8DBD +#define GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2 0x8DBE + +#define GL_COMPRESSED_3DC_X 0x87F9 +#define GL_COMPRESSED_3DC_XY 0x87FA + +#define GL_COMPRESSED_RGBA_BPTC_UNORM 0x8E8C +#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM 0x8E8D +#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT 0x8E8E +#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT 0x8E8F + +#define GL_COMPRESSED_RGBA_ASTC_4x4 0x93B0 +#define GL_COMPRESSED_RGBA_ASTC_5x4 0x93B1 +#define GL_COMPRESSED_RGBA_ASTC_5x5 0x93B2 +#define GL_COMPRESSED_RGBA_ASTC_6x5 0x93B3 +#define GL_COMPRESSED_RGBA_ASTC_6x6 0x93B4 +#define GL_COMPRESSED_RGBA_ASTC_8x5 0x93B5 +#define GL_COMPRESSED_RGBA_ASTC_8x6 0x93B6 +#define GL_COMPRESSED_RGBA_ASTC_8x8 0x93B7 +#define GL_COMPRESSED_RGBA_ASTC_10x5 0x93B8 +#define GL_COMPRESSED_RGBA_ASTC_10x6 0x93B9 +#define GL_COMPRESSED_RGBA_ASTC_10x8 0x93BA +#define GL_COMPRESSED_RGBA_ASTC_10x10 0x93BB +#define GL_COMPRESSED_RGBA_ASTC_12x10 0x93BC +#define GL_COMPRESSED_RGBA_ASTC_12x12 0x93BD + +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4 0x93D0 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4 0x93D1 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5 0x93D2 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5 0x93D3 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6 0x93D4 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5 0x93D5 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6 0x93D6 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8 0x93D7 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5 0x93D8 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6 0x93D9 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8 0x93DA +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10 0x93DB +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10 0x93DC +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12 0x93DD // HintMode -static constexpr unsigned DONT_CARE = 0x1100; -static constexpr unsigned FASTEST = 0x1101; -static constexpr unsigned NICEST = 0x1102; +#define GL_DONT_CARE 0x1100 +#define GL_FASTEST 0x1101 +#define GL_NICEST 0x1102 // HintTarget -static constexpr unsigned GENERATE_MIPMAP_HINT = 0x8192; +#define GL_GENERATE_MIPMAP_HINT 0x8192 // DataType -static constexpr unsigned BYTE = 0x1400; -static constexpr unsigned UNSIGNED_BYTE = 0x1401; -static constexpr unsigned SHORT = 0x1402; -static constexpr unsigned UNSIGNED_SHORT = 0x1403; -static constexpr unsigned INT = 0x1404; -static constexpr unsigned UNSIGNED_INT = 0x1405; -static constexpr unsigned FLOAT = 0x1406; -static constexpr unsigned HALF_FLOAT = 0x140B; -static constexpr unsigned FIXED = 0x140C; -static constexpr unsigned HALF_FLOAT_OES = 0x8D61; +#define GL_BYTE 0x1400 +#define GL_UNSIGNED_BYTE 0x1401 +#define GL_SHORT 0x1402 +#define GL_UNSIGNED_SHORT 0x1403 +#define GL_INT 0x1404 +#define GL_UNSIGNED_INT 0x1405 +#define GL_FLOAT 0x1406 +#define GL_HALF_FLOAT 0x140B +#define GL_FIXED 0x140C +#define GL_HALF_FLOAT_OES 0x8D61 // Lighting -static constexpr unsigned LIGHTING = 0x0B50; -static constexpr unsigned LIGHT0 = 0x4000; -static constexpr unsigned LIGHT1 = 0x4001; -static constexpr unsigned LIGHT2 = 0x4002; -static constexpr unsigned LIGHT3 = 0x4003; -static constexpr unsigned LIGHT4 = 0x4004; -static constexpr unsigned LIGHT5 = 0x4005; -static constexpr unsigned LIGHT6 = 0x4006; -static constexpr unsigned LIGHT7 = 0x4007; -static constexpr unsigned SPOT_EXPONENT = 0x1205; -static constexpr unsigned SPOT_CUTOFF = 0x1206; -static constexpr unsigned CONSTANT_ATTENUATION = 0x1207; -static constexpr unsigned LINEAR_ATTENUATION = 0x1208; -static constexpr unsigned QUADRATIC_ATTENUATION = 0x1209; -static constexpr unsigned AMBIENT = 0x1200; -static constexpr unsigned DIFFUSE = 0x1201; -static constexpr unsigned SPECULAR = 0x1202; -static constexpr unsigned SHININESS = 0x1601; -static constexpr unsigned EMISSION = 0x1600; -static constexpr unsigned POSITION = 0x1203; -static constexpr unsigned SPOT_DIRECTION = 0x1204; -static constexpr unsigned AMBIENT_AND_DIFFUSE = 0x1602; -static constexpr unsigned COLOR_INDEXES = 0x1603; -static constexpr unsigned LIGHT_MODEL_TWO_SIDE = 0x0B52; -static constexpr unsigned LIGHT_MODEL_LOCAL_VIEWER = 0x0B51; -static constexpr unsigned LIGHT_MODEL_AMBIENT = 0x0B53; -static constexpr unsigned SHADE_MODEL = 0x0B54; -static constexpr unsigned FLAT = 0x1D00; -static constexpr unsigned SMOOTH = 0x1D01; -static constexpr unsigned COLOR_MATERIAL = 0x0B57; -static constexpr unsigned COLOR_MATERIAL_FACE = 0x0B55; -static constexpr unsigned COLOR_MATERIAL_PARAMETER = 0x0B56; -static constexpr unsigned NORMALIZE = 0x0BA1; +#define GL_LIGHTING 0x0B50 +#define GL_LIGHT0 0x4000 +#define GL_LIGHT1 0x4001 +#define GL_LIGHT2 0x4002 +#define GL_LIGHT3 0x4003 +#define GL_LIGHT4 0x4004 +#define GL_LIGHT5 0x4005 +#define GL_LIGHT6 0x4006 +#define GL_LIGHT7 0x4007 +#define GL_SPOT_EXPONENT 0x1205 +#define GL_SPOT_CUTOFF 0x1206 +#define GL_CONSTANT_ATTENUATION 0x1207 +#define GL_LINEAR_ATTENUATION 0x1208 +#define GL_QUADRATIC_ATTENUATION 0x1209 +#define GL_AMBIENT 0x1200 +#define GL_DIFFUSE 0x1201 +#define GL_SPECULAR 0x1202 +#define GL_SHININESS 0x1601 +#define GL_EMISSION 0x1600 +#define GL_POSITION 0x1203 +#define GL_SPOT_DIRECTION 0x1204 +#define GL_AMBIENT_AND_DIFFUSE 0x1602 +#define GL_COLOR_INDEXES 0x1603 +#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52 +#define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51 +#define GL_LIGHT_MODEL_AMBIENT 0x0B53 +#define GL_SHADE_MODEL 0x0B54 +#define GL_FLAT 0x1D00 +#define GL_SMOOTH 0x1D01 +#define GL_COLOR_MATERIAL 0x0B57 +#define GL_COLOR_MATERIAL_FACE 0x0B55 +#define GL_COLOR_MATERIAL_PARAMETER 0x0B56 +#define GL_NORMALIZE 0x0BA1 // Matrix Mode -static constexpr unsigned MATRIX_MODE = 0x0BA0; -static constexpr unsigned MODELVIEW = 0x1700; -static constexpr unsigned PROJECTION = 0x1701; +#define GL_MATRIX_MODE 0x0BA0 +#define GL_MODELVIEW 0x1700 +#define GL_PROJECTION 0x1701 // multisample -static constexpr unsigned MULTISAMPLE = 0x809D; -static constexpr unsigned SAMPLE_POSITION = 0x8E50; +#define GL_MULTISAMPLE 0x809D +#define GL_SAMPLE_POSITION 0x8E50 // Points -static constexpr unsigned POINT_SMOOTH = 0x0B10; -static constexpr unsigned POINT_SIZE = 0x0B11; -static constexpr unsigned POINT_SIZE_GRANULARITY = 0x0B13; -static constexpr unsigned POINT_SIZE_RANGE = 0x0B12; +#define GL_POINT_SMOOTH 0x0B10 +#define GL_POINT_SIZE 0x0B11 +#define GL_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_POINT_SIZE_RANGE 0x0B12 // Lines -static constexpr unsigned LINE_SMOOTH = 0x0B20; -static constexpr unsigned LINE_STIPPLE = 0x0B24; -static constexpr unsigned LINE_STIPPLE_PATTERN = 0x0B25; -static constexpr unsigned LINE_STIPPLE_REPEAT = 0x0B26; -static constexpr unsigned LINE_WIDTH = 0x0B21; -static constexpr unsigned LINE_WIDTH_GRANULARITY = 0x0B23; -static constexpr unsigned LINE_WIDTH_RANGE = 0x0B22; +#define GL_LINE_SMOOTH 0x0B20 +#define GL_LINE_STIPPLE 0x0B24 +#define GL_LINE_STIPPLE_PATTERN 0x0B25 +#define GL_LINE_STIPPLE_REPEAT 0x0B26 +#define GL_LINE_WIDTH 0x0B21 +#define GL_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_LINE_WIDTH_RANGE 0x0B22 // PolygonMode -static constexpr unsigned POINT = 0x1B00; -static constexpr unsigned LINE = 0x1B01; -static constexpr unsigned FILL = 0x1B02; +#define GL_POINT 0x1B00 +#define GL_LINE 0x1B01 +#define GL_FILL 0x1B02 // Unsized formats -static constexpr unsigned STENCIL_INDEX = 0x1901; -static constexpr unsigned DEPTH_COMPONENT = 0x1902; -static constexpr unsigned DEPTH_STENCIL = 0x84F9; -static constexpr unsigned RED = 0x1903; -static constexpr unsigned RED_INTEGER = 0x8D94; -static constexpr unsigned GREEN = 0x1904; -static constexpr unsigned BLUE = 0x1905; -static constexpr unsigned ALPHA = 0x1906; -static constexpr unsigned LUMINANCE = 0x1909; -static constexpr unsigned LUMINANCE_ALPHA = 0x190A; -static constexpr unsigned RG_INTEGER = 0x8228; -static constexpr unsigned RGB = 0x1907; -static constexpr unsigned RGB_INTEGER = 0x8D98; -static constexpr unsigned SRGB = 0x8C40; -static constexpr unsigned RGBA = 0x1908; -static constexpr unsigned RG = 0x8227; -static constexpr unsigned SRGB_ALPHA = 0x8C42; -static constexpr unsigned RGBA_INTEGER = 0x8D99; -static constexpr unsigned BGRA = 0x80E1; +#define GL_STENCIL_INDEX 0x1901 +#define GL_DEPTH_COMPONENT 0x1902 +#define GL_DEPTH_STENCIL 0x84F9 +#define GL_RED 0x1903 +#define GL_RED_INTEGER 0x8D94 +#define GL_GREEN 0x1904 +#define GL_BLUE 0x1905 +#define GL_ALPHA 0x1906 +#define GL_LUMINANCE 0x1909 +#define GL_LUMINANCE_ALPHA 0x190A +#define GL_RG_INTEGER 0x8228 +#define GL_RGB 0x1907 +#define GL_RGB_INTEGER 0x8D98 +#define GL_SRGB 0x8C40 +#define GL_RGBA 0x1908 +#define GL_RG 0x8227 +#define GL_SRGB_ALPHA 0x8C42 +#define GL_RGBA_INTEGER 0x8D99 +#define GL_BGRA 0x80E1 // Stencil index sized formats -static constexpr unsigned STENCIL_INDEX4 = 0x8D47; -static constexpr unsigned STENCIL_INDEX8 = 0x8D48; -static constexpr unsigned STENCIL_INDEX16 = 0x8D49; +#define GL_STENCIL_INDEX4 0x8D47 +#define GL_STENCIL_INDEX8 0x8D48 +#define GL_STENCIL_INDEX16 0x8D49 // Depth component sized formats -static constexpr unsigned DEPTH_COMPONENT16 = 0x81A5; +#define GL_DEPTH_COMPONENT16 0x81A5 // Depth stencil sized formats -static constexpr unsigned DEPTH24_STENCIL8 = 0x88F0; +#define GL_DEPTH24_STENCIL8 0x88F0 // Red sized formats -static constexpr unsigned R8 = 0x8229; -static constexpr unsigned R16 = 0x822A; -static constexpr unsigned R16F = 0x822D; -static constexpr unsigned R32F = 0x822E; +#define GL_R8 0x8229 +#define GL_R16 0x822A +#define GL_R16F 0x822D +#define GL_R32F 0x822E // Red integer sized formats -static constexpr unsigned R8I = 0x8231; -static constexpr unsigned R8UI = 0x8232; -static constexpr unsigned R16I = 0x8233; -static constexpr unsigned R16UI = 0x8234; -static constexpr unsigned R32I = 0x8235; -static constexpr unsigned R32UI = 0x8236; +#define GL_R8I 0x8231 +#define GL_R8UI 0x8232 +#define GL_R16I 0x8233 +#define GL_R16UI 0x8234 +#define GL_R32I 0x8235 +#define GL_R32UI 0x8236 // Luminance sized formats -static constexpr unsigned LUMINANCE8 = 0x8040; -static constexpr unsigned LUMINANCE8_ALPHA8 = 0x8045; +#define GL_LUMINANCE8 0x8040 +#define GL_LUMINANCE8_ALPHA8 0x8045 // Alpha sized formats -static constexpr unsigned ALPHA8 = 0x803C; -static constexpr unsigned ALPHA16 = 0x803E; -static constexpr unsigned ALPHA16F = 0x881C; -static constexpr unsigned ALPHA32F = 0x8816; +#define GL_ALPHA8 0x803C +#define GL_ALPHA16 0x803E +#define GL_ALPHA16F 0x881C +#define GL_ALPHA32F 0x8816 // Alpha integer sized formats -static constexpr unsigned ALPHA8I = 0x8D90; -static constexpr unsigned ALPHA8UI = 0x8D7E; -static constexpr unsigned ALPHA16I = 0x8D8A; -static constexpr unsigned ALPHA16UI = 0x8D78; -static constexpr unsigned ALPHA32I = 0x8D84; -static constexpr unsigned ALPHA32UI = 0x8D72; +#define GL_ALPHA8I 0x8D90 +#define GL_ALPHA8UI 0x8D7E +#define GL_ALPHA16I 0x8D8A +#define GL_ALPHA16UI 0x8D78 +#define GL_ALPHA32I 0x8D84 +#define GL_ALPHA32UI 0x8D72 // RG sized formats -static constexpr unsigned RG8 = 0x822B; -static constexpr unsigned RG16 = 0x822C; +#define GL_RG8 0x822B +#define GL_RG16 0x822C // RG sized integer formats -static constexpr unsigned RG8I = 0x8237; -static constexpr unsigned RG8UI = 0x8238; -static constexpr unsigned RG16I = 0x8239; -static constexpr unsigned RG16UI = 0x823A; -static constexpr unsigned RG32I = 0x823B; -static constexpr unsigned RG32UI = 0x823C; +#define GL_RG8I 0x8237 +#define GL_RG8UI 0x8238 +#define GL_RG16I 0x8239 +#define GL_RG16UI 0x823A +#define GL_RG32I 0x823B +#define GL_RG32UI 0x823C // RGB sized formats -static constexpr unsigned RGB5 = 0x8050; -static constexpr unsigned RGB565 = 0x8D62; -static constexpr unsigned RGB8 = 0x8051; -static constexpr unsigned SRGB8 = 0x8C41; +#define GL_RGB5 0x8050 +#define GL_RGB565 0x8D62 +#define GL_RGB8 0x8051 +#define GL_SRGB8 0x8C41 // RGB integer sized formats -static constexpr unsigned RGB8I = 0x8D8F; -static constexpr unsigned RGB8UI = 0x8D7D; -static constexpr unsigned RGB16I = 0x8D89; -static constexpr unsigned RGB16UI = 0x8D77; -static constexpr unsigned RGB32I = 0x8D83; -static constexpr unsigned RGB32UI = 0x8D71; +#define GL_RGB8I 0x8D8F +#define GL_RGB8UI 0x8D7D +#define GL_RGB16I 0x8D89 +#define GL_RGB16UI 0x8D77 +#define GL_RGB32I 0x8D83 +#define GL_RGB32UI 0x8D71 // RGBA sized formats -static constexpr unsigned RGBA4 = 0x8056; -static constexpr unsigned RGB5_A1 = 0x8057; -static constexpr unsigned RGBA8 = 0x8058; -static constexpr unsigned RGB10_A2 = 0x8059; -static constexpr unsigned SRGB8_ALPHA8 = 0x8C43; -static constexpr unsigned RGBA16F = 0x881A; -static constexpr unsigned RGBA32F = 0x8814; -static constexpr unsigned RG32F = 0x8230; +#define GL_RGBA4 0x8056 +#define GL_RGB5_A1 0x8057 +#define GL_RGBA8 0x8058 +#define GL_RGB10_A2 0x8059 +#define GL_SRGB8_ALPHA8 0x8C43 +#define GL_RGBA16F 0x881A +#define GL_RGBA32F 0x8814 +#define GL_RG32F 0x8230 // RGBA integer sized formats -static constexpr unsigned RGBA8I = 0x8D8E; -static constexpr unsigned RGBA8UI = 0x8D7C; -static constexpr unsigned RGBA16I = 0x8D88; -static constexpr unsigned RGBA16UI = 0x8D76; -static constexpr unsigned RGBA32I = 0x8D82; -static constexpr unsigned RGBA32UI = 0x8D70; +#define GL_RGBA8I 0x8D8E +#define GL_RGBA8UI 0x8D7C +#define GL_RGBA16I 0x8D88 +#define GL_RGBA16UI 0x8D76 +#define GL_RGBA32I 0x8D82 +#define GL_RGBA32UI 0x8D70 // BGRA sized formats -static constexpr unsigned BGRA8 = 0x93A1; +#define GL_BGRA8 0x93A1 // PixelType -static constexpr unsigned UNSIGNED_SHORT_4_4_4_4 = 0x8033; -static constexpr unsigned UNSIGNED_SHORT_5_5_5_1 = 0x8034; -static constexpr unsigned UNSIGNED_SHORT_5_6_5 = 0x8363; -static constexpr unsigned UNSIGNED_INT_2_10_10_10_REV = 0x8368; +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 +#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 // Shaders -static constexpr unsigned FRAGMENT_SHADER = 0x8B30; -static constexpr unsigned VERTEX_SHADER = 0x8B31; -static constexpr unsigned GEOMETRY_SHADER = 0x8DD9; -static constexpr unsigned MAX_VERTEX_ATTRIBS = 0x8869; -static constexpr unsigned MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB; -static constexpr unsigned MAX_VARYING_VECTORS = 0x8DFC; -static constexpr unsigned MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D; -static constexpr unsigned MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8B4C; -static constexpr unsigned MAX_GEOMETRY_TEXTURE_IMAGE_UNITS = 0x8C29; -static constexpr unsigned MAX_TEXTURE_IMAGE_UNITS = 0x8872; -static constexpr unsigned MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD; -static constexpr unsigned SHADER_TYPE = 0x8B4F; -static constexpr unsigned DELETE_STATUS = 0x8B80; -static constexpr unsigned LINK_STATUS = 0x8B82; -static constexpr unsigned VALIDATE_STATUS = 0x8B83; -static constexpr unsigned ATTACHED_SHADERS = 0x8B85; -static constexpr unsigned ACTIVE_UNIFORMS = 0x8B86; -static constexpr unsigned ACTIVE_UNIFORM_MAX_LENGTH = 0x8B87; -static constexpr unsigned ACTIVE_ATTRIBUTES = 0x8B89; -static constexpr unsigned ACTIVE_ATTRIBUTE_MAX_LENGTH = 0x8B8A; -static constexpr unsigned SHADING_LANGUAGE_VERSION = 0x8B8C; -static constexpr unsigned CURRENT_PROGRAM = 0x8B8D; -static constexpr unsigned MAX_FRAGMENT_UNIFORM_COMPONENTS = 0x8B49; -static constexpr unsigned MAX_VERTEX_UNIFORM_COMPONENTS = 0x8B4A; -static constexpr unsigned MAX_SHADER_PIXEL_LOCAL_STORAGE_FAST_SIZE = 0x8F63; -static constexpr unsigned SHADER_BINARY_FORMATS = 0x8DF8; +#define GL_FRAGMENT_SHADER 0x8B30 +#define GL_VERTEX_SHADER 0x8B31 +#define GL_GEOMETRY_SHADER 0x8DD9 +#define GL_MAX_VERTEX_ATTRIBS 0x8869 +#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB +#define GL_MAX_VARYING_VECTORS 0x8DFC +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C +#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 0x8C29 +#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 +#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD +#define GL_SHADER_TYPE 0x8B4F +#define GL_DELETE_STATUS 0x8B80 +#define GL_LINK_STATUS 0x8B82 +#define GL_VALIDATE_STATUS 0x8B83 +#define GL_ATTACHED_SHADERS 0x8B85 +#define GL_ACTIVE_UNIFORMS 0x8B86 +#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 +#define GL_ACTIVE_ATTRIBUTES 0x8B89 +#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A +#define GL_SHADING_LANGUAGE_VERSION 0x8B8C +#define GL_CURRENT_PROGRAM 0x8B8D +#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 +#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A +#define GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_FAST_SIZE 0x8F63 +#define GL_SHADER_BINARY_FORMATS 0x8DF8 // StencilFunction -static constexpr unsigned NEVER = 0x0200; -static constexpr unsigned LESS = 0x0201; -static constexpr unsigned EQUAL = 0x0202; -static constexpr unsigned LEQUAL = 0x0203; -static constexpr unsigned GREATER = 0x0204; -static constexpr unsigned NOTEQUAL = 0x0205; -static constexpr unsigned GEQUAL = 0x0206; -static constexpr unsigned ALWAYS = 0x0207; +#define GL_NEVER 0x0200 +#define GL_LESS 0x0201 +#define GL_EQUAL 0x0202 +#define GL_LEQUAL 0x0203 +#define GL_GREATER 0x0204 +#define GL_NOTEQUAL 0x0205 +#define GL_GEQUAL 0x0206 +#define GL_ALWAYS 0x0207 // StencilOp -static constexpr unsigned KEEP = 0x1E00; -static constexpr unsigned REPLACE = 0x1E01; -static constexpr unsigned INCR = 0x1E02; -static constexpr unsigned DECR = 0x1E03; -static constexpr unsigned INVERT = 0x150A; -static constexpr unsigned INCR_WRAP = 0x8507; -static constexpr unsigned DECR_WRAP = 0x8508; +#define GL_KEEP 0x1E00 +#define GL_REPLACE 0x1E01 +#define GL_INCR 0x1E02 +#define GL_DECR 0x1E03 +#define GL_INVERT 0x150A +#define GL_INCR_WRAP 0x8507 +#define GL_DECR_WRAP 0x8508 // StringName -static constexpr unsigned VENDOR = 0x1F00; -static constexpr unsigned RENDERER = 0x1F01; -static constexpr unsigned VERSION = 0x1F02; -static constexpr unsigned EXTENSIONS = 0x1F03; +#define GL_VENDOR 0x1F00 +#define GL_RENDERER 0x1F01 +#define GL_VERSION 0x1F02 +#define GL_EXTENSIONS 0x1F03 // StringCounts -static constexpr unsigned NUM_EXTENSIONS = 0x821D; +#define GL_NUM_EXTENSIONS 0x821D // Pixel Mode / Transfer -static constexpr unsigned UNPACK_ROW_LENGTH = 0x0CF2; -static constexpr unsigned PACK_ROW_LENGTH = 0x0D02; +#define GL_UNPACK_ROW_LENGTH 0x0CF2 +#define GL_PACK_ROW_LENGTH 0x0D02 // TextureMagFilter -static constexpr unsigned NEAREST = 0x2600; -static constexpr unsigned LINEAR = 0x2601; +#define GL_NEAREST 0x2600 +#define GL_LINEAR 0x2601 // TextureMinFilter -static constexpr unsigned NEAREST_MIPMAP_NEAREST = 0x2700; -static constexpr unsigned LINEAR_MIPMAP_NEAREST = 0x2701; -static constexpr unsigned NEAREST_MIPMAP_LINEAR = 0x2702; -static constexpr unsigned LINEAR_MIPMAP_LINEAR = 0x2703; +#define GL_NEAREST_MIPMAP_NEAREST 0x2700 +#define GL_LINEAR_MIPMAP_NEAREST 0x2701 +#define GL_NEAREST_MIPMAP_LINEAR 0x2702 +#define GL_LINEAR_MIPMAP_LINEAR 0x2703 // TextureUsage -static constexpr unsigned FRAMEBUFFER_ATTACHMENT = 0x93A3; +#define GL_FRAMEBUFFER_ATTACHMENT 0x93A3 // TextureParameterName -static constexpr unsigned TEXTURE_MAG_FILTER = 0x2800; -static constexpr unsigned TEXTURE_MIN_FILTER = 0x2801; -static constexpr unsigned TEXTURE_WRAP_S = 0x2802; -static constexpr unsigned TEXTURE_WRAP_T = 0x2803; -static constexpr unsigned TEXTURE_USAGE = 0x93A2; +#define GL_TEXTURE_MAG_FILTER 0x2800 +#define GL_TEXTURE_MIN_FILTER 0x2801 +#define GL_TEXTURE_WRAP_S 0x2802 +#define GL_TEXTURE_WRAP_T 0x2803 +#define GL_TEXTURE_USAGE 0x93A2 // TextureTarget -static constexpr unsigned TEXTURE = 0x1702; -static constexpr unsigned TEXTURE_CUBE_MAP = 0x8513; -static constexpr unsigned TEXTURE_BINDING_CUBE_MAP = 0x8514; -static constexpr unsigned TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515; -static constexpr unsigned TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516; -static constexpr unsigned TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517; -static constexpr unsigned TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518; -static constexpr unsigned TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519; -static constexpr unsigned TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A; -static constexpr unsigned MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C; +#define GL_TEXTURE 0x1702 +#define GL_TEXTURE_CUBE_MAP 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C // TextureUnit -static constexpr unsigned TEXTURE0 = 0x84C0; -static constexpr unsigned TEXTURE1 = 0x84C1; -static constexpr unsigned TEXTURE2 = 0x84C2; -static constexpr unsigned TEXTURE3 = 0x84C3; -static constexpr unsigned TEXTURE4 = 0x84C4; -static constexpr unsigned TEXTURE5 = 0x84C5; -static constexpr unsigned TEXTURE6 = 0x84C6; -static constexpr unsigned TEXTURE7 = 0x84C7; -static constexpr unsigned TEXTURE8 = 0x84C8; -static constexpr unsigned TEXTURE9 = 0x84C9; -static constexpr unsigned TEXTURE10 = 0x84CA; -static constexpr unsigned TEXTURE11 = 0x84CB; -static constexpr unsigned TEXTURE12 = 0x84CC; -static constexpr unsigned TEXTURE13 = 0x84CD; -static constexpr unsigned TEXTURE14 = 0x84CE; -static constexpr unsigned TEXTURE15 = 0x84CF; -static constexpr unsigned TEXTURE16 = 0x84D0; -static constexpr unsigned TEXTURE17 = 0x84D1; -static constexpr unsigned TEXTURE18 = 0x84D2; -static constexpr unsigned TEXTURE19 = 0x84D3; -static constexpr unsigned TEXTURE20 = 0x84D4; -static constexpr unsigned TEXTURE21 = 0x84D5; -static constexpr unsigned TEXTURE22 = 0x84D6; -static constexpr unsigned TEXTURE23 = 0x84D7; -static constexpr unsigned TEXTURE24 = 0x84D8; -static constexpr unsigned TEXTURE25 = 0x84D9; -static constexpr unsigned TEXTURE26 = 0x84DA; -static constexpr unsigned TEXTURE27 = 0x84DB; -static constexpr unsigned TEXTURE28 = 0x84DC; -static constexpr unsigned TEXTURE29 = 0x84DD; -static constexpr unsigned TEXTURE30 = 0x84DE; -static constexpr unsigned TEXTURE31 = 0x84DF; -static constexpr unsigned ACTIVE_TEXTURE = 0x84E0; -static constexpr unsigned MAX_TEXTURE_UNITS = 0x84E2; -static constexpr unsigned MAX_TEXTURE_COORDS = 0x8871; +#define GL_TEXTURE0 0x84C0 +#define GL_TEXTURE1 0x84C1 +#define GL_TEXTURE2 0x84C2 +#define GL_TEXTURE3 0x84C3 +#define GL_TEXTURE4 0x84C4 +#define GL_TEXTURE5 0x84C5 +#define GL_TEXTURE6 0x84C6 +#define GL_TEXTURE7 0x84C7 +#define GL_TEXTURE8 0x84C8 +#define GL_TEXTURE9 0x84C9 +#define GL_TEXTURE10 0x84CA +#define GL_TEXTURE11 0x84CB +#define GL_TEXTURE12 0x84CC +#define GL_TEXTURE13 0x84CD +#define GL_TEXTURE14 0x84CE +#define GL_TEXTURE15 0x84CF +#define GL_TEXTURE16 0x84D0 +#define GL_TEXTURE17 0x84D1 +#define GL_TEXTURE18 0x84D2 +#define GL_TEXTURE19 0x84D3 +#define GL_TEXTURE20 0x84D4 +#define GL_TEXTURE21 0x84D5 +#define GL_TEXTURE22 0x84D6 +#define GL_TEXTURE23 0x84D7 +#define GL_TEXTURE24 0x84D8 +#define GL_TEXTURE25 0x84D9 +#define GL_TEXTURE26 0x84DA +#define GL_TEXTURE27 0x84DB +#define GL_TEXTURE28 0x84DC +#define GL_TEXTURE29 0x84DD +#define GL_TEXTURE30 0x84DE +#define GL_TEXTURE31 0x84DF +#define GL_ACTIVE_TEXTURE 0x84E0 +#define GL_MAX_TEXTURE_UNITS 0x84E2 +#define GL_MAX_TEXTURE_COORDS 0x8871 // TextureWrapMode -static constexpr unsigned REPEAT = 0x2901; -static constexpr unsigned CLAMP_TO_EDGE = 0x812F; -static constexpr unsigned MIRRORED_REPEAT = 0x8370; -static constexpr unsigned CLAMP_TO_BORDER = 0x812D; +#define GL_REPEAT 0x2901 +#define GL_CLAMP_TO_EDGE 0x812F +#define GL_MIRRORED_REPEAT 0x8370 +#define GL_CLAMP_TO_BORDER 0x812D // Texture Swizzle -static constexpr unsigned TEXTURE_SWIZZLE_R = 0x8E42; -static constexpr unsigned TEXTURE_SWIZZLE_G = 0x8E43; -static constexpr unsigned TEXTURE_SWIZZLE_B = 0x8E44; -static constexpr unsigned TEXTURE_SWIZZLE_A = 0x8E45; -static constexpr unsigned TEXTURE_SWIZZLE_RGBA = 0x8E46; +#define GL_TEXTURE_SWIZZLE_R 0x8E42 +#define GL_TEXTURE_SWIZZLE_G 0x8E43 +#define GL_TEXTURE_SWIZZLE_B 0x8E44 +#define GL_TEXTURE_SWIZZLE_A 0x8E45 +#define GL_TEXTURE_SWIZZLE_RGBA 0x8E46 // Texture mapping -static constexpr unsigned TEXTURE_ENV = 0x2300; -static constexpr unsigned TEXTURE_ENV_MODE = 0x2200; -static constexpr unsigned TEXTURE_1D = 0x0DE0; -static constexpr unsigned TEXTURE_ENV_COLOR = 0x2201; -static constexpr unsigned TEXTURE_GEN_S = 0x0C60; -static constexpr unsigned TEXTURE_GEN_T = 0x0C61; -static constexpr unsigned TEXTURE_GEN_R = 0x0C62; -static constexpr unsigned TEXTURE_GEN_Q = 0x0C63; -static constexpr unsigned TEXTURE_GEN_MODE = 0x2500; -static constexpr unsigned TEXTURE_BORDER_COLOR = 0x1004; -static constexpr unsigned TEXTURE_WIDTH = 0x1000; -static constexpr unsigned TEXTURE_HEIGHT = 0x1001; -static constexpr unsigned TEXTURE_BORDER = 0x1005; -static constexpr unsigned TEXTURE_COMPONENTS = 0x1003; -static constexpr unsigned TEXTURE_RED_SIZE = 0x805C; -static constexpr unsigned TEXTURE_GREEN_SIZE = 0x805D; -static constexpr unsigned TEXTURE_BLUE_SIZE = 0x805E; -static constexpr unsigned TEXTURE_ALPHA_SIZE = 0x805F; -static constexpr unsigned TEXTURE_LUMINANCE_SIZE = 0x8060; -static constexpr unsigned TEXTURE_INTENSITY_SIZE = 0x8061; -static constexpr unsigned TEXTURE_INTERNAL_FORMAT = 0x1003; -static constexpr unsigned OBJECT_LINEAR = 0x2401; -static constexpr unsigned OBJECT_PLANE = 0x2501; -static constexpr unsigned EYE_LINEAR = 0x2400; -static constexpr unsigned EYE_PLANE = 0x2502; -static constexpr unsigned SPHERE_MAP = 0x2402; -static constexpr unsigned DECAL = 0x2101; -static constexpr unsigned MODULATE = 0x2100; -static constexpr unsigned CLAMP = 0x2900; -static constexpr unsigned S = 0x2000; -static constexpr unsigned T = 0x2001; -static constexpr unsigned R = 0x2002; -static constexpr unsigned Q = 0x2003; +#define GL_TEXTURE_ENV 0x2300 +#define GL_TEXTURE_ENV_MODE 0x2200 +#define GL_TEXTURE_1D 0x0DE0 +#define GL_TEXTURE_ENV_COLOR 0x2201 +#define GL_TEXTURE_GEN_S 0x0C60 +#define GL_TEXTURE_GEN_T 0x0C61 +#define GL_TEXTURE_GEN_R 0x0C62 +#define GL_TEXTURE_GEN_Q 0x0C63 +#define GL_TEXTURE_GEN_MODE 0x2500 +#define GL_TEXTURE_BORDER_COLOR 0x1004 +#define GL_TEXTURE_WIDTH 0x1000 +#define GL_TEXTURE_HEIGHT 0x1001 +#define GL_TEXTURE_BORDER 0x1005 +#define GL_TEXTURE_COMPONENTS 0x1003 +#define GL_TEXTURE_RED_SIZE 0x805C +#define GL_TEXTURE_GREEN_SIZE 0x805D +#define GL_TEXTURE_BLUE_SIZE 0x805E +#define GL_TEXTURE_ALPHA_SIZE 0x805F +#define GL_TEXTURE_LUMINANCE_SIZE 0x8060 +#define GL_TEXTURE_INTENSITY_SIZE 0x8061 +#define GL_TEXTURE_INTERNAL_FORMAT 0x1003 +#define GL_OBJECT_LINEAR 0x2401 +#define GL_OBJECT_PLANE 0x2501 +#define GL_EYE_LINEAR 0x2400 +#define GL_EYE_PLANE 0x2502 +#define GL_SPHERE_MAP 0x2402 +#define GL_DECAL 0x2101 +#define GL_MODULATE 0x2100 +#define GL_CLAMP 0x2900 +#define GL_S 0x2000 +#define GL_T 0x2001 +#define GL_R 0x2002 +#define GL_Q 0x2003 // texture_env_combine -static constexpr unsigned COMBINE = 0x8570; -static constexpr unsigned COMBINE_RGB = 0x8571; -static constexpr unsigned COMBINE_ALPHA = 0x8572; -static constexpr unsigned SOURCE0_RGB = 0x8580; -static constexpr unsigned SOURCE1_RGB = 0x8581; -static constexpr unsigned SOURCE2_RGB = 0x8582; -static constexpr unsigned SOURCE0_ALPHA = 0x8588; -static constexpr unsigned SOURCE1_ALPHA = 0x8589; -static constexpr unsigned SOURCE2_ALPHA = 0x858A; -static constexpr unsigned OPERAND0_RGB = 0x8590; -static constexpr unsigned OPERAND1_RGB = 0x8591; -static constexpr unsigned OPERAND2_RGB = 0x8592; -static constexpr unsigned OPERAND0_ALPHA = 0x8598; -static constexpr unsigned OPERAND1_ALPHA = 0x8599; -static constexpr unsigned OPERAND2_ALPHA = 0x859A; -static constexpr unsigned RGB_SCALE = 0x8573; -static constexpr unsigned ADD_SIGNED = 0x8574; -static constexpr unsigned INTERPOLATE = 0x8575; -static constexpr unsigned SUBTRACT = 0x84E7; -static constexpr unsigned CONSTANT = 0x8576; -static constexpr unsigned PRIMARY_COLOR = 0x8577; -static constexpr unsigned PREVIOUS = 0x8578; -static constexpr unsigned SRC0_RGB = 0x8580; -static constexpr unsigned SRC1_RGB = 0x8581; -static constexpr unsigned SRC2_RGB = 0x8582; -static constexpr unsigned SRC0_ALPHA = 0x8588; -static constexpr unsigned SRC1_ALPHA = 0x8589; -static constexpr unsigned SRC2_ALPHA = 0x858A; +#define GL_COMBINE 0x8570 +#define GL_COMBINE_RGB 0x8571 +#define GL_COMBINE_ALPHA 0x8572 +#define GL_SOURCE0_RGB 0x8580 +#define GL_SOURCE1_RGB 0x8581 +#define GL_SOURCE2_RGB 0x8582 +#define GL_SOURCE0_ALPHA 0x8588 +#define GL_SOURCE1_ALPHA 0x8589 +#define GL_SOURCE2_ALPHA 0x858A +#define GL_OPERAND0_RGB 0x8590 +#define GL_OPERAND1_RGB 0x8591 +#define GL_OPERAND2_RGB 0x8592 +#define GL_OPERAND0_ALPHA 0x8598 +#define GL_OPERAND1_ALPHA 0x8599 +#define GL_OPERAND2_ALPHA 0x859A +#define GL_RGB_SCALE 0x8573 +#define GL_ADD_SIGNED 0x8574 +#define GL_INTERPOLATE 0x8575 +#define GL_SUBTRACT 0x84E7 +#define GL_CONSTANT 0x8576 +#define GL_PRIMARY_COLOR 0x8577 +#define GL_PREVIOUS 0x8578 +#define GL_SRC0_RGB 0x8580 +#define GL_SRC1_RGB 0x8581 +#define GL_SRC2_RGB 0x8582 +#define GL_SRC0_ALPHA 0x8588 +#define GL_SRC1_ALPHA 0x8589 +#define GL_SRC2_ALPHA 0x858A // Uniform Types -static constexpr unsigned FLOAT_VEC2 = 0x8B50; -static constexpr unsigned FLOAT_VEC3 = 0x8B51; -static constexpr unsigned FLOAT_VEC4 = 0x8B52; -static constexpr unsigned INT_VEC2 = 0x8B53; -static constexpr unsigned INT_VEC3 = 0x8B54; -static constexpr unsigned INT_VEC4 = 0x8B55; -static constexpr unsigned BOOL = 0x8B56; -static constexpr unsigned BOOL_VEC2 = 0x8B57; -static constexpr unsigned BOOL_VEC3 = 0x8B58; -static constexpr unsigned BOOL_VEC4 = 0x8B59; -static constexpr unsigned FLOAT_MAT2 = 0x8B5A; -static constexpr unsigned FLOAT_MAT3 = 0x8B5B; -static constexpr unsigned FLOAT_MAT4 = 0x8B5C; -static constexpr unsigned SAMPLER_2D = 0x8B5E; -static constexpr unsigned SAMPLER_CUBE = 0x8B60; +#define GL_FLOAT_VEC2 0x8B50 +#define GL_FLOAT_VEC3 0x8B51 +#define GL_FLOAT_VEC4 0x8B52 +#define GL_INT_VEC2 0x8B53 +#define GL_INT_VEC3 0x8B54 +#define GL_INT_VEC4 0x8B55 +#define GL_BOOL 0x8B56 +#define GL_BOOL_VEC2 0x8B57 +#define GL_BOOL_VEC3 0x8B58 +#define GL_BOOL_VEC4 0x8B59 +#define GL_FLOAT_MAT2 0x8B5A +#define GL_FLOAT_MAT3 0x8B5B +#define GL_FLOAT_MAT4 0x8B5C +#define GL_SAMPLER_2D 0x8B5E +#define GL_SAMPLER_CUBE 0x8B60 // Vertex Arrays -static constexpr unsigned VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622; -static constexpr unsigned VERTEX_ATTRIB_ARRAY_SIZE = 0x8623; -static constexpr unsigned VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624; -static constexpr unsigned VERTEX_ATTRIB_ARRAY_TYPE = 0x8625; -static constexpr unsigned VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A; -static constexpr unsigned VERTEX_ATTRIB_ARRAY_POINTER = 0x8645; -static constexpr unsigned VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F; -static constexpr unsigned VERTEX_ARRAY = 0x8074; -static constexpr unsigned NORMAL_ARRAY = 0x8075; -static constexpr unsigned COLOR_ARRAY = 0x8076; -static constexpr unsigned SECONDARY_COLOR_ARRAY = 0x845E; -static constexpr unsigned INDEX_ARRAY = 0x8077; -static constexpr unsigned TEXTURE_COORD_ARRAY = 0x8078; -static constexpr unsigned EDGE_FLAG_ARRAY = 0x8079; -static constexpr unsigned VERTEX_ARRAY_SIZE = 0x807A; -static constexpr unsigned VERTEX_ARRAY_TYPE = 0x807B; -static constexpr unsigned VERTEX_ARRAY_STRIDE = 0x807C; -static constexpr unsigned NORMAL_ARRAY_TYPE = 0x807E; -static constexpr unsigned NORMAL_ARRAY_STRIDE = 0x807F; -static constexpr unsigned COLOR_ARRAY_SIZE = 0x8081; -static constexpr unsigned COLOR_ARRAY_TYPE = 0x8082; -static constexpr unsigned COLOR_ARRAY_STRIDE = 0x8083; -static constexpr unsigned INDEX_ARRAY_TYPE = 0x8085; -static constexpr unsigned INDEX_ARRAY_STRIDE = 0x8086; -static constexpr unsigned TEXTURE_COORD_ARRAY_SIZE = 0x8088; -static constexpr unsigned TEXTURE_COORD_ARRAY_TYPE = 0x8089; -static constexpr unsigned TEXTURE_COORD_ARRAY_STRIDE = 0x808A; -static constexpr unsigned EDGE_FLAG_ARRAY_STRIDE = 0x808C; -static constexpr unsigned VERTEX_ARRAY_POINTER = 0x808E; -static constexpr unsigned NORMAL_ARRAY_POINTER = 0x808F; -static constexpr unsigned COLOR_ARRAY_POINTER = 0x8090; -static constexpr unsigned INDEX_ARRAY_POINTER = 0x8091; -static constexpr unsigned TEXTURE_COORD_ARRAY_POINTER = 0x8092; -static constexpr unsigned EDGE_FLAG_ARRAY_POINTER = 0x8093; -static constexpr unsigned V2F = 0x2A20; -static constexpr unsigned V3F = 0x2A21; -static constexpr unsigned C4UB_V2F = 0x2A22; -static constexpr unsigned C4UB_V3F = 0x2A23; -static constexpr unsigned C3F_V3F = 0x2A24; -static constexpr unsigned N3F_V3F = 0x2A25; -static constexpr unsigned C4F_N3F_V3F = 0x2A26; -static constexpr unsigned T2F_V3F = 0x2A27; -static constexpr unsigned T4F_V4F = 0x2A28; -static constexpr unsigned T2F_C4UB_V3F = 0x2A29; -static constexpr unsigned T2F_C3F_V3F = 0x2A2A; -static constexpr unsigned T2F_N3F_V3F = 0x2A2B; -static constexpr unsigned T2F_C4F_N3F_V3F = 0x2A2C; -static constexpr unsigned T4F_C4F_N3F_V4F = 0x2A2D; -static constexpr unsigned PRIMITIVE_RESTART_FIXED_INDEX = 0x8D69; +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A +#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F +#define GL_VERTEX_ARRAY 0x8074 +#define GL_NORMAL_ARRAY 0x8075 +#define GL_COLOR_ARRAY 0x8076 +#define GL_SECONDARY_COLOR_ARRAY 0x845E +#define GL_INDEX_ARRAY 0x8077 +#define GL_TEXTURE_COORD_ARRAY 0x8078 +#define GL_EDGE_FLAG_ARRAY 0x8079 +#define GL_VERTEX_ARRAY_SIZE 0x807A +#define GL_VERTEX_ARRAY_TYPE 0x807B +#define GL_VERTEX_ARRAY_STRIDE 0x807C +#define GL_NORMAL_ARRAY_TYPE 0x807E +#define GL_NORMAL_ARRAY_STRIDE 0x807F +#define GL_COLOR_ARRAY_SIZE 0x8081 +#define GL_COLOR_ARRAY_TYPE 0x8082 +#define GL_COLOR_ARRAY_STRIDE 0x8083 +#define GL_INDEX_ARRAY_TYPE 0x8085 +#define GL_INDEX_ARRAY_STRIDE 0x8086 +#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088 +#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089 +#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A +#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C +#define GL_VERTEX_ARRAY_POINTER 0x808E +#define GL_NORMAL_ARRAY_POINTER 0x808F +#define GL_COLOR_ARRAY_POINTER 0x8090 +#define GL_INDEX_ARRAY_POINTER 0x8091 +#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092 +#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093 +#define GL_V2F 0x2A20 +#define GL_V3F 0x2A21 +#define GL_C4UB_V2F 0x2A22 +#define GL_C4UB_V3F 0x2A23 +#define GL_C3F_V3F 0x2A24 +#define GL_N3F_V3F 0x2A25 +#define GL_C4F_N3F_V3F 0x2A26 +#define GL_T2F_V3F 0x2A27 +#define GL_T4F_V4F 0x2A28 +#define GL_T2F_C4UB_V3F 0x2A29 +#define GL_T2F_C3F_V3F 0x2A2A +#define GL_T2F_N3F_V3F 0x2A2B +#define GL_T2F_C4F_N3F_V3F 0x2A2C +#define GL_T4F_C4F_N3F_V4F 0x2A2D +#define GL_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69 // Buffer Object -static constexpr unsigned READ_ONLY = 0x88B8; -static constexpr unsigned WRITE_ONLY = 0x88B9; -static constexpr unsigned READ_WRITE = 0x88BA; -static constexpr unsigned BUFFER_MAPPED = 0x88BC; - -static constexpr unsigned MAP_READ_BIT = 0x0001; -static constexpr unsigned MAP_WRITE_BIT = 0x0002; -static constexpr unsigned MAP_INVALIDATE_RANGE_BIT = 0x0004; -static constexpr unsigned MAP_INVALIDATE_BUFFER_BIT = 0x0008; -static constexpr unsigned MAP_FLUSH_EXPLICIT_BIT = 0x0010; -static constexpr unsigned MAP_UNSYNCHRONIZED_BIT = 0x0020; +#define GL_READ_ONLY 0x88B8 +#define GL_WRITE_ONLY 0x88B9 +#define GL_READ_WRITE 0x88BA +#define GL_BUFFER_MAPPED 0x88BC + +#define GL_MAP_READ_BIT 0x0001 +#define GL_MAP_WRITE_BIT 0x0002 +#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004 +#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008 +#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010 +#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020 // Read Format -static constexpr unsigned IMPLEMENTATION_COLOR_READ_TYPE = 0x8B9A; -static constexpr unsigned IMPLEMENTATION_COLOR_READ_FORMAT = 0x8B9B; +#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A +#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B // Shader Source -static constexpr unsigned COMPILE_STATUS = 0x8B81; -static constexpr unsigned INFO_LOG_LENGTH = 0x8B84; -static constexpr unsigned SHADER_SOURCE_LENGTH = 0x8B88; -static constexpr unsigned SHADER_COMPILER = 0x8DFA; +#define GL_COMPILE_STATUS 0x8B81 +#define GL_INFO_LOG_LENGTH 0x8B84 +#define GL_SHADER_SOURCE_LENGTH 0x8B88 +#define GL_SHADER_COMPILER 0x8DFA // Shader Binary -static constexpr unsigned NUM_SHADER_BINARY_FORMATS = 0x8DF9; +#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 // Program Binary -static constexpr unsigned NUM_PROGRAM_BINARY_FORMATS = 0x87FE; +#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE // Shader Precision-Specified Types -static constexpr unsigned LOW_FLOAT = 0x8DF0; -static constexpr unsigned MEDIUM_FLOAT = 0x8DF1; -static constexpr unsigned HIGH_FLOAT = 0x8DF2; -static constexpr unsigned LOW_INT = 0x8DF3; -static constexpr unsigned MEDIUM_INT = 0x8DF4; -static constexpr unsigned HIGH_INT = 0x8DF5; +#define GL_LOW_FLOAT 0x8DF0 +#define GL_MEDIUM_FLOAT 0x8DF1 +#define GL_HIGH_FLOAT 0x8DF2 +#define GL_LOW_INT 0x8DF3 +#define GL_MEDIUM_INT 0x8DF4 +#define GL_HIGH_INT 0x8DF5 // Queries -static constexpr unsigned QUERY_COUNTER_BITS = 0x8864; -static constexpr unsigned CURRENT_QUERY = 0x8865; -static constexpr unsigned QUERY_RESULT = 0x8866; -static constexpr unsigned QUERY_RESULT_AVAILABLE = 0x8867; -static constexpr unsigned SAMPLES_PASSED = 0x8914; -static constexpr unsigned ANY_SAMPLES_PASSED = 0x8C2F; -static constexpr unsigned TIME_ELAPSED = 0x88BF; -static constexpr unsigned TIMESTAMP = 0x8E28; -static constexpr unsigned PRIMITIVES_GENERATED = 0x8C87; -static constexpr unsigned TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN = 0x8C88; +#define GL_QUERY_COUNTER_BITS 0x8864 +#define GL_CURRENT_QUERY 0x8865 +#define GL_QUERY_RESULT 0x8866 +#define GL_QUERY_RESULT_AVAILABLE 0x8867 +#define GL_SAMPLES_PASSED 0x8914 +#define GL_ANY_SAMPLES_PASSED 0x8C2F +#define GL_TIME_ELAPSED 0x88BF +#define GL_TIMESTAMP 0x8E28 +#define GL_PRIMITIVES_GENERATED 0x8C87 +#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88 // Framebuffer Object. -static constexpr unsigned FRAMEBUFFER = 0x8D40; -static constexpr unsigned DRAW_FRAMEBUFFER_BINDING = 0x8CA6; -static constexpr unsigned READ_FRAMEBUFFER = 0x8CA8; -static constexpr unsigned DRAW_FRAMEBUFFER = 0x8CA9; -static constexpr unsigned READ_FRAMEBUFFER_BINDING = 0x8CAA; - -static constexpr unsigned RENDERBUFFER = 0x8D41; - -static constexpr unsigned MAX_SAMPLES = 0x8D57; -static constexpr unsigned MAX_SAMPLES_IMG = 0x9135; - -static constexpr unsigned RENDERBUFFER_WIDTH = 0x8D42; -static constexpr unsigned RENDERBUFFER_HEIGHT = 0x8D43; -static constexpr unsigned RENDERBUFFER_INTERNAL_FORMAT = 0x8D44; -static constexpr unsigned RENDERBUFFER_RED_SIZE = 0x8D50; -static constexpr unsigned RENDERBUFFER_GREEN_SIZE = 0x8D51; -static constexpr unsigned RENDERBUFFER_BLUE_SIZE = 0x8D52; -static constexpr unsigned RENDERBUFFER_ALPHA_SIZE = 0x8D53; -static constexpr unsigned RENDERBUFFER_DEPTH_SIZE = 0x8D54; -static constexpr unsigned RENDERBUFFER_STENCIL_SIZE = 0x8D55; - -static constexpr unsigned FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8CD0; -static constexpr unsigned FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1; -static constexpr unsigned FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2; -static constexpr unsigned FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3; -static constexpr unsigned FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER = 0x8CD4; -static constexpr unsigned FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING = 0x8210; -static constexpr unsigned FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE = 0x8211; -static constexpr unsigned FRAMEBUFFER_ATTACHMENT_RED_SIZE = 0x8212; -static constexpr unsigned FRAMEBUFFER_ATTACHMENT_GREEN_SIZE = 0x8213; -static constexpr unsigned FRAMEBUFFER_ATTACHMENT_BLUE_SIZE = 0x8214; -static constexpr unsigned FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE = 0x8215; -static constexpr unsigned FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE = 0x8216; -static constexpr unsigned FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE = 0x8217; - -static constexpr unsigned COLOR_ATTACHMENT0 = 0x8CE0; -static constexpr unsigned DEPTH_ATTACHMENT = 0x8D00; -static constexpr unsigned STENCIL_ATTACHMENT = 0x8D20; +#define GL_FRAMEBUFFER 0x8D40 +#define GL_DRAW_FRAMEBUFFER_BINDING 0x8CA6 +#define GL_READ_FRAMEBUFFER 0x8CA8 +#define GL_DRAW_FRAMEBUFFER 0x8CA9 +#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA + +#define GL_RENDERBUFFER 0x8D41 + +#define GL_MAX_SAMPLES 0x8D57 +#define GL_MAX_SAMPLES_IMG 0x9135 + +#define GL_RENDERBUFFER_WIDTH 0x8D42 +#define GL_RENDERBUFFER_HEIGHT 0x8D43 +#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 +#define GL_RENDERBUFFER_RED_SIZE 0x8D50 +#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 +#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 +#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 +#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 +#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 + +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4 +#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210 +#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211 +#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212 +#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213 +#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214 +#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215 +#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216 +#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217 + +#define GL_COLOR_ATTACHMENT0 0x8CE0 +#define GL_DEPTH_ATTACHMENT 0x8D00 +#define GL_STENCIL_ATTACHMENT 0x8D20 // EXT_discard_framebuffer -static constexpr unsigned COLOR = 0x1800; -static constexpr unsigned DEPTH = 0x1801; -static constexpr unsigned STENCIL = 0x1802; +#define GL_COLOR 0x1800 +#define GL_DEPTH 0x1801 +#define GL_STENCIL 0x1802 -static constexpr unsigned NONE = 0; -static constexpr unsigned FRAMEBUFFER_DEFAULT = 0x8218; +#define GL_NONE 0 +#define GL_FRAMEBUFFER_DEFAULT 0x8218 -static constexpr unsigned FRAMEBUFFER_COMPLETE = 0x8CD5; -static constexpr unsigned FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6; -static constexpr unsigned FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7; -static constexpr unsigned FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0x8CD9; -static constexpr unsigned FRAMEBUFFER_UNSUPPORTED = 0x8CDD; +#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 +#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9 +#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD -static constexpr unsigned FRAMEBUFFER_BINDING = 0x8CA6; -static constexpr unsigned RENDERBUFFER_BINDING = 0x8CA7; -static constexpr unsigned MAX_RENDERBUFFER_SIZE = 0x84E8; +#define GL_FRAMEBUFFER_BINDING 0x8CA6 +#define GL_RENDERBUFFER_BINDING 0x8CA7 +#define GL_MAX_RENDERBUFFER_SIZE 0x84E8 -static constexpr unsigned INVALID_FRAMEBUFFER_OPERATION = 0x0506; +#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 // OES -static constexpr unsigned TEXTURE_EXTERNAL_OES = 0x8D65; -static constexpr unsigned TEXTURE_BINDING_EXTERNAL_OES = 0x8d67; -static constexpr unsigned DEPTH_STENCIL_OES = 0x84F9; -static constexpr unsigned UNSIGNED_INT_24_8_OES = 0x84FA; -static constexpr unsigned DEPTH24_STENCIL8_OES = 0x88F0; +#define GL_TEXTURE_EXTERNAL_OES 0x8D65 +#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8d67 +#define GL_DEPTH_STENCIL_OES 0x84F9 +#define GL_UNSIGNED_INT_24_8_OES 0x84FA +#define GL_DEPTH24_STENCIL8_OES 0x88F0 /* ARB_internalformat_query */ -static constexpr unsigned NUM_SAMPLE_COUNTS = 0x9380; +#define GL_NUM_SAMPLE_COUNTS 0x9380 /* ARM specific define for MSAA support on framebuffer fetch */ -static constexpr unsigned FETCH_PER_SAMPLE_ARM = 0x8F65; +#define GL_FETCH_PER_SAMPLE_ARM 0x8F65 + +#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117 +#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull -static constexpr unsigned SYNC_GPU_COMMANDS_COMPLETE = 0x9117; -static constexpr uint64_t TIMEOUT_IGNORED = 0xFFFFFFFFFFFFFFFFull; -} // namespace GL +#endif +} // namespace tgfx diff --git a/tgfx/src/gpu/opengl/GLDrawer.cpp b/tgfx/src/gpu/opengl/GLDrawer.cpp index 71db429ca3..d6f58b7f0b 100644 --- a/tgfx/src/gpu/opengl/GLDrawer.cpp +++ b/tgfx/src/gpu/opengl/GLDrawer.cpp @@ -33,10 +33,10 @@ struct AttribLayout { }; static constexpr std::pair attribLayoutPair[] = { - {ShaderVar::Type::Float, {false, 1, GL::FLOAT}}, - {ShaderVar::Type::Float2, {false, 2, GL::FLOAT}}, - {ShaderVar::Type::Float3, {false, 3, GL::FLOAT}}, - {ShaderVar::Type::Float4, {false, 4, GL::FLOAT}}}; + {ShaderVar::Type::Float, {false, 1, GL_FLOAT}}, + {ShaderVar::Type::Float2, {false, 2, GL_FLOAT}}, + {ShaderVar::Type::Float3, {false, 3, GL_FLOAT}}, + {ShaderVar::Type::Float4, {false, 4, GL_FLOAT}}}; static AttribLayout GetAttribLayout(ShaderVar::Type type) { for (const auto& pair : attribLayoutPair) { @@ -122,7 +122,7 @@ static std::shared_ptr CreateDstTexture(const DrawArgs& args, Point* ds } GLStateGuard stateGuard(args.context); auto renderTarget = static_cast(args.renderTarget); - gl->bindFramebuffer(GL::FRAMEBUFFER, renderTarget->glFrameBuffer().id); + gl->bindFramebuffer(GL_FRAMEBUFFER, renderTarget->glFrameBuffer().id); auto glSampler = std::static_pointer_cast(dstTexture)->glSampler(); gl->bindTexture(glSampler.target, glSampler.id); // format != BGRA && !srcHasMSAARenderBuffer && !dstHasMSAARenderBuffer && dstIsTextureable && @@ -144,9 +144,9 @@ static PixelFormat GetOutputPixelFormat(const DrawArgs& args) { static void UpdateScissor(const GLInterface* gl, const DrawArgs& args) { if (args.scissorRect.isEmpty()) { - gl->disable(GL::SCISSOR_TEST); + gl->disable(GL_SCISSOR_TEST); } else { - gl->enable(GL::SCISSOR_TEST); + gl->enable(GL_SCISSOR_TEST); gl->scissor(static_cast(args.scissorRect.x()), static_cast(args.scissorRect.y()), static_cast(args.scissorRect.width()), static_cast(args.scissorRect.height())); @@ -155,13 +155,13 @@ static void UpdateScissor(const GLInterface* gl, const DrawArgs& args) { static void UpdateBlend(const GLInterface* gl, bool blendAsCoeff, unsigned first, unsigned second) { if (blendAsCoeff) { - gl->enable(GL::BLEND); + gl->enable(GL_BLEND); gl->blendFunc(first, second); - gl->blendEquation(GL::FUNC_ADD); + gl->blendEquation(GL_FUNC_ADD); } else { - gl->disable(GL::BLEND); + gl->disable(GL_BLEND); if (gl->caps->frameBufferFetchSupport && gl->caps->frameBufferFetchRequiresEnablePerSample) { - gl->enable(GL::FETCH_PER_SAMPLE_ARM); + gl->enable(GL_FETCH_PER_SAMPLE_ARM); } } } @@ -203,7 +203,7 @@ void GLDrawer::draw(DrawArgs args, std::unique_ptr op) const { CheckGLError(gl); auto renderTarget = static_cast(args.renderTarget); gl->useProgram(program->programID()); - gl->bindFramebuffer(GL::FRAMEBUFFER, renderTarget->glFrameBuffer().id); + gl->bindFramebuffer(GL_FRAMEBUFFER, renderTarget->glFrameBuffer().id); gl->viewport(0, 0, renderTarget->width(), renderTarget->height()); UpdateScissor(gl, args); UpdateBlend(gl, blendAsCoeff, first, second); @@ -214,10 +214,10 @@ void GLDrawer::draw(DrawArgs args, std::unique_ptr op) const { if (vertexArray > 0) { gl->bindVertexArray(vertexArray); } - gl->bindBuffer(GL::ARRAY_BUFFER, vertexBuffer); + gl->bindBuffer(GL_ARRAY_BUFFER, vertexBuffer); auto vertices = op->vertices(args); - gl->bufferData(GL::ARRAY_BUFFER, static_cast(vertices.size()) * sizeof(float), - &vertices[0], GL::STATIC_DRAW); + gl->bufferData(GL_ARRAY_BUFFER, static_cast(vertices.size()) * sizeof(float), + &vertices[0], GL_STATIC_DRAW); for (const auto& attribute : program->vertexAttributes()) { const AttribLayout& layout = GetAttribLayout(attribute.gpuType); gl->vertexAttribPointer(static_cast(attribute.location), layout.count, layout.type, @@ -225,14 +225,14 @@ void GLDrawer::draw(DrawArgs args, std::unique_ptr op) const { reinterpret_cast(attribute.offset)); gl->enableVertexAttribArray(static_cast(attribute.location)); } - gl->bindBuffer(GL::ARRAY_BUFFER, 0); + gl->bindBuffer(GL_ARRAY_BUFFER, 0); auto indexBuffer = op->getIndexBuffer(args); if (indexBuffer) { - gl->bindBuffer(GL::ELEMENT_ARRAY_BUFFER, indexBuffer->bufferID()); - gl->drawElements(GL::TRIANGLES, static_cast(indexBuffer->length()), GL::UNSIGNED_SHORT, 0); - gl->bindBuffer(GL::ELEMENT_ARRAY_BUFFER, 0); + gl->bindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer->bufferID()); + gl->drawElements(GL_TRIANGLES, static_cast(indexBuffer->length()), GL_UNSIGNED_SHORT, 0); + gl->bindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); } else { - gl->drawArrays(GL::TRIANGLE_STRIP, 0, 4); + gl->drawArrays(GL_TRIANGLE_STRIP, 0, 4); } if (vertexArray > 0) { gl->bindVertexArray(0); diff --git a/tgfx/src/gpu/opengl/GLInterface.cpp b/tgfx/src/gpu/opengl/GLInterface.cpp index 78b2aed064..253be1d4e8 100644 --- a/tgfx/src/gpu/opengl/GLInterface.cpp +++ b/tgfx/src/gpu/opengl/GLInterface.cpp @@ -39,7 +39,7 @@ static int GetGLVersion(const GLProcGetter* getter) { if (glGetString == nullptr) { return -1; } - auto versionString = (const char*)glGetString(GL::VERSION); + auto versionString = (const char*)glGetString(GL_VERSION); return GetGLVersion(versionString).majorVersion; } diff --git a/tgfx/src/gpu/opengl/GLProgram.cpp b/tgfx/src/gpu/opengl/GLProgram.cpp index 89c9984fa2..21fe327d5b 100644 --- a/tgfx/src/gpu/opengl/GLProgram.cpp +++ b/tgfx/src/gpu/opengl/GLProgram.cpp @@ -61,7 +61,7 @@ void GLProgram::onRelease(Context* context) { static void BindGLTexture(const GLInterface* gl, int position, const TextureSampler* sampler) { auto glSampler = static_cast(sampler); - ActiveGLTexture(gl, GL::TEXTURE0 + position, glSampler->target, glSampler->id, glSampler->format); + ActiveGLTexture(gl, GL_TEXTURE0 + position, glSampler->target, glSampler->id, glSampler->format); } void GLProgram::updateUniformsAndTextureBindings(const GLInterface* gl, diff --git a/tgfx/src/gpu/opengl/GLProgramDataManager.cpp b/tgfx/src/gpu/opengl/GLProgramDataManager.cpp index f689093cd3..16c756511f 100644 --- a/tgfx/src/gpu/opengl/GLProgramDataManager.cpp +++ b/tgfx/src/gpu/opengl/GLProgramDataManager.cpp @@ -51,7 +51,7 @@ void GLProgramDataManager::set4fv(UniformHandle handle, int arrayCount, const fl void GLProgramDataManager::setMatrix3f(UniformHandle handle, const float matrix[]) const { auto location = uniforms->at(handle.toIndex()); if (kUnusedUniform != location) { - gl->uniformMatrix3fv(location, 1, GL::FALSE, matrix); + gl->uniformMatrix3fv(location, 1, GL_FALSE, matrix); } } diff --git a/tgfx/src/gpu/opengl/GLRenderTarget.cpp b/tgfx/src/gpu/opengl/GLRenderTarget.cpp index da81de7c45..8aec4dec6f 100644 --- a/tgfx/src/gpu/opengl/GLRenderTarget.cpp +++ b/tgfx/src/gpu/opengl/GLRenderTarget.cpp @@ -54,14 +54,14 @@ static bool RenderbufferStorageMSAA(const GLInterface* gl, int sampleCount, Pixe auto format = gl->caps->getTextureFormat(pixelFormat).sizedFormat; switch (gl->caps->msFBOType) { case MSFBOType::Standard: - gl->renderbufferStorageMultisample(GL::RENDERBUFFER, sampleCount, format, width, height); + gl->renderbufferStorageMultisample(GL_RENDERBUFFER, sampleCount, format, width, height); break; case MSFBOType::ES_Apple: - gl->renderbufferStorageMultisampleAPPLE(GL::RENDERBUFFER, sampleCount, format, width, height); + gl->renderbufferStorageMultisampleAPPLE(GL_RENDERBUFFER, sampleCount, format, width, height); break; case MSFBOType::ES_EXT_MsToTexture: case MSFBOType::ES_IMG_MsToTexture: - gl->renderbufferStorageMultisampleEXT(GL::RENDERBUFFER, sampleCount, format, width, height); + gl->renderbufferStorageMultisampleEXT(GL_RENDERBUFFER, sampleCount, format, width, height); break; case MSFBOType::None: LOGE("Shouldn't be here if we don't support multisampled renderbuffers."); @@ -74,10 +74,10 @@ static void FrameBufferTexture2D(const GLInterface* gl, unsigned textureTarget, int sampleCount) { // 解绑的时候framebufferTexture2DMultisample在华为手机上会出现crash,统一走framebufferTexture2D解绑 if (textureID != 0 && sampleCount > 1 && gl->caps->usesImplicitMSAAResolve()) { - gl->framebufferTexture2DMultisample(GL::FRAMEBUFFER, GL::COLOR_ATTACHMENT0, textureTarget, + gl->framebufferTexture2DMultisample(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, textureTarget, textureID, 0, sampleCount); } else { - gl->framebufferTexture2D(GL::FRAMEBUFFER, GL::COLOR_ATTACHMENT0, textureTarget, textureID, 0); + gl->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, textureTarget, textureID, 0); } } @@ -95,8 +95,8 @@ static void ReleaseResource(Context* context, GLFrameBuffer* textureFBInfo, if (renderTargetFBInfo && renderTargetFBInfo->id > 0) { { GLStateGuard stateGuard(context); - gl->bindFramebuffer(GL::FRAMEBUFFER, renderTargetFBInfo->id); - gl->framebufferRenderbuffer(GL::FRAMEBUFFER, GL::COLOR_ATTACHMENT0, GL::RENDERBUFFER, 0); + gl->bindFramebuffer(GL_FRAMEBUFFER, renderTargetFBInfo->id); + gl->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, 0); } gl->deleteFramebuffers(1, &(renderTargetFBInfo->id)); renderTargetFBInfo->id = 0; @@ -118,15 +118,15 @@ static bool CreateRenderBuffer(const GLInterface* gl, const GLTexture* texture, if (*msRenderBufferID == 0) { return false; } - gl->bindRenderbuffer(GL::RENDERBUFFER, *msRenderBufferID); + gl->bindRenderbuffer(GL_RENDERBUFFER, *msRenderBufferID); if (!RenderbufferStorageMSAA(gl, sampleCount, renderTargetFBInfo->format, texture->width(), texture->height())) { return false; } - gl->bindFramebuffer(GL::FRAMEBUFFER, renderTargetFBInfo->id); - gl->framebufferRenderbuffer(GL::FRAMEBUFFER, GL::COLOR_ATTACHMENT0, GL::RENDERBUFFER, + gl->bindFramebuffer(GL_FRAMEBUFFER, renderTargetFBInfo->id); + gl->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, *msRenderBufferID); - return gl->checkFramebufferStatus(GL::FRAMEBUFFER) == GL::FRAMEBUFFER_COMPLETE; + return gl->checkFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE; } std::shared_ptr GLRenderTarget::MakeFrom(Context* context, const GLTexture* texture, @@ -153,12 +153,12 @@ std::shared_ptr GLRenderTarget::MakeFrom(Context* context, const } else { renderTargetFBInfo = textureFBInfo; } - gl->bindFramebuffer(GL::FRAMEBUFFER, textureFBInfo.id); + gl->bindFramebuffer(GL_FRAMEBUFFER, textureFBInfo.id); auto textureInfo = texture->glSampler(); FrameBufferTexture2D(gl, textureInfo.target, textureInfo.id, sampleCount); std::shared_ptr renderTarget = nullptr; - if (gl->checkFramebufferStatus(GL::FRAMEBUFFER) != GL::FRAMEBUFFER_COMPLETE) { + if (gl->checkFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) { ReleaseResource(context, &textureFBInfo, &renderTargetFBInfo, &msRenderBufferID); } else { auto textureTarget = texture->glSampler().target; @@ -180,13 +180,13 @@ GLRenderTarget::GLRenderTarget(int width, int height, ImageOrigin origin, int sa void GLRenderTarget::clear(const GLInterface* gl) const { int oldFb = 0; - gl->getIntegerv(GL::FRAMEBUFFER_BINDING, &oldFb); - gl->bindFramebuffer(GL::FRAMEBUFFER, renderTargetFBInfo.id); + gl->getIntegerv(GL_FRAMEBUFFER_BINDING, &oldFb); + gl->bindFramebuffer(GL_FRAMEBUFFER, renderTargetFBInfo.id); gl->viewport(0, 0, width(), height()); gl->scissor(0, 0, width(), height()); gl->clearColor(0.0f, 0.0f, 0.0f, 0.0f); - gl->clear(GL::COLOR_BUFFER_BIT | GL::STENCIL_BUFFER_BIT | GL::DEPTH_BUFFER_BIT); - gl->bindFramebuffer(GL::FRAMEBUFFER, oldFb); + gl->clear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + gl->bindFramebuffer(GL_FRAMEBUFFER, oldFb); } static bool CanReadDirectly(const GLInterface* gl, ImageOrigin origin, const ImageInfo& srcInfo, @@ -233,7 +233,7 @@ bool GLRenderTarget::readPixels(Context* context, const ImageInfo& dstInfo, void GLStateGuard stateGuard(context); auto gl = GLContext::Unwrap(context); const auto& format = gl->caps->getTextureFormat(pixelFormat); - gl->bindFramebuffer(GL::FRAMEBUFFER, renderTargetFBInfo.id); + gl->bindFramebuffer(GL_FRAMEBUFFER, renderTargetFBInfo.id); auto colorType = pixelFormat == PixelFormat::ALPHA_8 ? ColorType::ALPHA_8 : ColorType::RGBA_8888; auto srcInfo = ImageInfo::Make(outInfo.width(), outInfo.height(), colorType, AlphaType::Premultiplied); @@ -242,7 +242,7 @@ bool GLRenderTarget::readPixels(Context* context, const ImageInfo& dstInfo, void if (CanReadDirectly(gl, origin(), srcInfo, outInfo)) { pixels = dstPixels; if (outInfo.rowBytes() != outInfo.minRowBytes()) { - gl->pixelStorei(GL::PACK_ROW_LENGTH, + gl->pixelStorei(GL_PACK_ROW_LENGTH, static_cast(outInfo.rowBytes() / outInfo.bytesPerPixel())); } } else { @@ -250,7 +250,7 @@ bool GLRenderTarget::readPixels(Context* context, const ImageInfo& dstInfo, void pixels = tempPixels; } auto alignment = pixelFormat == PixelFormat::ALPHA_8 ? 1 : 4; - gl->pixelStorei(GL::PACK_ALIGNMENT, alignment); + gl->pixelStorei(GL_PACK_ALIGNMENT, alignment); auto flipY = origin() == ImageOrigin::BottomLeft; auto readX = std::max(0, srcX); auto readY = std::max(0, srcY); @@ -258,7 +258,7 @@ bool GLRenderTarget::readPixels(Context* context, const ImageInfo& dstInfo, void readY = height() - readY - outInfo.height(); } gl->readPixels(readX, readY, outInfo.width(), outInfo.height(), format.externalFormat, - GL::UNSIGNED_BYTE, pixels); + GL_UNSIGNED_BYTE, pixels); if (tempPixels != nullptr) { CopyPixels(srcInfo, tempPixels, outInfo, dstPixels, flipY); delete[] tempPixels; @@ -275,19 +275,19 @@ void GLRenderTarget::resolve(Context* context) const { return; } GLStateGuard stateGuard(context); - gl->bindFramebuffer(GL::READ_FRAMEBUFFER, renderTargetFBInfo.id); - gl->bindFramebuffer(GL::DRAW_FRAMEBUFFER, textureFBInfo.id); + gl->bindFramebuffer(GL_READ_FRAMEBUFFER, renderTargetFBInfo.id); + gl->bindFramebuffer(GL_DRAW_FRAMEBUFFER, textureFBInfo.id); if (gl->caps->msFBOType == MSFBOType::ES_Apple) { // Apple's extension uses the scissor as the blit bounds. - gl->enable(GL::SCISSOR_TEST); + gl->enable(GL_SCISSOR_TEST); gl->scissor(0, 0, width(), height()); gl->resolveMultisampleFramebuffer(); - gl->disable(GL::SCISSOR_TEST); + gl->disable(GL_SCISSOR_TEST); } else { // BlitFrameBuffer respects the scissor, so disable it. - gl->disable(GL::SCISSOR_TEST); - gl->blitFramebuffer(0, 0, width(), height(), 0, 0, width(), height(), GL::COLOR_BUFFER_BIT, - GL::NEAREST); + gl->disable(GL_SCISSOR_TEST); + gl->blitFramebuffer(0, 0, width(), height(), 0, 0, width(), height(), GL_COLOR_BUFFER_BIT, + GL_NEAREST); } } @@ -297,10 +297,10 @@ void GLRenderTarget::onRelease(Context* context) { } if (textureTarget != 0) { // The currently bound fboID may be the same as textureFBInfo.id, we must restore and then - // delete, otherwise GL::INVALID_OPERATION(1282) will be reported。 + // delete, otherwise GL_INVALID_OPERATION(1282) will be reported。 GLStateGuard stateGuard(context); auto gl = GLContext::Unwrap(context); - gl->bindFramebuffer(GL::FRAMEBUFFER, textureFBInfo.id); + gl->bindFramebuffer(GL_FRAMEBUFFER, textureFBInfo.id); FrameBufferTexture2D(gl, textureTarget, 0, sampleCount()); } ReleaseResource(context, &textureFBInfo, &renderTargetFBInfo, &msRenderBufferID); diff --git a/tgfx/src/gpu/opengl/GLState.cpp b/tgfx/src/gpu/opengl/GLState.cpp index a1b7612a6d..1d7aac96cc 100644 --- a/tgfx/src/gpu/opengl/GLState.cpp +++ b/tgfx/src/gpu/opengl/GLState.cpp @@ -51,7 +51,7 @@ namespace tgfx { class ActiveTexture : public GLAttribute { public: explicit ActiveTexture(const GLInterface* gl) { - gl->getIntegerv(GL::ACTIVE_TEXTURE, &activeTexture); + gl->getIntegerv(GL_ACTIVE_TEXTURE, &activeTexture); } GLAttributeType type() const override { @@ -73,8 +73,8 @@ class ActiveTexture : public GLAttribute { class BlendEquationSeparate : public GLAttribute { public: explicit BlendEquationSeparate(const GLInterface* gl) { - gl->getIntegerv(GL::BLEND_EQUATION_RGB, &equationRGB); - gl->getIntegerv(GL::BLEND_EQUATION_ALPHA, &equationAlpha); + gl->getIntegerv(GL_BLEND_EQUATION_RGB, &equationRGB); + gl->getIntegerv(GL_BLEND_EQUATION_ALPHA, &equationAlpha); } GLAttributeType type() const override { @@ -96,10 +96,10 @@ class BlendEquationSeparate : public GLAttribute { class BlendFuncSeparate : public GLAttribute { public: explicit BlendFuncSeparate(const GLInterface* gl) { - gl->getIntegerv(GL::BLEND_SRC_RGB, &srcRGB); - gl->getIntegerv(GL::BLEND_DST_RGB, &dstRGB); - gl->getIntegerv(GL::BLEND_SRC_ALPHA, &srcAlpha); - gl->getIntegerv(GL::BLEND_DST_ALPHA, &dstAlpha); + gl->getIntegerv(GL_BLEND_SRC_RGB, &srcRGB); + gl->getIntegerv(GL_BLEND_DST_RGB, &dstRGB); + gl->getIntegerv(GL_BLEND_SRC_ALPHA, &srcAlpha); + gl->getIntegerv(GL_BLEND_DST_ALPHA, &dstAlpha); } GLAttributeType type() const override { @@ -123,7 +123,7 @@ class BlendFuncSeparate : public GLAttribute { class CurrentProgram : public GLAttribute { public: explicit CurrentProgram(const GLInterface* gl) { - gl->getIntegerv(GL::CURRENT_PROGRAM, &program); + gl->getIntegerv(GL_CURRENT_PROGRAM, &program); } GLAttributeType type() const override { @@ -144,7 +144,7 @@ class CurrentProgram : public GLAttribute { class EnableBlend : public GLAttribute { public: explicit EnableBlend(const GLInterface* gl) { - enabled = gl->isEnabled(GL::BLEND); + enabled = gl->isEnabled(GL_BLEND); } GLAttributeType type() const override { @@ -157,9 +157,9 @@ class EnableBlend : public GLAttribute { void apply(GLState* state) const override { if (enabled) { - state->gl->enable(GL::BLEND); + state->gl->enable(GL_BLEND); } else { - state->gl->disable(GL::BLEND); + state->gl->disable(GL_BLEND); } } @@ -169,7 +169,7 @@ class EnableBlend : public GLAttribute { class EnableCullFace : public GLAttribute { public: explicit EnableCullFace(const GLInterface* gl) { - enabled = gl->isEnabled(GL::CULL_FACE); + enabled = gl->isEnabled(GL_CULL_FACE); } GLAttributeType type() const override { @@ -182,9 +182,9 @@ class EnableCullFace : public GLAttribute { void apply(GLState* state) const override { if (enabled) { - state->gl->enable(GL::CULL_FACE); + state->gl->enable(GL_CULL_FACE); } else { - state->gl->disable(GL::CULL_FACE); + state->gl->disable(GL_CULL_FACE); } } @@ -194,7 +194,7 @@ class EnableCullFace : public GLAttribute { class EnableDepth : public GLAttribute { public: explicit EnableDepth(const GLInterface* gl) { - enabled = gl->isEnabled(GL::DEPTH_TEST); + enabled = gl->isEnabled(GL_DEPTH_TEST); } GLAttributeType type() const override { @@ -207,9 +207,9 @@ class EnableDepth : public GLAttribute { void apply(GLState* state) const override { if (enabled) { - state->gl->enable(GL::DEPTH_TEST); + state->gl->enable(GL_DEPTH_TEST); } else { - state->gl->disable(GL::DEPTH_TEST); + state->gl->disable(GL_DEPTH_TEST); } } @@ -219,7 +219,7 @@ class EnableDepth : public GLAttribute { class EnableDither : public GLAttribute { public: explicit EnableDither(const GLInterface* gl) { - enabled = gl->isEnabled(GL::DITHER); + enabled = gl->isEnabled(GL_DITHER); } GLAttributeType type() const override { @@ -232,9 +232,9 @@ class EnableDither : public GLAttribute { void apply(GLState* state) const override { if (enabled) { - state->gl->enable(GL::DITHER); + state->gl->enable(GL_DITHER); } else { - state->gl->disable(GL::DITHER); + state->gl->disable(GL_DITHER); } } @@ -244,7 +244,7 @@ class EnableDither : public GLAttribute { class EnableFramebufferSRGB : public GLAttribute { public: explicit EnableFramebufferSRGB(const GLInterface* gl) { - enabled = gl->isEnabled(GL::FRAMEBUFFER_SRGB); + enabled = gl->isEnabled(GL_FRAMEBUFFER_SRGB); } GLAttributeType type() const override { @@ -257,9 +257,9 @@ class EnableFramebufferSRGB : public GLAttribute { void apply(GLState* state) const override { if (enabled) { - state->gl->enable(GL::FRAMEBUFFER_SRGB); + state->gl->enable(GL_FRAMEBUFFER_SRGB); } else { - state->gl->disable(GL::FRAMEBUFFER_SRGB); + state->gl->disable(GL_FRAMEBUFFER_SRGB); } } @@ -269,7 +269,7 @@ class EnableFramebufferSRGB : public GLAttribute { class EnableScissor : public GLAttribute { public: explicit EnableScissor(const GLInterface* gl) { - enabled = gl->isEnabled(GL::SCISSOR_TEST); + enabled = gl->isEnabled(GL_SCISSOR_TEST); } GLAttributeType type() const override { @@ -282,9 +282,9 @@ class EnableScissor : public GLAttribute { void apply(GLState* state) const override { if (enabled) { - state->gl->enable(GL::SCISSOR_TEST); + state->gl->enable(GL_SCISSOR_TEST); } else { - state->gl->disable(GL::SCISSOR_TEST); + state->gl->disable(GL_SCISSOR_TEST); } } @@ -294,7 +294,7 @@ class EnableScissor : public GLAttribute { class EnableStencil : public GLAttribute { public: explicit EnableStencil(const GLInterface* gl) { - enabled = gl->isEnabled(GL::STENCIL_TEST); + enabled = gl->isEnabled(GL_STENCIL_TEST); } GLAttributeType type() const override { @@ -307,9 +307,9 @@ class EnableStencil : public GLAttribute { void apply(GLState* state) const override { if (enabled) { - state->gl->enable(GL::STENCIL_TEST); + state->gl->enable(GL_STENCIL_TEST); } else { - state->gl->disable(GL::STENCIL_TEST); + state->gl->disable(GL_STENCIL_TEST); } } @@ -319,7 +319,7 @@ class EnableStencil : public GLAttribute { class EnableVertexProgramPointSize : public GLAttribute { public: explicit EnableVertexProgramPointSize(const GLInterface* gl) { - enabled = gl->isEnabled(GL::VERTEX_PROGRAM_POINT_SIZE); + enabled = gl->isEnabled(GL_VERTEX_PROGRAM_POINT_SIZE); } GLAttributeType type() const override { @@ -332,9 +332,9 @@ class EnableVertexProgramPointSize : public GLAttribute { void apply(GLState* state) const override { if (enabled) { - state->gl->enable(GL::VERTEX_PROGRAM_POINT_SIZE); + state->gl->enable(GL_VERTEX_PROGRAM_POINT_SIZE); } else { - state->gl->disable(GL::VERTEX_PROGRAM_POINT_SIZE); + state->gl->disable(GL_VERTEX_PROGRAM_POINT_SIZE); } } @@ -344,7 +344,7 @@ class EnableVertexProgramPointSize : public GLAttribute { class EnableMultisample : public GLAttribute { public: explicit EnableMultisample(const GLInterface* gl) { - enabled = gl->isEnabled(GL::MULTISAMPLE); + enabled = gl->isEnabled(GL_MULTISAMPLE); } GLAttributeType type() const override { @@ -357,9 +357,9 @@ class EnableMultisample : public GLAttribute { void apply(GLState* state) const override { if (enabled) { - state->gl->enable(GL::MULTISAMPLE); + state->gl->enable(GL_MULTISAMPLE); } else { - state->gl->disable(GL::MULTISAMPLE); + state->gl->disable(GL_MULTISAMPLE); } } @@ -369,7 +369,7 @@ class EnableMultisample : public GLAttribute { class EnableFetchPerSampleARM : public GLAttribute { public: explicit EnableFetchPerSampleARM(const GLInterface* gl) { - enabled = gl->isEnabled(GL::FETCH_PER_SAMPLE_ARM); + enabled = gl->isEnabled(GL_FETCH_PER_SAMPLE_ARM); } GLAttributeType type() const override { @@ -382,9 +382,9 @@ class EnableFetchPerSampleARM : public GLAttribute { void apply(GLState* state) const override { if (enabled) { - state->gl->enable(GL::FETCH_PER_SAMPLE_ARM); + state->gl->enable(GL_FETCH_PER_SAMPLE_ARM); } else { - state->gl->disable(GL::FETCH_PER_SAMPLE_ARM); + state->gl->disable(GL_FETCH_PER_SAMPLE_ARM); } } @@ -394,7 +394,7 @@ class EnableFetchPerSampleARM : public GLAttribute { class EnablePolygonOffsetFill : public GLAttribute { public: explicit EnablePolygonOffsetFill(const GLInterface* gl) { - enabled = gl->isEnabled(GL::POLYGON_OFFSET_FILL); + enabled = gl->isEnabled(GL_POLYGON_OFFSET_FILL); } GLAttributeType type() const override { @@ -407,9 +407,9 @@ class EnablePolygonOffsetFill : public GLAttribute { void apply(GLState* state) const override { if (enabled) { - state->gl->enable(GL::POLYGON_OFFSET_FILL); + state->gl->enable(GL_POLYGON_OFFSET_FILL); } else { - state->gl->disable(GL::POLYGON_OFFSET_FILL); + state->gl->disable(GL_POLYGON_OFFSET_FILL); } } @@ -419,7 +419,7 @@ class EnablePolygonOffsetFill : public GLAttribute { class ElementBufferBinding : public GLAttribute { public: explicit ElementBufferBinding(const GLInterface* gl) { - gl->getIntegerv(GL::ELEMENT_ARRAY_BUFFER_BINDING, &buffer); + gl->getIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &buffer); } GLAttributeType type() const override { @@ -431,7 +431,7 @@ class ElementBufferBinding : public GLAttribute { } void apply(GLState* state) const override { - state->gl->bindBuffer(GL::ELEMENT_ARRAY_BUFFER, buffer); + state->gl->bindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffer); } int buffer = 0; @@ -440,7 +440,7 @@ class ElementBufferBinding : public GLAttribute { class FrameBufferBinding : public GLAttribute { public: explicit FrameBufferBinding(const GLInterface* gl) { - gl->getIntegerv(GL::FRAMEBUFFER_BINDING, &buffer); + gl->getIntegerv(GL_FRAMEBUFFER_BINDING, &buffer); } GLAttributeType type() const override { @@ -452,7 +452,7 @@ class FrameBufferBinding : public GLAttribute { } void apply(GLState* state) const override { - state->gl->bindFramebuffer(GL::FRAMEBUFFER, buffer); + state->gl->bindFramebuffer(GL_FRAMEBUFFER, buffer); } int buffer = 0; @@ -461,7 +461,7 @@ class FrameBufferBinding : public GLAttribute { class ReadFrameBufferBinding : public GLAttribute { public: explicit ReadFrameBufferBinding(const GLInterface* gl) { - gl->getIntegerv(GL::READ_FRAMEBUFFER_BINDING, &buffer); + gl->getIntegerv(GL_READ_FRAMEBUFFER_BINDING, &buffer); } GLAttributeType type() const override { @@ -473,7 +473,7 @@ class ReadFrameBufferBinding : public GLAttribute { } void apply(GLState* state) const override { - state->gl->bindFramebuffer(GL::READ_FRAMEBUFFER, buffer); + state->gl->bindFramebuffer(GL_READ_FRAMEBUFFER, buffer); } int buffer = 0; @@ -482,7 +482,7 @@ class ReadFrameBufferBinding : public GLAttribute { class DrawFrameBufferBinding : public GLAttribute { public: explicit DrawFrameBufferBinding(const GLInterface* gl) { - gl->getIntegerv(GL::DRAW_FRAMEBUFFER_BINDING, &buffer); + gl->getIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &buffer); } GLAttributeType type() const override { @@ -494,7 +494,7 @@ class DrawFrameBufferBinding : public GLAttribute { } void apply(GLState* state) const override { - state->gl->bindFramebuffer(GL::DRAW_FRAMEBUFFER, buffer); + state->gl->bindFramebuffer(GL_DRAW_FRAMEBUFFER, buffer); } int buffer = 0; @@ -503,7 +503,7 @@ class DrawFrameBufferBinding : public GLAttribute { class RenderBufferBinding : public GLAttribute { public: explicit RenderBufferBinding(const GLInterface* gl) { - gl->getIntegerv(GL::RENDERBUFFER_BINDING, &buffer); + gl->getIntegerv(GL_RENDERBUFFER_BINDING, &buffer); } GLAttributeType type() const override { @@ -515,7 +515,7 @@ class RenderBufferBinding : public GLAttribute { } void apply(GLState* state) const override { - state->gl->bindRenderbuffer(GL::RENDERBUFFER, buffer); + state->gl->bindRenderbuffer(GL_RENDERBUFFER, buffer); } int buffer = 0; @@ -524,7 +524,7 @@ class RenderBufferBinding : public GLAttribute { class PackAlignment : public GLAttribute { public: explicit PackAlignment(const GLInterface* gl) { - gl->getIntegerv(GL::PACK_ALIGNMENT, &alignment); + gl->getIntegerv(GL_PACK_ALIGNMENT, &alignment); } GLAttributeType type() const override { @@ -536,7 +536,7 @@ class PackAlignment : public GLAttribute { } void apply(GLState* state) const override { - state->gl->pixelStorei(GL::PACK_ALIGNMENT, alignment); + state->gl->pixelStorei(GL_PACK_ALIGNMENT, alignment); } int alignment = 0; @@ -545,7 +545,7 @@ class PackAlignment : public GLAttribute { class PackRowLength : public GLAttribute { public: explicit PackRowLength(const GLInterface* gl) { - gl->getIntegerv(GL::PACK_ROW_LENGTH, &rowLength); + gl->getIntegerv(GL_PACK_ROW_LENGTH, &rowLength); } GLAttributeType type() const override { @@ -557,7 +557,7 @@ class PackRowLength : public GLAttribute { } void apply(GLState* state) const override { - state->gl->pixelStorei(GL::PACK_ROW_LENGTH, rowLength); + state->gl->pixelStorei(GL_PACK_ROW_LENGTH, rowLength); } int rowLength = 0; @@ -566,7 +566,7 @@ class PackRowLength : public GLAttribute { class ScissorBox : public GLAttribute { public: explicit ScissorBox(const GLInterface* gl) { - gl->getIntegerv(GL::SCISSOR_BOX, box); + gl->getIntegerv(GL_SCISSOR_BOX, box); } GLAttributeType type() const override { @@ -589,14 +589,14 @@ class TextureBinding : public GLAttribute { TextureBinding(const GLInterface* gl, unsigned textureUnit, unsigned textureTarget) : textureUnit(textureUnit), textureTarget(textureTarget) { switch (textureTarget) { - case GL::TEXTURE_2D: - gl->getIntegerv(GL::TEXTURE_BINDING_2D, &textureID); + case GL_TEXTURE_2D: + gl->getIntegerv(GL_TEXTURE_BINDING_2D, &textureID); break; - case GL::TEXTURE_EXTERNAL_OES: - gl->getIntegerv(GL::TEXTURE_BINDING_EXTERNAL_OES, &textureID); + case GL_TEXTURE_EXTERNAL_OES: + gl->getIntegerv(GL_TEXTURE_BINDING_EXTERNAL_OES, &textureID); break; - case GL::TEXTURE_RECTANGLE: - gl->getIntegerv(GL::TEXTURE_BINDING_RECTANGLE, &textureID); + case GL_TEXTURE_RECTANGLE: + gl->getIntegerv(GL_TEXTURE_BINDING_RECTANGLE, &textureID); break; default: UNSUPPORTED_STATE_WARNING() @@ -626,7 +626,7 @@ class TextureBinding : public GLAttribute { class UnpackAlignment : public GLAttribute { public: explicit UnpackAlignment(const GLInterface* gl) { - gl->getIntegerv(GL::UNPACK_ALIGNMENT, &alignment); + gl->getIntegerv(GL_UNPACK_ALIGNMENT, &alignment); } GLAttributeType type() const override { @@ -638,7 +638,7 @@ class UnpackAlignment : public GLAttribute { } void apply(GLState* state) const override { - state->gl->pixelStorei(GL::UNPACK_ALIGNMENT, alignment); + state->gl->pixelStorei(GL_UNPACK_ALIGNMENT, alignment); } int alignment = 0; @@ -647,7 +647,7 @@ class UnpackAlignment : public GLAttribute { class UnpackRowLength : public GLAttribute { public: explicit UnpackRowLength(const GLInterface* gl) { - gl->getIntegerv(GL::UNPACK_ROW_LENGTH, &rowLength); + gl->getIntegerv(GL_UNPACK_ROW_LENGTH, &rowLength); } GLAttributeType type() const override { @@ -659,7 +659,7 @@ class UnpackRowLength : public GLAttribute { } void apply(GLState* state) const override { - state->gl->pixelStorei(GL::UNPACK_ROW_LENGTH, rowLength); + state->gl->pixelStorei(GL_UNPACK_ROW_LENGTH, rowLength); } int rowLength = 0; @@ -668,7 +668,7 @@ class UnpackRowLength : public GLAttribute { class VertexArrayBinding : public GLAttribute { public: explicit VertexArrayBinding(const GLInterface* gl) { - gl->getIntegerv(GL::VERTEX_ARRAY_BINDING, &vertexArray); + gl->getIntegerv(GL_VERTEX_ARRAY_BINDING, &vertexArray); } GLAttributeType type() const override { @@ -690,13 +690,13 @@ class VertexArrayBinding : public GLAttribute { class VertexAttribute : public GLAttribute { public: explicit VertexAttribute(const GLInterface* gl, unsigned index) : index(index) { - gl->getVertexAttribiv(index, GL::VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, &vbo); - gl->getVertexAttribiv(index, GL::VERTEX_ATTRIB_ARRAY_ENABLED, &enabled); - gl->getVertexAttribiv(index, GL::VERTEX_ATTRIB_ARRAY_SIZE, &size); - gl->getVertexAttribiv(index, GL::VERTEX_ATTRIB_ARRAY_TYPE, &dataType); - gl->getVertexAttribiv(index, GL::VERTEX_ATTRIB_ARRAY_NORMALIZED, &normalized); - gl->getVertexAttribiv(index, GL::VERTEX_ATTRIB_ARRAY_STRIDE, &stride); - gl->getVertexAttribPointerv(index, GL::VERTEX_ATTRIB_ARRAY_POINTER, &pointer); + gl->getVertexAttribiv(index, GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, &vbo); + gl->getVertexAttribiv(index, GL_VERTEX_ATTRIB_ARRAY_ENABLED, &enabled); + gl->getVertexAttribiv(index, GL_VERTEX_ATTRIB_ARRAY_SIZE, &size); + gl->getVertexAttribiv(index, GL_VERTEX_ATTRIB_ARRAY_TYPE, &dataType); + gl->getVertexAttribiv(index, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, &normalized); + gl->getVertexAttribiv(index, GL_VERTEX_ATTRIB_ARRAY_STRIDE, &stride); + gl->getVertexAttribPointerv(index, GL_VERTEX_ATTRIB_ARRAY_POINTER, &pointer); } GLAttributeType type() const override { @@ -708,9 +708,9 @@ class VertexAttribute : public GLAttribute { } void apply(GLState* state) const override { - state->gl->bindBuffer(GL::ARRAY_BUFFER, vbo); + state->gl->bindBuffer(GL_ARRAY_BUFFER, vbo); state->gl->vertexAttribPointer(index, size, dataType, normalized, stride, pointer); - if (enabled == GL::TRUE) { + if (enabled == GL_TRUE) { state->gl->enableVertexAttribArray(index); } else { state->gl->disableVertexAttribArray(index); @@ -720,7 +720,7 @@ class VertexAttribute : public GLAttribute { private: unsigned index = 0; int vbo = 0; - int enabled = GL::FALSE; + int enabled = GL_FALSE; int size = 0; int dataType = 0; int normalized = 0; @@ -731,7 +731,7 @@ class VertexAttribute : public GLAttribute { class VertexBufferBinding : public GLAttribute { public: explicit VertexBufferBinding(const GLInterface* gl) { - gl->getIntegerv(GL::ARRAY_BUFFER_BINDING, &buffer); + gl->getIntegerv(GL_ARRAY_BUFFER_BINDING, &buffer); } GLAttributeType type() const override { @@ -743,7 +743,7 @@ class VertexBufferBinding : public GLAttribute { } void apply(GLState* state) const override { - state->gl->bindBuffer(GL::ARRAY_BUFFER, buffer); + state->gl->bindBuffer(GL_ARRAY_BUFFER, buffer); } int buffer = 0; @@ -752,7 +752,7 @@ class VertexBufferBinding : public GLAttribute { class DepthMask : public GLAttribute { public: explicit DepthMask(const GLInterface* gl) { - gl->getBooleanv(GL::DEPTH_WRITEMASK, &flag); + gl->getBooleanv(GL_DEPTH_WRITEMASK, &flag); } GLAttributeType type() const override { @@ -773,7 +773,7 @@ class DepthMask : public GLAttribute { class Viewport : public GLAttribute { public: explicit Viewport(const GLInterface* gl) { - gl->getIntegerv(GL::VIEWPORT, viewport); + gl->getIntegerv(GL_VIEWPORT, viewport); } GLAttributeType type() const override { @@ -798,11 +798,11 @@ GLState::GLState(const GLInterface* gl) : gl(gl) { void GLState::reset() { if (gl->caps->vertexArrayObjectSupport) { int vao = 0; - gl->getIntegerv(GL::VERTEX_ARRAY_BINDING, &vao); + gl->getIntegerv(GL_VERTEX_ARRAY_BINDING, &vao); currentVAO = vao; } int texture = 0; - gl->getIntegerv(GL::ACTIVE_TEXTURE, &texture); + gl->getIntegerv(GL_ACTIVE_TEXTURE, &texture); currentTextureUnit = texture; currentRecord = nullptr; recordList = {}; @@ -862,13 +862,13 @@ void GLState::blendFuncSeparate(unsigned srcRGB, unsigned dstRGB, unsigned srcAl void GLState::bindFramebuffer(unsigned target, unsigned framebuffer) { switch (target) { - case GL::FRAMEBUFFER: + case GL_FRAMEBUFFER: SAVE_DEFAULT(FrameBufferBinding) break; - case GL::READ_FRAMEBUFFER: + case GL_READ_FRAMEBUFFER: SAVE_DEFAULT(ReadFrameBufferBinding) break; - case GL::DRAW_FRAMEBUFFER: + case GL_DRAW_FRAMEBUFFER: SAVE_DEFAULT(DrawFrameBufferBinding) break; default: @@ -879,7 +879,7 @@ void GLState::bindFramebuffer(unsigned target, unsigned framebuffer) { } void GLState::bindRenderbuffer(unsigned int target, unsigned int renderbuffer) { - if (target == GL::RENDERBUFFER) { + if (target == GL_RENDERBUFFER) { SAVE_DEFAULT(RenderBufferBinding) } else { UNSUPPORTED_STATE_WARNING() @@ -889,10 +889,10 @@ void GLState::bindRenderbuffer(unsigned int target, unsigned int renderbuffer) { void GLState::bindBuffer(unsigned target, unsigned buffer) { switch (target) { - case GL::ARRAY_BUFFER: + case GL_ARRAY_BUFFER: SAVE_DEFAULT(VertexBufferBinding) break; - case GL::ELEMENT_ARRAY_BUFFER: + case GL_ELEMENT_ARRAY_BUFFER: if (currentRecord && currentRecord->defaultVAO == currentVAO) { // EBO is stored on VAO, and we save the default value only if the current VAO is the // default. @@ -909,7 +909,7 @@ void GLState::bindBuffer(unsigned target, unsigned buffer) { void GLState::bindTexture(unsigned target, unsigned texture) { if (currentRecord) { auto& textureMap = currentRecord->textureMap; - uint32_t uint = currentTextureUnit - GL::TEXTURE0; + uint32_t uint = currentTextureUnit - GL_TEXTURE0; auto key = (uint << 28) | target; if (textureMap.count(key) == 0) { textureMap[key] = @@ -964,17 +964,17 @@ static void SaveDefaultPolygonOffsetFill(GLState* state) { } static constexpr std::pair StateMap[] = { - {GL::BLEND, SaveDefaultBlend}, - {GL::CULL_FACE, SaveDefaultCullFace}, - {GL::DEPTH_TEST, SaveDefaultDepth}, - {GL::DITHER, SaveDefaultDither}, - {GL::SCISSOR_TEST, SaveDefaultScissor}, - {GL::FRAMEBUFFER_SRGB, SaveDefaultFramebufferSRGB}, - {GL::STENCIL_TEST, SaveDefaultStencil}, - {GL::VERTEX_PROGRAM_POINT_SIZE, SaveDefaultVertexProgramPointSize}, - {GL::MULTISAMPLE, SaveDefaultMultisample}, - {GL::FETCH_PER_SAMPLE_ARM, SaveDefaultFetchPerSampleARM}, - {GL::POLYGON_OFFSET_FILL, SaveDefaultPolygonOffsetFill}, + {GL_BLEND, SaveDefaultBlend}, + {GL_CULL_FACE, SaveDefaultCullFace}, + {GL_DEPTH_TEST, SaveDefaultDepth}, + {GL_DITHER, SaveDefaultDither}, + {GL_SCISSOR_TEST, SaveDefaultScissor}, + {GL_FRAMEBUFFER_SRGB, SaveDefaultFramebufferSRGB}, + {GL_STENCIL_TEST, SaveDefaultStencil}, + {GL_VERTEX_PROGRAM_POINT_SIZE, SaveDefaultVertexProgramPointSize}, + {GL_MULTISAMPLE, SaveDefaultMultisample}, + {GL_FETCH_PER_SAMPLE_ARM, SaveDefaultFetchPerSampleARM}, + {GL_POLYGON_OFFSET_FILL, SaveDefaultPolygonOffsetFill}, }; void GLState::disable(unsigned cap) { @@ -1019,16 +1019,16 @@ void GLState::enableVertexAttribArray(unsigned index) { void GLState::pixelStorei(unsigned int name, int param) { switch (name) { - case GL::UNPACK_ROW_LENGTH: + case GL_UNPACK_ROW_LENGTH: SAVE_DEFAULT(UnpackRowLength) break; - case GL::UNPACK_ALIGNMENT: + case GL_UNPACK_ALIGNMENT: SAVE_DEFAULT(UnpackAlignment) break; - case GL::PACK_ROW_LENGTH: + case GL_PACK_ROW_LENGTH: SAVE_DEFAULT(PackRowLength) break; - case GL::PACK_ALIGNMENT: + case GL_PACK_ALIGNMENT: SAVE_DEFAULT(PackAlignment) break; default: diff --git a/tgfx/src/gpu/opengl/GLSurface.cpp b/tgfx/src/gpu/opengl/GLSurface.cpp index d28d8c2b6d..144aec1caf 100644 --- a/tgfx/src/gpu/opengl/GLSurface.cpp +++ b/tgfx/src/gpu/opengl/GLSurface.cpp @@ -96,7 +96,7 @@ bool GLSurface::wait(const Semaphore* semaphore) { if (!gl->caps->semaphoreSupport) { return false; } - gl->waitSync(glSync, 0, GL::TIMEOUT_IGNORED); + gl->waitSync(glSync, 0, GL_TIMEOUT_IGNORED); gl->deleteSync(glSync); return true; } @@ -112,7 +112,7 @@ bool GLSurface::flush(Semaphore* semaphore) { if (!gl->caps->semaphoreSupport) { return false; } - auto* sync = gl->fenceSync(GL::SYNC_GPU_COMMANDS_COMPLETE, 0); + auto* sync = gl->fenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); if (sync) { static_cast(semaphore)->glSync = sync; // If we inserted semaphores during the flush, we need to call glFlush. diff --git a/tgfx/src/gpu/opengl/GLTexture.cpp b/tgfx/src/gpu/opengl/GLTexture.cpp index c4b94efd6b..ac78b2d914 100644 --- a/tgfx/src/gpu/opengl/GLTexture.cpp +++ b/tgfx/src/gpu/opengl/GLTexture.cpp @@ -154,20 +154,20 @@ std::shared_ptr Texture::Make(Context* context, int width, int height, texture->_origin = origin; sampler = texture->glSampler(); } else { - sampler.target = GL::TEXTURE_2D; + sampler.target = GL_TEXTURE_2D; sampler.format = pixelFormat; gl->genTextures(1, &(sampler.id)); if (sampler.id == 0) { return nullptr; } gl->bindTexture(sampler.target, sampler.id); - gl->texParameteri(sampler.target, GL::TEXTURE_WRAP_S, GL::CLAMP_TO_EDGE); - gl->texParameteri(sampler.target, GL::TEXTURE_WRAP_T, GL::CLAMP_TO_EDGE); - gl->texParameteri(sampler.target, GL::TEXTURE_MIN_FILTER, GL::LINEAR); - gl->texParameteri(sampler.target, GL::TEXTURE_MAG_FILTER, GL::LINEAR); + gl->texParameteri(sampler.target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + gl->texParameteri(sampler.target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + gl->texParameteri(sampler.target, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + gl->texParameteri(sampler.target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); if (pixels == nullptr) { gl->texImage2D(sampler.target, 0, static_cast(format.internalFormatTexImage), width, - height, 0, format.externalFormat, GL::UNSIGNED_BYTE, nullptr); + height, 0, format.externalFormat, GL_UNSIGNED_BYTE, nullptr); } if (!CheckGLError(gl)) { gl->deleteTextures(1, &sampler.id); diff --git a/tgfx/src/gpu/opengl/GLUniformHandler.cpp b/tgfx/src/gpu/opengl/GLUniformHandler.cpp index 58e63bdf9e..b76522fc19 100644 --- a/tgfx/src/gpu/opengl/GLUniformHandler.cpp +++ b/tgfx/src/gpu/opengl/GLUniformHandler.cpp @@ -50,12 +50,12 @@ SamplerHandle GLUniformHandler::addSampler(const TextureSampler* sampler, const ShaderVar::Type type; switch (static_cast(sampler)->target) { - case GL::TEXTURE_EXTERNAL_OES: + case GL_TEXTURE_EXTERNAL_OES: programBuilder->fragmentShaderBuilder()->addFeature(PrivateFeature::OESTexture, "GL_OES_EGL_image_external"); type = ShaderVar::Type::TextureExternalSampler; break; - case GL::TEXTURE_RECTANGLE: + case GL_TEXTURE_RECTANGLE: type = ShaderVar::Type::Texture2DRectSampler; break; default: diff --git a/tgfx/src/gpu/opengl/GLUtil.cpp b/tgfx/src/gpu/opengl/GLUtil.cpp index d3b0906eb3..a52d1042bc 100644 --- a/tgfx/src/gpu/opengl/GLUtil.cpp +++ b/tgfx/src/gpu/opengl/GLUtil.cpp @@ -51,19 +51,18 @@ GLVersion GetGLVersion(const char* versionString) { } bool CreateGLTexture(const GLInterface* gl, int width, int height, GLSampler* texture) { - texture->target = GL::TEXTURE_2D; + texture->target = GL_TEXTURE_2D; texture->format = PixelFormat::RGBA_8888; gl->genTextures(1, &texture->id); if (texture->id <= 0) { return false; } gl->bindTexture(texture->target, texture->id); - gl->texParameteri(texture->target, GL::TEXTURE_WRAP_S, GL::CLAMP_TO_EDGE); - gl->texParameteri(texture->target, GL::TEXTURE_WRAP_T, GL::CLAMP_TO_EDGE); - gl->texParameteri(texture->target, GL::TEXTURE_MIN_FILTER, GL::LINEAR); - gl->texParameteri(texture->target, GL::TEXTURE_MAG_FILTER, GL::LINEAR); - gl->texImage2D(texture->target, 0, GL::RGBA, width, height, 0, GL::RGBA, GL::UNSIGNED_BYTE, - nullptr); + gl->texParameteri(texture->target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + gl->texParameteri(texture->target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + gl->texParameteri(texture->target, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + gl->texParameteri(texture->target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + gl->texImage2D(texture->target, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); gl->bindTexture(texture->target, 0); return true; } @@ -73,19 +72,19 @@ static std::array GetGLSwizzleValues(const Swizzle& swizzle) { for (int i = 0; i < 4; ++i) { switch (swizzle[i]) { case 'r': - glValues[i] = GL::RED; + glValues[i] = GL_RED; break; case 'g': - glValues[i] = GL::GREEN; + glValues[i] = GL_GREEN; break; case 'b': - glValues[i] = GL::BLUE; + glValues[i] = GL_BLUE; break; case 'a': - glValues[i] = GL::ALPHA; + glValues[i] = GL_ALPHA; break; case '1': - glValues[i] = GL::ONE; + glValues[i] = GL_ONE; break; default: LOGE("Unsupported component"); @@ -98,22 +97,22 @@ void ActiveGLTexture(const GLInterface* gl, unsigned textureUnit, unsigned targe unsigned textureID, PixelFormat pixelFormat) { gl->activeTexture(textureUnit); gl->bindTexture(target, textureID); - gl->texParameteri(target, GL::TEXTURE_WRAP_S, GL::CLAMP_TO_EDGE); - gl->texParameteri(target, GL::TEXTURE_WRAP_T, GL::CLAMP_TO_EDGE); - gl->texParameteri(target, GL::TEXTURE_MIN_FILTER, GL::LINEAR); - gl->texParameteri(target, GL::TEXTURE_MAG_FILTER, GL::LINEAR); + gl->texParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + gl->texParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + gl->texParameteri(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + gl->texParameteri(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); if (gl->caps->textureSwizzleSupport) { const auto& swizzle = gl->caps->getSwizzle(pixelFormat); auto glValues = GetGLSwizzleValues(swizzle); if (gl->caps->standard == GLStandard::GL) { - gl->texParameteriv(target, GL::TEXTURE_SWIZZLE_RGBA, + gl->texParameteriv(target, GL_TEXTURE_SWIZZLE_RGBA, reinterpret_cast(&glValues[0])); } else if (gl->caps->standard == GLStandard::GLES) { - // ES3 added swizzle support but not GL::TEXTURE_SWIZZLE_RGBA. - gl->texParameteri(target, GL::TEXTURE_SWIZZLE_R, static_cast(glValues[0])); - gl->texParameteri(target, GL::TEXTURE_SWIZZLE_G, static_cast(glValues[1])); - gl->texParameteri(target, GL::TEXTURE_SWIZZLE_B, static_cast(glValues[2])); - gl->texParameteri(target, GL::TEXTURE_SWIZZLE_A, static_cast(glValues[3])); + // ES3 added swizzle support but not GL_TEXTURE_SWIZZLE_RGBA. + gl->texParameteri(target, GL_TEXTURE_SWIZZLE_R, static_cast(glValues[0])); + gl->texParameteri(target, GL_TEXTURE_SWIZZLE_G, static_cast(glValues[1])); + gl->texParameteri(target, GL_TEXTURE_SWIZZLE_B, static_cast(glValues[2])); + gl->texParameteri(target, GL_TEXTURE_SWIZZLE_A, static_cast(glValues[3])); } } } @@ -125,23 +124,23 @@ void SubmitGLTexture(const GLInterface* gl, const GLSampler& sampler, int width, } const auto& format = gl->caps->getTextureFormat(sampler.format); gl->bindTexture(sampler.target, sampler.id); - gl->pixelStorei(GL::UNPACK_ALIGNMENT, bytesPerPixel); + gl->pixelStorei(GL_UNPACK_ALIGNMENT, bytesPerPixel); if (gl->caps->unpackRowLengthSupport) { // the number of pixels, not bytes - gl->pixelStorei(GL::UNPACK_ROW_LENGTH, static_cast(rowBytes / bytesPerPixel)); + gl->pixelStorei(GL_UNPACK_ROW_LENGTH, static_cast(rowBytes / bytesPerPixel)); gl->texImage2D(sampler.target, 0, static_cast(format.internalFormatTexImage), width, - height, 0, format.externalFormat, GL::UNSIGNED_BYTE, pixels); + height, 0, format.externalFormat, GL_UNSIGNED_BYTE, pixels); } else { if (static_cast(width) * bytesPerPixel == rowBytes) { gl->texImage2D(sampler.target, 0, static_cast(format.internalFormatTexImage), width, - height, 0, format.externalFormat, GL::UNSIGNED_BYTE, pixels); + height, 0, format.externalFormat, GL_UNSIGNED_BYTE, pixels); } else { gl->texImage2D(sampler.target, 0, static_cast(format.internalFormatTexImage), width, - height, 0, format.externalFormat, GL::UNSIGNED_BYTE, nullptr); + height, 0, format.externalFormat, GL_UNSIGNED_BYTE, nullptr); auto data = reinterpret_cast(pixels); for (int row = 0; row < height; ++row) { gl->texSubImage2D(sampler.target, 0, 0, row, width, 1, format.externalFormat, - GL::UNSIGNED_BYTE, data + (row * rowBytes)); + GL_UNSIGNED_BYTE, data + (row * rowBytes)); } } } @@ -150,11 +149,11 @@ void SubmitGLTexture(const GLInterface* gl, const GLSampler& sampler, int width, unsigned CreateGLProgram(const GLInterface* gl, const std::string& vertex, const std::string& fragment) { - auto vertexShader = LoadGLShader(gl, GL::VERTEX_SHADER, vertex); + auto vertexShader = LoadGLShader(gl, GL_VERTEX_SHADER, vertex); if (vertexShader == 0) { return 0; } - auto fragmentShader = LoadGLShader(gl, GL::FRAGMENT_SHADER, fragment); + auto fragmentShader = LoadGLShader(gl, GL_FRAGMENT_SHADER, fragment); if (fragmentShader == 0) { return 0; } @@ -163,7 +162,7 @@ unsigned CreateGLProgram(const GLInterface* gl, const std::string& vertex, gl->attachShader(programHandle, fragmentShader); gl->linkProgram(programHandle); int success; - gl->getProgramiv(programHandle, GL::LINK_STATUS, &success); + gl->getProgramiv(programHandle, GL_LINK_STATUS, &success); if (!success) { char infoLog[512]; gl->getProgramInfoLog(programHandle, 512, nullptr, infoLog); @@ -180,7 +179,7 @@ unsigned LoadGLShader(const GLInterface* gl, unsigned shaderType, const std::str gl->shaderSource(shader, 1, files, nullptr); gl->compileShader(shader); int success; - gl->getShaderiv(shader, GL::COMPILE_STATUS, &success); + gl->getShaderiv(shader, GL_COMPILE_STATUS, &success); if (!success) { char infoLog[512]; gl->getShaderInfoLog(shader, 512, nullptr, infoLog); @@ -194,7 +193,7 @@ unsigned LoadGLShader(const GLInterface* gl, unsigned shaderType, const std::str bool CheckGLError(const GLInterface* gl) { bool success = true; unsigned errorCode; - while ((errorCode = gl->getError()) != GL::NO_ERROR) { + while ((errorCode = gl->getError()) != GL_NO_ERROR) { success = false; LOGE("glCheckError: %d", errorCode); } diff --git a/tgfx/src/gpu/opengl/GLYUVTexture.cpp b/tgfx/src/gpu/opengl/GLYUVTexture.cpp index fdf7c3915c..d0dfb784f3 100644 --- a/tgfx/src/gpu/opengl/GLYUVTexture.cpp +++ b/tgfx/src/gpu/opengl/GLYUVTexture.cpp @@ -108,7 +108,7 @@ static std::vector MakeTexturePlanes(const GLInterface* gl, const YUV for (int index = 0; index < yuvConfig.planeCount; index++) { GLSampler sampler = {}; sampler.id = yuvTextureIDs[index]; - sampler.target = GL::TEXTURE_2D; + sampler.target = GL_TEXTURE_2D; sampler.format = yuvConfig.formats[index]; texturePlanes.emplace_back(sampler); } diff --git a/tgfx/src/gpu/opengl/eagl/EAGLHardwareTexture.mm b/tgfx/src/gpu/opengl/eagl/EAGLHardwareTexture.mm index d5c34a1321..91f51f7576 100644 --- a/tgfx/src/gpu/opengl/eagl/EAGLHardwareTexture.mm +++ b/tgfx/src/gpu/opengl/eagl/EAGLHardwareTexture.mm @@ -37,16 +37,16 @@ static CVOpenGLESTextureRef GetTextureRef(Context* context, CVPixelBufferRef pix // 返回的 texture 对象是一个强引用计数为 1 的对象。 result = CVOpenGLESTextureCacheCreateTextureFromImage( kCFAllocatorDefault, textureCache, pixelBuffer, NULL, /* texture attributes */ - GL::TEXTURE_2D, format.internalFormatTexImage, /* opengl format */ - width, height, GL::RED, /* native iOS format */ - GL::UNSIGNED_BYTE, 0, &texture); + GL_TEXTURE_2D, format.internalFormatTexImage, /* opengl format */ + width, height, GL_RED, /* native iOS format */ + GL_UNSIGNED_BYTE, 0, &texture); } else { // 返回的 texture 对象是一个强引用计数为 1 的对象。 result = CVOpenGLESTextureCacheCreateTextureFromImage( kCFAllocatorDefault, textureCache, pixelBuffer, NULL, /* texture attributes */ - GL::TEXTURE_2D, GL::RGBA, /* opengl format */ - width, height, GL::BGRA, /* native iOS format */ - GL::UNSIGNED_BYTE, 0, &texture); + GL_TEXTURE_2D, GL_RGBA, /* opengl format */ + width, height, GL_BGRA, /* native iOS format */ + GL_UNSIGNED_BYTE, 0, &texture); } if (result != kCVReturnSuccess && texture != nil) { CFRelease(texture); diff --git a/tgfx/src/gpu/opengl/eagl/EAGLNV12Texture.mm b/tgfx/src/gpu/opengl/eagl/EAGLNV12Texture.mm index 3c2ffd29e5..a1e782b784 100644 --- a/tgfx/src/gpu/opengl/eagl/EAGLNV12Texture.mm +++ b/tgfx/src/gpu/opengl/eagl/EAGLNV12Texture.mm @@ -50,16 +50,16 @@ static GLSampler ToGLSampler(CVOpenGLESTextureRef texture, PixelFormat format) { const auto& oneComponentFormat = gl->caps->getTextureFormat(lumaComponentFormat); // 返回的 texture 对象是一个强引用计数为 1 的对象。 CVOpenGLESTextureCacheCreateTextureFromImage( - kCFAllocatorDefault, textureCache, pixelBuffer, NULL, GL::TEXTURE_2D, + kCFAllocatorDefault, textureCache, pixelBuffer, NULL, GL_TEXTURE_2D, oneComponentFormat.internalFormatTexImage, width, height, oneComponentFormat.externalFormat, - GL::UNSIGNED_BYTE, 0, &outputTextureLuma); + GL_UNSIGNED_BYTE, 0, &outputTextureLuma); auto chromaComponentFormat = PixelFormat::RG_88; const auto& twoComponentFormat = gl->caps->getTextureFormat(chromaComponentFormat); // 返回的 texture 对象是一个强引用计数为 1 的对象。 CVOpenGLESTextureCacheCreateTextureFromImage( - kCFAllocatorDefault, textureCache, pixelBuffer, NULL, GL::TEXTURE_2D, + kCFAllocatorDefault, textureCache, pixelBuffer, NULL, GL_TEXTURE_2D, twoComponentFormat.internalFormatTexImage, width / 2, height / 2, - twoComponentFormat.externalFormat, GL::UNSIGNED_BYTE, 1, &outputTextureChroma); + twoComponentFormat.externalFormat, GL_UNSIGNED_BYTE, 1, &outputTextureChroma); if (outputTextureLuma == nil || outputTextureChroma == nil) { return nullptr; } diff --git a/tgfx/src/gpu/opengl/eagl/EAGLWindow.mm b/tgfx/src/gpu/opengl/eagl/EAGLWindow.mm index a6062812d1..7e2fa72e30 100644 --- a/tgfx/src/gpu/opengl/eagl/EAGLWindow.mm +++ b/tgfx/src/gpu/opengl/eagl/EAGLWindow.mm @@ -123,17 +123,17 @@ return nullptr; } gl->genFramebuffers(1, &frameBufferID); - gl->bindFramebuffer(GL::FRAMEBUFFER, frameBufferID); + gl->bindFramebuffer(GL_FRAMEBUFFER, frameBufferID); gl->genRenderbuffers(1, &colorBuffer); - gl->bindRenderbuffer(GL::RENDERBUFFER, colorBuffer); - gl->framebufferRenderbuffer(GL::FRAMEBUFFER, GL::COLOR_ATTACHMENT0, GL::RENDERBUFFER, + gl->bindRenderbuffer(GL_RENDERBUFFER, colorBuffer); + gl->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, colorBuffer); auto eaglContext = static_cast(context->device())->eaglContext(); - [eaglContext renderbufferStorage:GL::RENDERBUFFER fromDrawable:layer]; - auto frameBufferStatus = gl->checkFramebufferStatus(GL::FRAMEBUFFER); - gl->bindFramebuffer(GL::FRAMEBUFFER, 0); - gl->bindRenderbuffer(GL::RENDERBUFFER, 0); - if (frameBufferStatus != GL::FRAMEBUFFER_COMPLETE) { + [eaglContext renderbufferStorage:GL_RENDERBUFFER fromDrawable:layer]; + auto frameBufferStatus = gl->checkFramebufferStatus(GL_FRAMEBUFFER); + gl->bindFramebuffer(GL_FRAMEBUFFER, 0); + gl->bindRenderbuffer(GL_RENDERBUFFER, 0); + if (frameBufferStatus != GL_FRAMEBUFFER_COMPLETE) { LOGE("EAGLWindow::onCreateSurface() Framebuffer is not complete!"); return nullptr; } @@ -147,10 +147,10 @@ void EAGLWindow::onPresent(Context* context, int64_t) { auto gl = GLContext::Unwrap(context); if (layer) { - gl->bindRenderbuffer(GL::RENDERBUFFER, colorBuffer); + gl->bindRenderbuffer(GL_RENDERBUFFER, colorBuffer); auto eaglContext = static_cast(context->device())->eaglContext(); - [eaglContext presentRenderbuffer:GL::RENDERBUFFER]; - gl->bindRenderbuffer(GL::RENDERBUFFER, 0); + [eaglContext presentRenderbuffer:GL_RENDERBUFFER]; + gl->bindRenderbuffer(GL_RENDERBUFFER, 0); } else { gl->flush(); } diff --git a/tgfx/src/gpu/opengl/webgl/WebGLWindow.cpp b/tgfx/src/gpu/opengl/webgl/WebGLWindow.cpp index 3b541fbca9..ecfd686ccd 100644 --- a/tgfx/src/gpu/opengl/webgl/WebGLWindow.cpp +++ b/tgfx/src/gpu/opengl/webgl/WebGLWindow.cpp @@ -19,6 +19,7 @@ #include "gpu/opengl/webgl/WebGLWindow.h" #include "core/utils/Log.h" #include "gpu/opengl/GLDefines.h" +#include "gpu/opengl/GLRenderTarget.h" namespace tgfx { std::shared_ptr WebGLWindow::MakeFrom(const std::string& canvasID) { @@ -45,10 +46,11 @@ std::shared_ptr WebGLWindow::onCreateSurface(Context* context) { LOGE("WebGLWindow::onCreateSurface() Can not create a Surface with zero size."); return nullptr; } - GLFrameBufferInfo glInfo = {}; + GLFrameBuffer glInfo = {}; glInfo.id = 0; - glInfo.format = GL::RGBA8; - BackendRenderTarget renderTarget(glInfo, width, height); - return Surface::MakeFrom(context, renderTarget, ImageOrigin::BottomLeft); + glInfo.format = PixelFormat::RGBA_8888; + auto renderTarget = + GLRenderTarget::MakeFrom(context, glInfo, width, height, ImageOrigin::BottomLeft); + return Surface::MakeFrom(context, renderTarget); } } // namespace tgfx diff --git a/tgfx/src/platform/web/NativeTextureBuffer.cpp b/tgfx/src/platform/web/NativeTextureBuffer.cpp index ec9147ae24..acac8d965d 100644 --- a/tgfx/src/platform/web/NativeTextureBuffer.cpp +++ b/tgfx/src/platform/web/NativeTextureBuffer.cpp @@ -17,6 +17,7 @@ ///////////////////////////////////////////////////////////////////////////////////////////////// #include "NativeTextureBuffer.h" +#include "gpu/opengl/GLContext.h" #include "gpu/opengl/GLTexture.h" using namespace emscripten; @@ -35,7 +36,7 @@ std::shared_ptr NativeTextureBuffer::makeTexture(Context* context) cons if (texture == nullptr) { return nullptr; } - auto& glInfo = std::static_pointer_cast(texture)->getGLInfo(); + auto& glInfo = std::static_pointer_cast(texture)->glSampler(); const auto* gl = GLContext::Unwrap(context); gl->bindTexture(glInfo.target, glInfo.id); source.call("upload", val::module_property("GL")); diff --git a/web/src/pag_wasm_bindings.cpp b/web/src/pag_wasm_bindings.cpp index 4f4c613484..b4e9a453ea 100644 --- a/web/src/pag_wasm_bindings.cpp +++ b/web/src/pag_wasm_bindings.cpp @@ -118,9 +118,9 @@ EMSCRIPTEN_BINDINGS(pag) { .class_function("_FromTexture", optional_override([](int textureID, int width, int height, bool flipY) { GLTextureInfo glInfo = {}; - glInfo.target = GL::TEXTURE_2D; + glInfo.target = GL_TEXTURE_2D; glInfo.id = static_cast(textureID); - glInfo.format = GL::RGBA8; + glInfo.format = GL_RGBA8; BackendTexture glTexture(glInfo, width, height); auto origin = flipY ? ImageOrigin::BottomLeft : ImageOrigin::TopLeft; return PAGSurface::MakeFrom(glTexture, origin); @@ -129,7 +129,7 @@ EMSCRIPTEN_BINDINGS(pag) { optional_override([](int frameBufferID, int width, int height, bool flipY) { GLFrameBufferInfo glFrameBufferInfo = {}; glFrameBufferInfo.id = static_cast(frameBufferID); - glFrameBufferInfo.format = GL::RGBA8; + glFrameBufferInfo.format = GL_RGBA8; BackendRenderTarget glRenderTarget(glFrameBufferInfo, width, height); auto origin = flipY ? ImageOrigin::BottomLeft : ImageOrigin::TopLeft; return PAGSurface::MakeFrom(glRenderTarget, origin); From b7c779e753cb0dc019d3cbcaaa24024aef86a0d1 Mon Sep 17 00:00:00 2001 From: domrjchen Date: Thu, 24 Feb 2022 14:28:25 +0800 Subject: [PATCH 2/2] add 'git lfs prune' to sync_deps.sh --- sync_deps.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/sync_deps.sh b/sync_deps.sh index ae7319c5be..4aa669e172 100755 --- a/sync_deps.sh +++ b/sync_deps.sh @@ -29,3 +29,4 @@ for TOOL in ${NODE_REQUIRED_TOOLS[@]}; do done depsync +git lfs prune > /dev/null