diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2016-09-29 15:32:48 +0200 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-09-29 10:17:47 -0700 |
commit | cc78b74098e02311cc646fe5b82c13641ff705fa (patch) | |
tree | af0219d5611f0984bf3b244a336fbc6074a44cb4 /src/mbgl/sprite | |
parent | 15aece8a30dcc1f1f97e28180edda46d05641a2d (diff) | |
download | qtlocation-mapboxgl-cc78b74098e02311cc646fe5b82c13641ff705fa.tar.gz |
[core] remove dependence on gl.h types
Diffstat (limited to 'src/mbgl/sprite')
-rw-r--r-- | src/mbgl/sprite/sprite_atlas.cpp | 12 | ||||
-rw-r--r-- | src/mbgl/sprite/sprite_atlas.hpp | 7 |
2 files changed, 9 insertions, 10 deletions
diff --git a/src/mbgl/sprite/sprite_atlas.cpp b/src/mbgl/sprite/sprite_atlas.cpp index b17bb7c2ec..198b0a6c57 100644 --- a/src/mbgl/sprite/sprite_atlas.cpp +++ b/src/mbgl/sprite/sprite_atlas.cpp @@ -282,7 +282,7 @@ void SpriteAtlas::copy(const Holder& holder, const SpritePatternMode mode) { dirtyFlag = true; } -void SpriteAtlas::upload(gl::Context& context, uint32_t unit) { +void SpriteAtlas::upload(gl::Context& context, gl::TextureUnit unit) { if (dirtyFlag) { bind(false, context, unit); } @@ -316,7 +316,7 @@ void SpriteAtlas::updateDirty() { dirtySprites.clear(); } -void SpriteAtlas::bind(bool linear, gl::Context& context, uint32_t unit) { +void SpriteAtlas::bind(bool linear, gl::Context& context, gl::TextureUnit unit) { if (!data) { return; // Empty atlas } @@ -325,9 +325,9 @@ void SpriteAtlas::bind(bool linear, gl::Context& context, uint32_t unit) { texture = context.createTexture(); context.activeTexture = unit; context.texture[unit] = *texture; -#ifndef GL_ES_VERSION_2_0 +#if not MBGL_USE_GLES2 MBGL_CHECK_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0)); -#endif +#endif // MBGL_USE_GLES2 // We are using clamp to edge here since OpenGL ES doesn't allow GL_REPEAT on NPOT textures. // We use those when the pixelRatio isn't a power of two, e.g. on iPhone 6 Plus. MBGL_CHECK_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)); @@ -379,10 +379,10 @@ void SpriteAtlas::bind(bool linear, gl::Context& context, uint32_t unit) { dirtyFlag = false; -#ifndef GL_ES_VERSION_2_0 +#if not MBGL_USE_GLES2 // platform::showColorDebugImage("Sprite Atlas", reinterpret_cast<const char*>(data.get()), // pixelWidth, pixelHeight, pixelWidth, pixelHeight); -#endif +#endif // MBGL_USE_GLES2 } } diff --git a/src/mbgl/sprite/sprite_atlas.hpp b/src/mbgl/sprite/sprite_atlas.hpp index b4ee5ae48c..3a0aea2dad 100644 --- a/src/mbgl/sprite/sprite_atlas.hpp +++ b/src/mbgl/sprite/sprite_atlas.hpp @@ -1,7 +1,6 @@ #pragma once #include <mbgl/geometry/binpack.hpp> -#include <mbgl/gl/gl.hpp> #include <mbgl/gl/object.hpp> #include <mbgl/util/noncopyable.hpp> #include <mbgl/util/optional.hpp> @@ -83,14 +82,14 @@ public: SpritePatternMode mode = SpritePatternMode::Single); // Binds the atlas texture to the GPU, and uploads data if it is out of date. - void bind(bool linear, gl::Context&, uint32_t unit); + void bind(bool linear, gl::Context&, gl::TextureUnit unit); // Updates sprites in the atlas texture that may have changed. void updateDirty(); // Uploads the texture to the GPU to be available when we need it. This is a lazy operation; // the texture is only bound when the data is out of date (=dirty). - void upload(gl::Context&, uint32_t unit); + void upload(gl::Context&, gl::TextureUnit unit); dimension getWidth() const { return width; } dimension getHeight() const { return height; } @@ -105,7 +104,7 @@ private: void _setSprite(const std::string&, const std::shared_ptr<const SpriteImage>& = nullptr); void emitSpriteLoadedIfComplete(); - const GLsizei width, height; + const uint16_t width, height; const dimension pixelWidth, pixelHeight; const float pixelRatio; |