From: Mikko Rasa Date: Sat, 23 Jan 2016 02:56:04 +0000 (+0200) Subject: Use UNSIGNED_SHORT for allocating DEPTH_COMPONENT textures X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=f35535633aab06e80f0666d8551431364654c6dc;p=libs%2Fgl.git Use UNSIGNED_SHORT for allocating DEPTH_COMPONENT textures OpenGL ES doesn't accept DEPTH_COMPONENT together with BYTE types. --- diff --git a/source/texture.cpp b/source/texture.cpp index 6484440e..8d43143c 100644 --- a/source/texture.cpp +++ b/source/texture.cpp @@ -75,6 +75,11 @@ Texture::~Texture() glDeleteTextures(1, &id); } +DataType Texture::get_alloc_type(PixelFormat fmt) +{ + return (fmt==DEPTH_COMPONENT ? UNSIGNED_SHORT : UNSIGNED_BYTE); +} + void Texture::update_parameter(int mask) const { if(TexUnit::current().get_texture()!=this) diff --git a/source/texture.h b/source/texture.h index db6165fe..4cd5481e 100644 --- a/source/texture.h +++ b/source/texture.h @@ -2,7 +2,9 @@ #define MSP_GL_TEXTURE_H_ #include +#include "datatype.h" #include "gl.h" +#include "pixelformat.h" #include "predicate.h" #include "resource.h" @@ -122,6 +124,8 @@ public: ~Texture(); protected: + static DataType get_alloc_type(PixelFormat); + void update_parameter(int) const; public: void set_min_filter(TextureFilter); diff --git a/source/texture1d.cpp b/source/texture1d.cpp index accd0e0c..046fca6f 100644 --- a/source/texture1d.cpp +++ b/source/texture1d.cpp @@ -34,7 +34,8 @@ void Texture1D::allocate(unsigned level) if(allocated&(1< #include -#include "datatype.h" -#include "pixelformat.h" #include "resource.h" #include "texture.h" diff --git a/source/texture3d.cpp b/source/texture3d.cpp index 7b9c3590..d5badc72 100644 --- a/source/texture3d.cpp +++ b/source/texture3d.cpp @@ -41,7 +41,8 @@ void Texture3D::allocate(unsigned level) if(allocated&(1< -#include "datatype.h" -#include "pixelformat.h" #include "texture.h" namespace Msp { diff --git a/source/texturecube.cpp b/source/texturecube.cpp index 37390a85..24d02f40 100644 --- a/source/texturecube.cpp +++ b/source/texturecube.cpp @@ -47,8 +47,10 @@ void TextureCube::allocate(unsigned level) if(allocated&(1< -#include "datatype.h" -#include "pixelformat.h" #include "texture.h" #include "vector.h" #include