diff --git a/src/Magnum/Shaders/AbstractVector.cpp b/src/Magnum/Shaders/AbstractVector.cpp index c6d78ad8b..91d209981 100644 --- a/src/Magnum/Shaders/AbstractVector.cpp +++ b/src/Magnum/Shaders/AbstractVector.cpp @@ -25,12 +25,12 @@ #include "AbstractVector.h" -#include "Magnum/Texture.h" +#include "Magnum/GL/Texture.h" #include "Magnum/Shaders/visibility.h" namespace Magnum { namespace Shaders { -template AbstractVector& AbstractVector::bindVectorTexture(Texture2D& texture) { +template AbstractVector& AbstractVector::bindVectorTexture(GL::Texture2D& texture) { texture.bind(VectorTextureLayer); return *this; } diff --git a/src/Magnum/Shaders/AbstractVector.h b/src/Magnum/Shaders/AbstractVector.h index 8c31d1f06..07369dc20 100644 --- a/src/Magnum/Shaders/AbstractVector.h +++ b/src/Magnum/Shaders/AbstractVector.h @@ -29,7 +29,7 @@ * @brief Class @ref Magnum::Shaders::AbstractVector, typedef @ref Magnum::Shaders::AbstractVector2D, @ref Magnum::Shaders::AbstractVector3D */ -#include "Magnum/AbstractShaderProgram.h" +#include "Magnum/GL/AbstractShaderProgram.h" #include "Magnum/Shaders/Generic.h" namespace Magnum { namespace Shaders { @@ -40,7 +40,7 @@ namespace Magnum { namespace Shaders { See @ref DistanceFieldVector and @ref Vector for more information. @see @ref shaders, @ref AbstractVector2D, @ref AbstractVector3D */ -template class AbstractVector: public AbstractShaderProgram { +template class AbstractVector: public GL::AbstractShaderProgram { public: /** * @brief Vertex position @@ -61,13 +61,13 @@ template class AbstractVector: public AbstractShaderProg * @brief Bind vector texture * @return Reference to self (for method chaining) */ - AbstractVector& bindVectorTexture(Texture2D& texture); + AbstractVector& bindVectorTexture(GL::Texture2D& texture); #ifdef MAGNUM_BUILD_DEPRECATED /** @brief @copybrief bindVectorTexture() * @deprecated Use @ref bindVectorTexture() instead. */ - CORRADE_DEPRECATED("use bindVectorTexture() instead") AbstractVector& setVectorTexture(Texture2D& texture) { + CORRADE_DEPRECATED("use bindVectorTexture() instead") AbstractVector& setVectorTexture(GL::Texture2D& texture) { return bindVectorTexture(texture); } #endif @@ -79,7 +79,7 @@ template class AbstractVector: public AbstractShaderProg #endif enum: Int { VectorTextureLayer = 15 }; - explicit AbstractVector(NoCreateT) noexcept: AbstractShaderProgram{NoCreate} {} + explicit AbstractVector(NoCreateT) noexcept: GL::AbstractShaderProgram{NoCreate} {} explicit AbstractVector() = default; ~AbstractVector() = default; }; diff --git a/src/Magnum/Shaders/DistanceFieldVector.cpp b/src/Magnum/Shaders/DistanceFieldVector.cpp index 2eb41b7c9..ab8ef990f 100644 --- a/src/Magnum/Shaders/DistanceFieldVector.cpp +++ b/src/Magnum/Shaders/DistanceFieldVector.cpp @@ -27,11 +27,11 @@ #include -#include "Magnum/Context.h" -#include "Magnum/Extensions.h" -#include "Magnum/Shader.h" +#include "Magnum/GL/Context.h" +#include "Magnum/GL/Extensions.h" +#include "Magnum/GL/Shader.h" -#include "Implementation/CreateCompatibilityShader.h" +#include "Magnum/Shaders/Implementation/CreateCompatibilityShader.h" namespace Magnum { namespace Shaders { @@ -50,51 +50,51 @@ template DistanceFieldVector::DistanceFieldV Utility::Resource rs("MagnumShaders"); #ifndef MAGNUM_TARGET_GLES - const Version version = Context::current().supportedVersion({Version::GL320, Version::GL310, Version::GL300, Version::GL210}); + const GL::Version version = GL::Context::current().supportedVersion({GL::Version::GL320, GL::Version::GL310, GL::Version::GL300, GL::Version::GL210}); #else - const Version version = Context::current().supportedVersion({Version::GLES300, Version::GLES200}); + const GL::Version version = GL::Context::current().supportedVersion({GL::Version::GLES300, GL::Version::GLES200}); #endif - Shader vert = Implementation::createCompatibilityShader(rs, version, Shader::Type::Vertex); - Shader frag = Implementation::createCompatibilityShader(rs, version, Shader::Type::Fragment); + GL::Shader vert = Implementation::createCompatibilityShader(rs, version, GL::Shader::Type::Vertex); + GL::Shader frag = Implementation::createCompatibilityShader(rs, version, GL::Shader::Type::Fragment); vert.addSource(rs.get("generic.glsl")) .addSource(rs.get(vertexShaderName())); frag.addSource(rs.get("DistanceFieldVector.frag")); - CORRADE_INTERNAL_ASSERT_OUTPUT(Shader::compile({vert, frag})); + CORRADE_INTERNAL_ASSERT_OUTPUT(GL::Shader::compile({vert, frag})); - AbstractShaderProgram::attachShaders({vert, frag}); + GL::AbstractShaderProgram::attachShaders({vert, frag}); #ifndef MAGNUM_TARGET_GLES - if(!Context::current().isExtensionSupported(version)) + if(!GL::Context::current().isExtensionSupported(version)) #else - if(!Context::current().isVersionSupported(Version::GLES300)) + if(!GL::Context::current().isVersionSupported(GL::Version::GLES300)) #endif { - AbstractShaderProgram::bindAttributeLocation(AbstractVector::Position::Location, "position"); - AbstractShaderProgram::bindAttributeLocation(AbstractVector::TextureCoordinates::Location, "textureCoordinates"); + GL::AbstractShaderProgram::bindAttributeLocation(AbstractVector::Position::Location, "position"); + GL::AbstractShaderProgram::bindAttributeLocation(AbstractVector::TextureCoordinates::Location, "textureCoordinates"); } - CORRADE_INTERNAL_ASSERT_OUTPUT(AbstractShaderProgram::link()); + CORRADE_INTERNAL_ASSERT_OUTPUT(GL::AbstractShaderProgram::link()); #ifndef MAGNUM_TARGET_GLES - if(!Context::current().isExtensionSupported(version)) + if(!GL::Context::current().isExtensionSupported(version)) #endif { - _transformationProjectionMatrixUniform = AbstractShaderProgram::uniformLocation("transformationProjectionMatrix"); - _colorUniform = AbstractShaderProgram::uniformLocation("color"); - _outlineColorUniform = AbstractShaderProgram::uniformLocation("outlineColor"); - _outlineRangeUniform = AbstractShaderProgram::uniformLocation("outlineRange"); - _smoothnessUniform = AbstractShaderProgram::uniformLocation("smoothness"); + _transformationProjectionMatrixUniform = GL::AbstractShaderProgram::uniformLocation("transformationProjectionMatrix"); + _colorUniform = GL::AbstractShaderProgram::uniformLocation("color"); + _outlineColorUniform = GL::AbstractShaderProgram::uniformLocation("outlineColor"); + _outlineRangeUniform = GL::AbstractShaderProgram::uniformLocation("outlineRange"); + _smoothnessUniform = GL::AbstractShaderProgram::uniformLocation("smoothness"); } #ifndef MAGNUM_TARGET_GLES - if(!Context::current().isExtensionSupported(version)) + if(!GL::Context::current().isExtensionSupported(version)) #endif { - AbstractShaderProgram::setUniform(AbstractShaderProgram::uniformLocation("vectorTexture"), - AbstractVector::VectorTextureLayer); + GL::AbstractShaderProgram::setUniform(GL::AbstractShaderProgram::uniformLocation("vectorTexture"), + AbstractVector::VectorTextureLayer); } /* Set defaults in OpenGL ES (for desktop they are set in shader code itself) */ diff --git a/src/Magnum/Shaders/DistanceFieldVector.h b/src/Magnum/Shaders/DistanceFieldVector.h index 24b382d96..44559e813 100644 --- a/src/Magnum/Shaders/DistanceFieldVector.h +++ b/src/Magnum/Shaders/DistanceFieldVector.h @@ -92,7 +92,7 @@ template class MAGNUM_SHADERS_EXPORT DistanceFieldVector * @return Reference to self (for method chaining) */ DistanceFieldVector& setTransformationProjectionMatrix(const MatrixTypeFor& matrix) { - AbstractShaderProgram::setUniform(_transformationProjectionMatrixUniform, matrix); + GL::AbstractShaderProgram::setUniform(_transformationProjectionMatrixUniform, matrix); return *this; } @@ -103,7 +103,7 @@ template class MAGNUM_SHADERS_EXPORT DistanceFieldVector * @see @ref setOutlineColor() */ DistanceFieldVector& setColor(const Color4& color) { - AbstractShaderProgram::setUniform(_colorUniform, color); + GL::AbstractShaderProgram::setUniform(_colorUniform, color); return *this; } @@ -114,7 +114,7 @@ template class MAGNUM_SHADERS_EXPORT DistanceFieldVector * @see @ref setOutlineRange(), @ref setColor() */ DistanceFieldVector& setOutlineColor(const Color4& color) { - AbstractShaderProgram::setUniform(_outlineColorUniform, color); + GL::AbstractShaderProgram::setUniform(_outlineColorUniform, color); return *this; } @@ -133,7 +133,7 @@ template class MAGNUM_SHADERS_EXPORT DistanceFieldVector * @see @ref setOutlineColor() */ DistanceFieldVector& setOutlineRange(Float start, Float end) { - AbstractShaderProgram::setUniform(_outlineRangeUniform, Vector2(start, end)); + GL::AbstractShaderProgram::setUniform(_outlineRangeUniform, Vector2(start, end)); return *this; } @@ -146,18 +146,18 @@ template class MAGNUM_SHADERS_EXPORT DistanceFieldVector * aliased). Initial value is @cpp 0.04f @ce. */ DistanceFieldVector& setSmoothness(Float value) { - AbstractShaderProgram::setUniform(_smoothnessUniform, value); + GL::AbstractShaderProgram::setUniform(_smoothnessUniform, value); return *this; } #ifndef DOXYGEN_GENERATING_OUTPUT /* Overloads to remove WTF-factor from method chaining order */ - DistanceFieldVector& bindVectorTexture(Texture2D& texture) { + DistanceFieldVector& bindVectorTexture(GL::Texture2D& texture) { AbstractVector::bindVectorTexture(texture); return *this; } #ifdef MAGNUM_BUILD_DEPRECATED - CORRADE_DEPRECATED("use bindVectorTexture() instead") DistanceFieldVector& setVectorTexture(Texture2D& texture) { + CORRADE_DEPRECATED("use bindVectorTexture() instead") DistanceFieldVector& setVectorTexture(GL::Texture2D& texture) { return bindVectorTexture(texture); } #endif diff --git a/src/Magnum/Shaders/Flat.cpp b/src/Magnum/Shaders/Flat.cpp index a5fdc0049..beb3bd947 100644 --- a/src/Magnum/Shaders/Flat.cpp +++ b/src/Magnum/Shaders/Flat.cpp @@ -27,12 +27,12 @@ #include -#include "Magnum/Context.h" -#include "Magnum/Extensions.h" -#include "Magnum/Shader.h" -#include "Magnum/Texture.h" +#include "Magnum/GL/Context.h" +#include "Magnum/GL/Extensions.h" +#include "Magnum/GL/Shader.h" +#include "Magnum/GL/Texture.h" -#include "Implementation/CreateCompatibilityShader.h" +#include "Magnum/Shaders/Implementation/CreateCompatibilityShader.h" namespace Magnum { namespace Shaders { @@ -53,13 +53,13 @@ template Flat::Flat(const Flags flags): _fla Utility::Resource rs("MagnumShaders"); #ifndef MAGNUM_TARGET_GLES - const Version version = Context::current().supportedVersion({Version::GL320, Version::GL310, Version::GL300, Version::GL210}); + const GL::Version version = GL::Context::current().supportedVersion({GL::Version::GL320, GL::Version::GL310, GL::Version::GL300, GL::Version::GL210}); #else - const Version version = Context::current().supportedVersion({Version::GLES300, Version::GLES200}); + const GL::Version version = GL::Context::current().supportedVersion({GL::Version::GLES300, GL::Version::GLES200}); #endif - Shader vert = Implementation::createCompatibilityShader(rs, version, Shader::Type::Vertex); - Shader frag = Implementation::createCompatibilityShader(rs, version, Shader::Type::Fragment); + GL::Shader vert = Implementation::createCompatibilityShader(rs, version, GL::Shader::Type::Vertex); + GL::Shader frag = Implementation::createCompatibilityShader(rs, version, GL::Shader::Type::Fragment); vert.addSource(flags & Flag::Textured ? "#define TEXTURED\n" : "") .addSource(rs.get("generic.glsl")) @@ -67,14 +67,14 @@ template Flat::Flat(const Flags flags): _fla frag.addSource(flags & Flag::Textured ? "#define TEXTURED\n" : "") .addSource(rs.get("Flat.frag")); - CORRADE_INTERNAL_ASSERT_OUTPUT(Shader::compile({vert, frag})); + CORRADE_INTERNAL_ASSERT_OUTPUT(GL::Shader::compile({vert, frag})); attachShaders({vert, frag}); #ifndef MAGNUM_TARGET_GLES - if(!Context::current().isExtensionSupported(version)) + if(!GL::Context::current().isExtensionSupported(version)) #else - if(!Context::current().isVersionSupported(Version::GLES300)) + if(!GL::Context::current().isVersionSupported(GL::Version::GLES300)) #endif { bindAttributeLocation(Position::Location, "position"); @@ -84,7 +84,7 @@ template Flat::Flat(const Flags flags): _fla CORRADE_INTERNAL_ASSERT_OUTPUT(link()); #ifndef MAGNUM_TARGET_GLES - if(!Context::current().isExtensionSupported(version)) + if(!GL::Context::current().isExtensionSupported(version)) #endif { _transformationProjectionMatrixUniform = uniformLocation("transformationProjectionMatrix"); @@ -92,7 +92,7 @@ template Flat::Flat(const Flags flags): _fla } #ifndef MAGNUM_TARGET_GLES - if(!Context::current().isExtensionSupported(version)) + if(!GL::Context::current().isExtensionSupported(version)) #endif { if(flags & Flag::Textured) setUniform(uniformLocation("textureData"), TextureLayer); @@ -105,7 +105,7 @@ template Flat::Flat(const Flags flags): _fla #endif } -template Flat& Flat::bindTexture(Texture2D& texture) { +template Flat& Flat::bindTexture(GL::Texture2D& texture) { if(_flags & Flag::Textured) texture.bind(TextureLayer); return *this; } diff --git a/src/Magnum/Shaders/Flat.h b/src/Magnum/Shaders/Flat.h index 65f9d6b64..ac51a623b 100644 --- a/src/Magnum/Shaders/Flat.h +++ b/src/Magnum/Shaders/Flat.h @@ -29,8 +29,8 @@ * @brief Class @ref Magnum::Shaders::Flat, typedef @ref Magnum::Shaders::Flat2D, @ref Magnum::Shaders::Flat3D */ -#include "Magnum/AbstractShaderProgram.h" #include "Magnum/DimensionTraits.h" +#include "Magnum/GL/AbstractShaderProgram.h" #include "Magnum/Math/Color.h" #include "Magnum/Math/Matrix3.h" #include "Magnum/Math/Matrix4.h" @@ -85,7 +85,7 @@ Common rendering setup: @see @ref shaders, @ref Flat2D, @ref Flat3D */ -template class MAGNUM_SHADERS_EXPORT Flat: public AbstractShaderProgram { +template class MAGNUM_SHADERS_EXPORT Flat: public GL::AbstractShaderProgram { public: /** * @brief Vertex position @@ -140,7 +140,7 @@ template class MAGNUM_SHADERS_EXPORT Flat: public Abstra * This function can be safely used for constructing (and later * destructing) objects even without any OpenGL context being active. */ - explicit Flat(NoCreateT) noexcept: AbstractShaderProgram{NoCreate} {} + explicit Flat(NoCreateT) noexcept: GL::AbstractShaderProgram{NoCreate} {} /** @brief Flags */ Flags flags() const { return _flags; } @@ -175,13 +175,13 @@ template class MAGNUM_SHADERS_EXPORT Flat: public Abstra * Has effect only if @ref Flag::Textured is set. * @see @ref setColor() */ - Flat& bindTexture(Texture2D& texture); + Flat& bindTexture(GL::Texture2D& texture); #ifdef MAGNUM_BUILD_DEPRECATED /** @brief @copybrief bindTexture() * @deprecated Use @ref bindTexture() instead. */ - CORRADE_DEPRECATED("use bindTexture() instead") Flat& setTexture(Texture2D& texture) { + CORRADE_DEPRECATED("use bindTexture() instead") Flat& setTexture(GL::Texture2D& texture) { return bindTexture(texture); } #endif diff --git a/src/Magnum/Shaders/Generic.h b/src/Magnum/Shaders/Generic.h index 542a8067f..8fc250558 100644 --- a/src/Magnum/Shaders/Generic.h +++ b/src/Magnum/Shaders/Generic.h @@ -29,7 +29,7 @@ * @brief Struct @ref Magnum::Shaders::Generic, typedef @ref Magnum::Shaders::Generic2D, @ref Magnum::Shaders::Generic3D */ -#include "Magnum/Attribute.h" +#include "Magnum/GL/Attribute.h" namespace Magnum { namespace Shaders { @@ -51,21 +51,21 @@ template struct Generic { * * @ref Vector2 in 2D and @ref Vector3 in 3D. */ - typedef Attribute<0, T> Position; + typedef GL::Attribute<0, T> Position; /** * @brief 2D texture coordinates * * @ref Vector2. */ - typedef Attribute<1, Vector2> TextureCoordinates; + typedef GL::Attribute<1, Vector2> TextureCoordinates; /** * @brief Vertex normal * * @ref Vector3, defined only in 3D. */ - typedef Attribute<2, Vector3> Normal; + typedef GL::Attribute<2, Vector3> Normal; /** * @brief Vertex color @@ -73,7 +73,7 @@ template struct Generic { * @ref Color4, however defaults to @ref Color3 if @ref MAGNUM_BUILD_DEPRECATED * is defined. See the constructor documentation for more information. */ - struct Color: Attribute<3, Color4> { + struct Color: GL::Attribute<3, Color4> { /** * @brief Constructor * @param components Component count @@ -100,9 +100,9 @@ typedef Generic<3> Generic3D; #ifndef DOXYGEN_GENERATING_OUTPUT struct BaseGeneric { - typedef Attribute<1, Vector2> TextureCoordinates; + typedef GL::Attribute<1, Vector2> TextureCoordinates; - struct Color: Attribute<3, Color4> { + struct Color: GL::Attribute<3, Color4> { constexpr explicit Color(Components components, DataType dataType = DataType::Float, DataOptions dataOptions = DataOptions()): Attribute<3, Color4>{components, dataType, dataOptions} {} #ifdef MAGNUM_BUILD_DEPRECATED @@ -112,12 +112,12 @@ struct BaseGeneric { }; template<> struct Generic<2>: BaseGeneric { - typedef Attribute<0, Vector2> Position; + typedef GL::Attribute<0, Vector2> Position; }; template<> struct Generic<3>: BaseGeneric { - typedef Attribute<0, Vector3> Position; - typedef Attribute<2, Vector3> Normal; + typedef GL::Attribute<0, Vector3> Position; + typedef GL::Attribute<2, Vector3> Normal; }; #endif diff --git a/src/Magnum/Shaders/Implementation/CreateCompatibilityShader.h b/src/Magnum/Shaders/Implementation/CreateCompatibilityShader.h index 365926faa..d864a5f16 100644 --- a/src/Magnum/Shaders/Implementation/CreateCompatibilityShader.h +++ b/src/Magnum/Shaders/Implementation/CreateCompatibilityShader.h @@ -27,9 +27,9 @@ #include -#include "Magnum/Context.h" -#include "Magnum/Extensions.h" -#include "Magnum/Shader.h" +#include "Magnum/GL/Context.h" +#include "Magnum/GL/Extensions.h" +#include "Magnum/GL/Shader.h" /* Enable only when compiling Shaders library and thus work around "static symbol not used" warning when using this file for TextureTools */ @@ -41,15 +41,15 @@ static void importShaderResources() { namespace Magnum { namespace Shaders { namespace Implementation { -inline Shader createCompatibilityShader(const Utility::Resource& rs, Version version, Shader::Type type) { - Shader shader(version, type); +inline GL::Shader createCompatibilityShader(const Utility::Resource& rs, GL::Version version, GL::Shader::Type type) { + GL::Shader shader(version, type); #ifndef MAGNUM_TARGET_GLES - if(Context::current().isExtensionDisabled(version)) + if(GL::Context::current().isExtensionDisabled(version)) shader.addSource("#define DISABLE_GL_ARB_explicit_attrib_location\n"); - if(Context::current().isExtensionDisabled(version)) + if(GL::Context::current().isExtensionDisabled(version)) shader.addSource("#define DISABLE_GL_ARB_shading_language_420pack\n"); - if(Context::current().isExtensionDisabled(version)) + if(GL::Context::current().isExtensionDisabled(version)) shader.addSource("#define DISABLE_GL_ARB_explicit_uniform_location\n"); #endif diff --git a/src/Magnum/Shaders/MeshVisualizer.cpp b/src/Magnum/Shaders/MeshVisualizer.cpp index e14a3321c..7f6e3c44f 100644 --- a/src/Magnum/Shaders/MeshVisualizer.cpp +++ b/src/Magnum/Shaders/MeshVisualizer.cpp @@ -28,11 +28,11 @@ #include #include -#include "Magnum/Context.h" -#include "Magnum/Extensions.h" -#include "Magnum/Shader.h" +#include "Magnum/GL/Context.h" +#include "Magnum/GL/Extensions.h" +#include "Magnum/GL/Shader.h" -#include "Implementation/CreateCompatibilityShader.h" +#include "Magnum/Shaders/Implementation/CreateCompatibilityShader.h" namespace Magnum { namespace Shaders { @@ -40,15 +40,15 @@ MeshVisualizer::MeshVisualizer(const Flags flags): _flags{flags} { #ifndef MAGNUM_TARGET_GLES2 if(flags & Flag::Wireframe && !(flags & Flag::NoGeometryShader)) { #ifndef MAGNUM_TARGET_GLES - MAGNUM_ASSERT_VERSION_SUPPORTED(Version::GL320); - MAGNUM_ASSERT_EXTENSION_SUPPORTED(Extensions::GL::ARB::geometry_shader4); + MAGNUM_ASSERT_GL_VERSION_SUPPORTED(GL::Version::GL320); + MAGNUM_ASSERT_GL_EXTENSION_SUPPORTED(GL::Extensions::ARB::geometry_shader4); #elif !defined(MAGNUM_TARGET_WEBGL) - MAGNUM_ASSERT_EXTENSION_SUPPORTED(Extensions::GL::EXT::geometry_shader); + MAGNUM_ASSERT_GL_EXTENSION_SUPPORTED(GL::Extensions::EXT::geometry_shader); #endif } #else if(_flags & Flag::Wireframe) - MAGNUM_ASSERT_EXTENSION_SUPPORTED(Extensions::GL::OES::standard_derivatives); + MAGNUM_ASSERT_GL_EXTENSION_SUPPORTED(GL::Extensions::OES::standard_derivatives); #endif #ifdef MAGNUM_BUILD_STATIC @@ -59,24 +59,24 @@ MeshVisualizer::MeshVisualizer(const Flags flags): _flags{flags} { Utility::Resource rs("MagnumShaders"); #ifndef MAGNUM_TARGET_GLES - const Version version = Context::current().supportedVersion({Version::GL320, Version::GL310, Version::GL300, Version::GL210}); - CORRADE_INTERNAL_ASSERT(!flags || flags & Flag::NoGeometryShader || version >= Version::GL320); + const GL::Version version = GL::Context::current().supportedVersion({GL::Version::GL320, GL::Version::GL310, GL::Version::GL300, GL::Version::GL210}); + CORRADE_INTERNAL_ASSERT(!flags || flags & Flag::NoGeometryShader || version >= GL::Version::GL320); #elif !defined(MAGNUM_TARGET_WEBGL) - const Version version = Context::current().supportedVersion({Version::GLES310, Version::GLES300, Version::GLES200}); - CORRADE_INTERNAL_ASSERT(!flags || flags & Flag::NoGeometryShader || version >= Version::GLES310); + const GL::Version version = GL::Context::current().supportedVersion({GL::Version::GLES310, GL::Version::GLES300, GL::Version::GLES200}); + CORRADE_INTERNAL_ASSERT(!flags || flags & Flag::NoGeometryShader || version >= GL::Version::GLES310); #else - const Version version = Context::current().supportedVersion({Version::GLES300, Version::GLES200}); + const GL::Version version = GL::Context::current().supportedVersion({GL::Version::GLES300, GL::Version::GLES200}); #endif - Shader vert = Implementation::createCompatibilityShader(rs, version, Shader::Type::Vertex); - Shader frag = Implementation::createCompatibilityShader(rs, version, Shader::Type::Fragment); + GL::Shader vert = Implementation::createCompatibilityShader(rs, version, GL::Shader::Type::Vertex); + GL::Shader frag = Implementation::createCompatibilityShader(rs, version, GL::Shader::Type::Fragment); vert.addSource(flags & Flag::Wireframe ? "#define WIREFRAME_RENDERING\n" : "") .addSource(flags & Flag::NoGeometryShader ? "#define NO_GEOMETRY_SHADER\n" : "") #ifdef MAGNUM_TARGET_WEBGL .addSource("#define SUBSCRIPTING_WORKAROUND\n") #elif defined(MAGNUM_TARGET_GLES2) - .addSource(Context::current().detectedDriver() & Context::DetectedDriver::Angle ? + .addSource(GL::Context::current().detectedDriver() & GL::Context::DetectedDriver::Angle ? "#define SUBSCRIPTING_WORKAROUND\n" : "") #endif .addSource(rs.get("generic.glsl")) @@ -86,18 +86,18 @@ MeshVisualizer::MeshVisualizer(const Flags flags): _flags{flags} { .addSource(rs.get("MeshVisualizer.frag")); #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) - Containers::Optional geom; + Containers::Optional geom; if(flags & Flag::Wireframe && !(flags & Flag::NoGeometryShader)) { - geom = Implementation::createCompatibilityShader(rs, version, Shader::Type::Geometry); + geom = Implementation::createCompatibilityShader(rs, version, GL::Shader::Type::Geometry); geom->addSource(rs.get("MeshVisualizer.geom")); } #endif #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) - if(geom) CORRADE_INTERNAL_ASSERT_OUTPUT(Shader::compile({vert, *geom, frag})); + if(geom) CORRADE_INTERNAL_ASSERT_OUTPUT(GL::Shader::compile({vert, *geom, frag})); else #endif - CORRADE_INTERNAL_ASSERT_OUTPUT(Shader::compile({vert, frag})); + CORRADE_INTERNAL_ASSERT_OUTPUT(GL::Shader::compile({vert, frag})); attachShaders({vert, frag}); #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) @@ -105,16 +105,16 @@ MeshVisualizer::MeshVisualizer(const Flags flags): _flags{flags} { #endif #ifndef MAGNUM_TARGET_GLES - if(!Context::current().isExtensionSupported(version)) + if(!GL::Context::current().isExtensionSupported(version)) #else - if(!Context::current().isVersionSupported(Version::GLES300)) + if(!GL::Context::current().isVersionSupported(GL::Version::GLES300)) #endif { bindAttributeLocation(Position::Location, "position"); #if !defined(MAGNUM_TARGET_GLES) || defined(MAGNUM_TARGET_GLES2) #ifndef MAGNUM_TARGET_GLES - if(!Context::current().isVersionSupported(Version::GL310)) + if(!GL::Context::current().isVersionSupported(GL::Version::GL310)) #endif { bindAttributeLocation(VertexIndex::Location, "vertexIndex"); @@ -125,7 +125,7 @@ MeshVisualizer::MeshVisualizer(const Flags flags): _flags{flags} { CORRADE_INTERNAL_ASSERT_OUTPUT(link()); #ifndef MAGNUM_TARGET_GLES - if(!Context::current().isExtensionSupported(version)) + if(!GL::Context::current().isExtensionSupported(version)) #endif { _transformationProjectionMatrixUniform = uniformLocation("transformationProjectionMatrix"); diff --git a/src/Magnum/Shaders/MeshVisualizer.h b/src/Magnum/Shaders/MeshVisualizer.h index 78a7c463c..1e38b14d9 100644 --- a/src/Magnum/Shaders/MeshVisualizer.h +++ b/src/Magnum/Shaders/MeshVisualizer.h @@ -29,10 +29,9 @@ * @brief Class @ref Magnum::Shaders::MeshVisualizer */ -#include "Magnum/AbstractShaderProgram.h" +#include "Magnum/GL/AbstractShaderProgram.h" #include "Magnum/Math/Color.h" #include "Magnum/Math/Matrix4.h" - #include "Magnum/Shaders/visibility.h" namespace Magnum { namespace Shaders { @@ -104,14 +103,14 @@ Rendering setup the same as above. @see @ref shaders @todo Understand and add support wireframe width/smoothness without GS */ -class MAGNUM_SHADERS_EXPORT MeshVisualizer: public AbstractShaderProgram { +class MAGNUM_SHADERS_EXPORT MeshVisualizer: public GL::AbstractShaderProgram { public: /** * @brief Vertex position * * @ref shaders-generic "Generic attribute", @ref Vector3. */ - typedef Attribute<0, Vector3> Position; + typedef GL::Attribute<0, Vector3> Position; /** * @brief Vertex index @@ -123,7 +122,7 @@ class MAGNUM_SHADERS_EXPORT MeshVisualizer: public AbstractShaderProgram { * 3.1, OpenGL ES 3.0 and newer this value is provided by the shader * itself, so the attribute is not needed. */ - typedef Attribute<3, Float> VertexIndex; + typedef GL::Attribute<3, Float> VertexIndex; /** * @brief Flag @@ -169,7 +168,7 @@ class MAGNUM_SHADERS_EXPORT MeshVisualizer: public AbstractShaderProgram { * This function can be safely used for constructing (and later * destructing) objects even without any OpenGL context being active. */ - explicit MeshVisualizer(NoCreateT) noexcept: AbstractShaderProgram{NoCreate} {} + explicit MeshVisualizer(NoCreateT) noexcept: GL::AbstractShaderProgram{NoCreate} {} /** * @brief Set transformation and projection matrix diff --git a/src/Magnum/Shaders/Phong.cpp b/src/Magnum/Shaders/Phong.cpp index 34d01f81e..1b5e3997b 100644 --- a/src/Magnum/Shaders/Phong.cpp +++ b/src/Magnum/Shaders/Phong.cpp @@ -27,12 +27,12 @@ #include -#include "Magnum/Context.h" -#include "Magnum/Extensions.h" -#include "Magnum/Shader.h" -#include "Magnum/Texture.h" +#include "Magnum/GL/Context.h" +#include "Magnum/GL/Extensions.h" +#include "Magnum/GL/Shader.h" +#include "Magnum/GL/Texture.h" -#include "Implementation/CreateCompatibilityShader.h" +#include "Magnum/Shaders/Implementation/CreateCompatibilityShader.h" namespace Magnum { namespace Shaders { @@ -53,13 +53,13 @@ Phong::Phong(const Flags flags): _flags(flags) { Utility::Resource rs("MagnumShaders"); #ifndef MAGNUM_TARGET_GLES - const Version version = Context::current().supportedVersion({Version::GL320, Version::GL310, Version::GL300, Version::GL210}); + const GL::Version version = GL::Context::current().supportedVersion({GL::Version::GL320, GL::Version::GL310, GL::Version::GL300, GL::Version::GL210}); #else - const Version version = Context::current().supportedVersion({Version::GLES300, Version::GLES200}); + const GL::Version version = GL::Context::current().supportedVersion({GL::Version::GLES300, GL::Version::GLES200}); #endif - Shader vert = Implementation::createCompatibilityShader(rs, version, Shader::Type::Vertex); - Shader frag = Implementation::createCompatibilityShader(rs, version, Shader::Type::Fragment); + GL::Shader vert = Implementation::createCompatibilityShader(rs, version, GL::Shader::Type::Vertex); + GL::Shader frag = Implementation::createCompatibilityShader(rs, version, GL::Shader::Type::Fragment); vert.addSource(flags ? "#define TEXTURED\n" : "") .addSource(rs.get("generic.glsl")) @@ -69,14 +69,14 @@ Phong::Phong(const Flags flags): _flags(flags) { .addSource(flags & Flag::SpecularTexture ? "#define SPECULAR_TEXTURE\n" : "") .addSource(rs.get("Phong.frag")); - CORRADE_INTERNAL_ASSERT_OUTPUT(Shader::compile({vert, frag})); + CORRADE_INTERNAL_ASSERT_OUTPUT(GL::Shader::compile({vert, frag})); attachShaders({vert, frag}); #ifndef MAGNUM_TARGET_GLES - if(!Context::current().isExtensionSupported(version)) + if(!GL::Context::current().isExtensionSupported(version)) #else - if(!Context::current().isVersionSupported(Version::GLES300)) + if(!GL::Context::current().isVersionSupported(GL::Version::GLES300)) #endif { bindAttributeLocation(Position::Location, "position"); @@ -87,7 +87,7 @@ Phong::Phong(const Flags flags): _flags(flags) { CORRADE_INTERNAL_ASSERT_OUTPUT(link()); #ifndef MAGNUM_TARGET_GLES - if(!Context::current().isExtensionSupported(version)) + if(!GL::Context::current().isExtensionSupported(version)) #endif { _transformationMatrixUniform = uniformLocation("transformationMatrix"); @@ -102,7 +102,7 @@ Phong::Phong(const Flags flags): _flags(flags) { } #ifndef MAGNUM_TARGET_GLES - if(flags && !Context::current().isExtensionSupported(version)) + if(flags && !GL::Context::current().isExtensionSupported(version)) #endif { if(flags & Flag::AmbientTexture) setUniform(uniformLocation("ambientTexture"), AmbientTextureLayer); @@ -124,23 +124,23 @@ Phong::Phong(const Flags flags): _flags(flags) { #endif } -Phong& Phong::bindAmbientTexture(Texture2D& texture) { +Phong& Phong::bindAmbientTexture(GL::Texture2D& texture) { if(_flags & Flag::AmbientTexture) texture.bind(AmbientTextureLayer); return *this; } -Phong& Phong::bindDiffuseTexture(Texture2D& texture) { +Phong& Phong::bindDiffuseTexture(GL::Texture2D& texture) { if(_flags & Flag::DiffuseTexture) texture.bind(DiffuseTextureLayer); return *this; } -Phong& Phong::bindSpecularTexture(Texture2D& texture) { +Phong& Phong::bindSpecularTexture(GL::Texture2D& texture) { if(_flags & Flag::SpecularTexture) texture.bind(SpecularTextureLayer); return *this; } -Phong& Phong::bindTextures(Texture2D* ambient, Texture2D* diffuse, Texture2D* specular) { - AbstractTexture::bind(AmbientTextureLayer, {ambient, diffuse, specular}); +Phong& Phong::bindTextures(GL::Texture2D* ambient, GL::Texture2D* diffuse, GL::Texture2D* specular) { + GL::AbstractTexture::bind(AmbientTextureLayer, {ambient, diffuse, specular}); return *this; } diff --git a/src/Magnum/Shaders/Phong.h b/src/Magnum/Shaders/Phong.h index 270ac0313..778e6c06c 100644 --- a/src/Magnum/Shaders/Phong.h +++ b/src/Magnum/Shaders/Phong.h @@ -29,7 +29,7 @@ * @brief Class @ref Magnum::Shaders::Phong */ -#include "Magnum/AbstractShaderProgram.h" +#include "Magnum/GL/AbstractShaderProgram.h" #include "Magnum/Math/Color.h" #include "Magnum/Math/Matrix4.h" #include "Magnum/Shaders/Generic.h" @@ -88,7 +88,7 @@ part and then separate the alpha like this: @see @ref shaders */ -class MAGNUM_SHADERS_EXPORT Phong: public AbstractShaderProgram { +class MAGNUM_SHADERS_EXPORT Phong: public GL::AbstractShaderProgram { public: /** * @brief Vertex position @@ -147,7 +147,7 @@ class MAGNUM_SHADERS_EXPORT Phong: public AbstractShaderProgram { * This function can be safely used for constructing (and later * destructing) objects even without any OpenGL context being active. */ - explicit Phong(NoCreateT) noexcept: AbstractShaderProgram{NoCreate} {} + explicit Phong(NoCreateT) noexcept: GL::AbstractShaderProgram{NoCreate} {} /** @brief Flags */ Flags flags() const { return _flags; } @@ -173,13 +173,13 @@ class MAGNUM_SHADERS_EXPORT Phong: public AbstractShaderProgram { * Has effect only if @ref Flag::AmbientTexture is set. * @see @ref bindTextures(), @ref setAmbientColor() */ - Phong& bindAmbientTexture(Texture2D& texture); + Phong& bindAmbientTexture(GL::Texture2D& texture); #ifdef MAGNUM_BUILD_DEPRECATED /** @brief @copybrief bindAmbientTexture() * @deprecated Use @ref bindAmbientTexture() instead. */ - CORRADE_DEPRECATED("use bindAmbientTexture() instead") Phong& setAmbientTexture(Texture2D& texture) { + CORRADE_DEPRECATED("use bindAmbientTexture() instead") Phong& setAmbientTexture(GL::Texture2D& texture) { return bindAmbientTexture(texture); } #endif @@ -205,13 +205,13 @@ class MAGNUM_SHADERS_EXPORT Phong: public AbstractShaderProgram { * Has effect only if @ref Flag::DiffuseTexture is set. * @see @ref bindTextures(), @ref setDiffuseColor() */ - Phong& bindDiffuseTexture(Texture2D& texture); + Phong& bindDiffuseTexture(GL::Texture2D& texture); #ifdef MAGNUM_BUILD_DEPRECATED /** @brief @copybrief bindDiffuseTexture() * @deprecated Use @ref bindDiffuseTexture() instead. */ - CORRADE_DEPRECATED("use bindDiffuseTexture() instead") Phong& setDiffuseTexture(Texture2D& texture) { + CORRADE_DEPRECATED("use bindDiffuseTexture() instead") Phong& setDiffuseTexture(GL::Texture2D& texture) { return bindDiffuseTexture(texture); } #endif @@ -238,13 +238,13 @@ class MAGNUM_SHADERS_EXPORT Phong: public AbstractShaderProgram { * Has effect only if @ref Flag::SpecularTexture is set. * @see @ref bindTextures(), @ref setSpecularColor() */ - Phong& bindSpecularTexture(Texture2D& texture); + Phong& bindSpecularTexture(GL::Texture2D& texture); #ifdef MAGNUM_BUILD_DEPRECATED /** @brief @copybrief bindSpecularTexture() * @deprecated Use @ref bindSpecularTexture() instead. */ - CORRADE_DEPRECATED("use bindSpecularTexture() instead") Phong& setSpecularTexture(Texture2D& texture) { + CORRADE_DEPRECATED("use bindSpecularTexture() instead") Phong& setSpecularTexture(GL::Texture2D& texture) { return bindSpecularTexture(texture); } #endif @@ -259,13 +259,13 @@ class MAGNUM_SHADERS_EXPORT Phong: public AbstractShaderProgram { * @see @ref bindAmbientTexture(), @ref bindDiffuseTexture(), * @ref bindSpecularTexture() */ - Phong& bindTextures(Texture2D* ambient, Texture2D* diffuse, Texture2D* specular); + Phong& bindTextures(GL::Texture2D* ambient, GL::Texture2D* diffuse, GL::Texture2D* specular); #ifdef MAGNUM_BUILD_DEPRECATED /** @brief @copybrief bindTextures() * @deprecated Use @ref bindTextures() instead. */ - CORRADE_DEPRECATED("use bindTextures() instead") Phong& setTextures(Texture2D* ambient, Texture2D* diffuse, Texture2D* specular) { + CORRADE_DEPRECATED("use bindTextures() instead") Phong& setTextures(GL::Texture2D* ambient, GL::Texture2D* diffuse, GL::Texture2D* specular) { return bindTextures(ambient, diffuse, specular); } #endif diff --git a/src/Magnum/Shaders/Test/DistanceFieldVectorGLTest.cpp b/src/Magnum/Shaders/Test/DistanceFieldVectorGLTest.cpp index 13ec56e2d..38110a5ef 100644 --- a/src/Magnum/Shaders/Test/DistanceFieldVectorGLTest.cpp +++ b/src/Magnum/Shaders/Test/DistanceFieldVectorGLTest.cpp @@ -23,12 +23,12 @@ DEALINGS IN THE SOFTWARE. */ -#include "Magnum/OpenGLTester.h" +#include "Magnum/GL/OpenGLTester.h" #include "Magnum/Shaders/DistanceFieldVector.h" namespace Magnum { namespace Shaders { namespace Test { -struct DistanceFieldVectorGLTest: OpenGLTester { +struct DistanceFieldVectorGLTest: GL::OpenGLTester { explicit DistanceFieldVectorGLTest(); void compile2D(); diff --git a/src/Magnum/Shaders/Test/FlatGLTest.cpp b/src/Magnum/Shaders/Test/FlatGLTest.cpp index b2d96179b..65799b524 100644 --- a/src/Magnum/Shaders/Test/FlatGLTest.cpp +++ b/src/Magnum/Shaders/Test/FlatGLTest.cpp @@ -23,12 +23,12 @@ DEALINGS IN THE SOFTWARE. */ -#include "Magnum/OpenGLTester.h" +#include "Magnum/GL/OpenGLTester.h" #include "Magnum/Shaders/Flat.h" namespace Magnum { namespace Shaders { namespace Test { -struct FlatGLTest: OpenGLTester { +struct FlatGLTest: GL::OpenGLTester { explicit FlatGLTest(); void compile2D(); diff --git a/src/Magnum/Shaders/Test/MeshVisualizerGLTest.cpp b/src/Magnum/Shaders/Test/MeshVisualizerGLTest.cpp index 4509ab76e..caced480e 100644 --- a/src/Magnum/Shaders/Test/MeshVisualizerGLTest.cpp +++ b/src/Magnum/Shaders/Test/MeshVisualizerGLTest.cpp @@ -23,14 +23,14 @@ DEALINGS IN THE SOFTWARE. */ -#include "Magnum/Context.h" -#include "Magnum/Extensions.h" -#include "Magnum/OpenGLTester.h" +#include "Magnum/GL/Context.h" +#include "Magnum/GL/Extensions.h" +#include "Magnum/GL/OpenGLTester.h" #include "Magnum/Shaders/MeshVisualizer.h" namespace Magnum { namespace Shaders { namespace Test { -struct MeshVisualizerGLTest: OpenGLTester { +struct MeshVisualizerGLTest: GL::OpenGLTester { explicit MeshVisualizerGLTest(); void compile(); @@ -61,16 +61,16 @@ void MeshVisualizerGLTest::compile() { #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) void MeshVisualizerGLTest::compileWireframeGeometryShader() { #ifndef MAGNUM_TARGET_GLES - if(!Context::current().isExtensionSupported()) - CORRADE_SKIP(Extensions::GL::ARB::geometry_shader4::string() + std::string(" is not supported")); + if(!GL::Context::current().isExtensionSupported()) + CORRADE_SKIP(GL::Extensions::ARB::geometry_shader4::string() + std::string(" is not supported")); #else - if(!Context::current().isExtensionSupported()) - CORRADE_SKIP(Extensions::GL::EXT::geometry_shader::string() + std::string(" is not supported")); + if(!GL::Context::current().isExtensionSupported()) + CORRADE_SKIP(GL::Extensions::EXT::geometry_shader::string() + std::string(" is not supported")); #endif #ifdef MAGNUM_TARGET_GLES - if(Context::current().isExtensionSupported()) - Debug() << "Using" << Extensions::GL::NV::shader_noperspective_interpolation::string(); + if(GL::Context::current().isExtensionSupported()) + Debug() << "Using" << GL::Extensions::NV::shader_noperspective_interpolation::string(); #endif Shaders::MeshVisualizer shader(Shaders::MeshVisualizer::Flag::Wireframe); diff --git a/src/Magnum/Shaders/Test/PhongGLTest.cpp b/src/Magnum/Shaders/Test/PhongGLTest.cpp index edc8a95a9..7836c95a1 100644 --- a/src/Magnum/Shaders/Test/PhongGLTest.cpp +++ b/src/Magnum/Shaders/Test/PhongGLTest.cpp @@ -23,12 +23,12 @@ DEALINGS IN THE SOFTWARE. */ -#include "Magnum/OpenGLTester.h" +#include "Magnum/GL/OpenGLTester.h" #include "Magnum/Shaders/Phong.h" namespace Magnum { namespace Shaders { namespace Test { -struct PhongGLTest: OpenGLTester { +struct PhongGLTest: GL::OpenGLTester { explicit PhongGLTest(); void compile(); diff --git a/src/Magnum/Shaders/Test/VectorGLTest.cpp b/src/Magnum/Shaders/Test/VectorGLTest.cpp index 221dd86f1..468bb0107 100644 --- a/src/Magnum/Shaders/Test/VectorGLTest.cpp +++ b/src/Magnum/Shaders/Test/VectorGLTest.cpp @@ -23,12 +23,12 @@ DEALINGS IN THE SOFTWARE. */ -#include "Magnum/OpenGLTester.h" +#include "Magnum/GL/OpenGLTester.h" #include "Magnum/Shaders/Vector.h" namespace Magnum { namespace Shaders { namespace Test { -struct VectorGLTest: OpenGLTester { +struct VectorGLTest: GL::OpenGLTester { explicit VectorGLTest(); void compile2D(); diff --git a/src/Magnum/Shaders/Test/VertexColorGLTest.cpp b/src/Magnum/Shaders/Test/VertexColorGLTest.cpp index 921f5d870..ef5a87585 100644 --- a/src/Magnum/Shaders/Test/VertexColorGLTest.cpp +++ b/src/Magnum/Shaders/Test/VertexColorGLTest.cpp @@ -23,12 +23,12 @@ DEALINGS IN THE SOFTWARE. */ -#include "Magnum/OpenGLTester.h" +#include "Magnum/GL/OpenGLTester.h" #include "Magnum/Shaders/VertexColor.h" namespace Magnum { namespace Shaders { namespace Test { -struct VertexColorGLTest: OpenGLTester { +struct VertexColorGLTest: GL::OpenGLTester { explicit VertexColorGLTest(); void compile2D(); diff --git a/src/Magnum/Shaders/Vector.cpp b/src/Magnum/Shaders/Vector.cpp index 5ee68c4dc..8824dd33b 100644 --- a/src/Magnum/Shaders/Vector.cpp +++ b/src/Magnum/Shaders/Vector.cpp @@ -27,11 +27,11 @@ #include -#include "Magnum/Context.h" -#include "Magnum/Extensions.h" -#include "Magnum/Shader.h" +#include "Magnum/GL/Context.h" +#include "Magnum/GL/Extensions.h" +#include "Magnum/GL/Shader.h" -#include "Implementation/CreateCompatibilityShader.h" +#include "Magnum/Shaders/Implementation/CreateCompatibilityShader.h" namespace Magnum { namespace Shaders { @@ -50,48 +50,48 @@ template Vector::Vector() { Utility::Resource rs("MagnumShaders"); #ifndef MAGNUM_TARGET_GLES - const Version version = Context::current().supportedVersion({Version::GL320, Version::GL310, Version::GL300, Version::GL210}); + const GL::Version version = GL::Context::current().supportedVersion({GL::Version::GL320, GL::Version::GL310, GL::Version::GL300, GL::Version::GL210}); #else - const Version version = Context::current().supportedVersion({Version::GLES300, Version::GLES200}); + const GL::Version version = GL::Context::current().supportedVersion({GL::Version::GLES300, GL::Version::GLES200}); #endif - Shader vert = Implementation::createCompatibilityShader(rs, version, Shader::Type::Vertex); - Shader frag = Implementation::createCompatibilityShader(rs, version, Shader::Type::Fragment); + GL::Shader vert = Implementation::createCompatibilityShader(rs, version, GL::Shader::Type::Vertex); + GL::Shader frag = Implementation::createCompatibilityShader(rs, version, GL::Shader::Type::Fragment); vert.addSource(rs.get("generic.glsl")) .addSource(rs.get(vertexShaderName())); frag.addSource(rs.get("Vector.frag")); - CORRADE_INTERNAL_ASSERT_OUTPUT(Shader::compile({vert, frag})); + CORRADE_INTERNAL_ASSERT_OUTPUT(GL::Shader::compile({vert, frag})); - AbstractShaderProgram::attachShaders({vert, frag}); + GL::AbstractShaderProgram::attachShaders({vert, frag}); #ifndef MAGNUM_TARGET_GLES - if(!Context::current().isExtensionSupported(version)) + if(!GL::Context::current().isExtensionSupported(version)) #else - if(!Context::current().isVersionSupported(Version::GLES300)) + if(!GL::Context::current().isVersionSupported(GL::Version::GLES300)) #endif { - AbstractShaderProgram::bindAttributeLocation(AbstractVector::Position::Location, "position"); - AbstractShaderProgram::bindAttributeLocation(AbstractVector::TextureCoordinates::Location, "textureCoordinates"); + GL::AbstractShaderProgram::bindAttributeLocation(AbstractVector::Position::Location, "position"); + GL::AbstractShaderProgram::bindAttributeLocation(AbstractVector::TextureCoordinates::Location, "textureCoordinates"); } - CORRADE_INTERNAL_ASSERT_OUTPUT(AbstractShaderProgram::link()); + CORRADE_INTERNAL_ASSERT_OUTPUT(GL::AbstractShaderProgram::link()); #ifndef MAGNUM_TARGET_GLES - if(!Context::current().isExtensionSupported(version)) + if(!GL::Context::current().isExtensionSupported(version)) #endif { - _transformationProjectionMatrixUniform = AbstractShaderProgram::uniformLocation("transformationProjectionMatrix"); - _backgroundColorUniform = AbstractShaderProgram::uniformLocation("backgroundColor"); - _colorUniform = AbstractShaderProgram::uniformLocation("color"); + _transformationProjectionMatrixUniform = GL::AbstractShaderProgram::uniformLocation("transformationProjectionMatrix"); + _backgroundColorUniform = GL::AbstractShaderProgram::uniformLocation("backgroundColor"); + _colorUniform = GL::AbstractShaderProgram::uniformLocation("color"); } #ifndef MAGNUM_TARGET_GLES - if(!Context::current().isExtensionSupported(version)) + if(!GL::Context::current().isExtensionSupported(version)) #endif { - AbstractShaderProgram::setUniform(AbstractShaderProgram::uniformLocation("vectorTexture"), AbstractVector::VectorTextureLayer); + GL::AbstractShaderProgram::setUniform(GL::AbstractShaderProgram::uniformLocation("vectorTexture"), AbstractVector::VectorTextureLayer); } } diff --git a/src/Magnum/Shaders/Vector.h b/src/Magnum/Shaders/Vector.h index 62598c0d4..d294008d7 100644 --- a/src/Magnum/Shaders/Vector.h +++ b/src/Magnum/Shaders/Vector.h @@ -89,7 +89,7 @@ template class MAGNUM_SHADERS_EXPORT Vector: public Abst * @return Reference to self (for method chaining) */ Vector& setTransformationProjectionMatrix(const MatrixTypeFor& matrix) { - AbstractShaderProgram::setUniform(_transformationProjectionMatrixUniform, matrix); + GL::AbstractShaderProgram::setUniform(_transformationProjectionMatrixUniform, matrix); return *this; } @@ -101,7 +101,7 @@ template class MAGNUM_SHADERS_EXPORT Vector: public Abst * @see @ref setColor() */ Vector& setBackgroundColor(const Color4& color) { - AbstractShaderProgram::setUniform(_backgroundColorUniform, color); + GL::AbstractShaderProgram::setUniform(_backgroundColorUniform, color); return *this; } @@ -112,18 +112,18 @@ template class MAGNUM_SHADERS_EXPORT Vector: public Abst * @see @ref setBackgroundColor() */ Vector& setColor(const Color4& color) { - AbstractShaderProgram::setUniform(_colorUniform, color); + GL::AbstractShaderProgram::setUniform(_colorUniform, color); return *this; } #ifndef DOXYGEN_GENERATING_OUTPUT /* Overloads to remove WTF-factor from method chaining order */ - Vector& bindVectorTexture(Texture2D& texture) { + Vector& bindVectorTexture(GL::Texture2D& texture) { AbstractVector::bindVectorTexture(texture); return *this; } #ifdef MAGNUM_BUILD_DEPRECATED - CORRADE_DEPRECATED("use bindVectorTexture() instead") Vector& setVectorTexture(Texture2D& texture) { + CORRADE_DEPRECATED("use bindVectorTexture() instead") Vector& setVectorTexture(GL::Texture2D& texture) { return bindVectorTexture(texture); } #endif diff --git a/src/Magnum/Shaders/VertexColor.cpp b/src/Magnum/Shaders/VertexColor.cpp index 7d5088f2d..7da62e110 100644 --- a/src/Magnum/Shaders/VertexColor.cpp +++ b/src/Magnum/Shaders/VertexColor.cpp @@ -27,11 +27,11 @@ #include -#include "Magnum/Context.h" -#include "Magnum/Extensions.h" -#include "Magnum/Shader.h" +#include "Magnum/GL/Context.h" +#include "Magnum/GL/Extensions.h" +#include "Magnum/GL/Shader.h" -#include "Implementation/CreateCompatibilityShader.h" +#include "Magnum/Shaders/Implementation/CreateCompatibilityShader.h" namespace Magnum { namespace Shaders { @@ -50,26 +50,26 @@ template VertexColor::VertexColor() { Utility::Resource rs("MagnumShaders"); #ifndef MAGNUM_TARGET_GLES - const Version version = Context::current().supportedVersion({Version::GL320, Version::GL310, Version::GL300, Version::GL210}); + const GL::Version version = GL::Context::current().supportedVersion({GL::Version::GL320, GL::Version::GL310, GL::Version::GL300, GL::Version::GL210}); #else - const Version version = Context::current().supportedVersion({Version::GLES300, Version::GLES200}); + const GL::Version version = GL::Context::current().supportedVersion({GL::Version::GLES300, GL::Version::GLES200}); #endif - Shader vert = Implementation::createCompatibilityShader(rs, version, Shader::Type::Vertex); - Shader frag = Implementation::createCompatibilityShader(rs, version, Shader::Type::Fragment); + GL::Shader vert = Implementation::createCompatibilityShader(rs, version, GL::Shader::Type::Vertex); + GL::Shader frag = Implementation::createCompatibilityShader(rs, version, GL::Shader::Type::Fragment); vert.addSource(rs.get("generic.glsl")) .addSource(rs.get(vertexShaderName())); frag.addSource(rs.get("VertexColor.frag")); - CORRADE_INTERNAL_ASSERT_OUTPUT(Shader::compile({vert, frag})); + CORRADE_INTERNAL_ASSERT_OUTPUT(GL::Shader::compile({vert, frag})); attachShaders({vert, frag}); #ifndef MAGNUM_TARGET_GLES - if(!Context::current().isExtensionSupported(version)) + if(!GL::Context::current().isExtensionSupported(version)) #else - if(!Context::current().isVersionSupported(Version::GLES300)) + if(!GL::Context::current().isVersionSupported(GL::Version::GLES300)) #endif { bindAttributeLocation(Position::Location, "position"); @@ -79,7 +79,7 @@ template VertexColor::VertexColor() { CORRADE_INTERNAL_ASSERT_OUTPUT(link()); #ifndef MAGNUM_TARGET_GLES - if(!Context::current().isExtensionSupported(version)) + if(!GL::Context::current().isExtensionSupported(version)) #endif { _transformationProjectionMatrixUniform = uniformLocation("transformationProjectionMatrix"); diff --git a/src/Magnum/Shaders/VertexColor.h b/src/Magnum/Shaders/VertexColor.h index a4571e18e..ca2cc9b78 100644 --- a/src/Magnum/Shaders/VertexColor.h +++ b/src/Magnum/Shaders/VertexColor.h @@ -29,8 +29,8 @@ * @brief Class @ref Magnum::Shaders::VertexColor */ -#include "Magnum/AbstractShaderProgram.h" #include "Magnum/DimensionTraits.h" +#include "Magnum/GL/AbstractShaderProgram.h" #include "Magnum/Math/Color.h" #include "Magnum/Math/Matrix3.h" #include "Magnum/Math/Matrix4.h" @@ -63,7 +63,7 @@ Common rendering setup: @see @ref shaders, @ref VertexColor2D, @ref VertexColor3D */ -template class MAGNUM_SHADERS_EXPORT VertexColor: public AbstractShaderProgram { +template class MAGNUM_SHADERS_EXPORT VertexColor: public GL::AbstractShaderProgram { public: /** * @brief Vertex position