This commit is contained in:
Sam Gateau 2015-01-23 17:13:26 -08:00
parent 0d3f9c740d
commit c05d627cc1
2 changed files with 9 additions and 6 deletions

View file

@ -25,6 +25,8 @@
#include "TextureCache.h" #include "TextureCache.h"
#include "gpu/GLBackend.h"
TextureCache::TextureCache() : TextureCache::TextureCache() :
_permutationNormalTexture(0), _permutationNormalTexture(0),
_whiteTexture(0), _whiteTexture(0),
@ -366,11 +368,13 @@ QOpenGLFramebufferObject* TextureCache::createFramebufferObject() {
} }
Texture::Texture() { Texture::Texture() {
glGenTextures(1, &_id);
} }
Texture::~Texture() { Texture::~Texture() {
glDeleteTextures(1, &_id); }
GLuint Texture::getID() const {
return gpu::GLBackend::getTextureID(_gpuTexture);
} }
NetworkTexture::NetworkTexture(const QUrl& url, TextureType type, const QByteArray& content) : NetworkTexture::NetworkTexture(const QUrl& url, TextureType type, const QByteArray& content) :
@ -385,7 +389,7 @@ NetworkTexture::NetworkTexture(const QUrl& url, TextureType type, const QByteArr
} }
// default to white/blue/black // default to white/blue/black
glBindTexture(GL_TEXTURE_2D, getID()); /* glBindTexture(GL_TEXTURE_2D, getID());
switch (type) { switch (type) {
case NORMAL_TEXTURE: case NORMAL_TEXTURE:
loadSingleColorTexture(OPAQUE_BLUE); loadSingleColorTexture(OPAQUE_BLUE);
@ -404,7 +408,7 @@ NetworkTexture::NetworkTexture(const QUrl& url, TextureType type, const QByteArr
break; break;
} }
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
*/
// if we have content, load it after we have our self pointer // if we have content, load it after we have our self pointer
if (!content.isEmpty()) { if (!content.isEmpty()) {
_startedLoading = true; _startedLoading = true;

View file

@ -130,7 +130,7 @@ public:
Texture(); Texture();
~Texture(); ~Texture();
GLuint getID() const { return _id; } GLuint getID() const;
const gpu::TexturePointer& getGPUTexture() const { return _gpuTexture; } const gpu::TexturePointer& getGPUTexture() const { return _gpuTexture; }
@ -138,7 +138,6 @@ protected:
gpu::TexturePointer _gpuTexture; gpu::TexturePointer _gpuTexture;
private: private:
GLuint _id;
}; };
/// A texture loaded from the network. /// A texture loaded from the network.