From af7bdaa10ee71a319dc55c3c7556fa43a95c9dc9 Mon Sep 17 00:00:00 2001 From: chai Date: Tue, 2 Apr 2019 21:45:33 +0800 Subject: *misc --- source/modules/asura-core/graphics/texture.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'source/modules/asura-core/graphics/texture.cpp') diff --git a/source/modules/asura-core/graphics/texture.cpp b/source/modules/asura-core/graphics/texture.cpp index 4db6ad3..38a75d7 100644 --- a/source/modules/asura-core/graphics/texture.cpp +++ b/source/modules/asura-core/graphics/texture.cpp @@ -1,3 +1,5 @@ +#include + #include "Texture.h" namespace AsuraEngine @@ -8,13 +10,17 @@ namespace AsuraEngine Texture::Texture() : mTex(0) { - // 申请GL texture - glGenTextures(1, &mTex); + // Fix: 等需要的时候再申请纹理资源 + //glGenTextures(1, &mTex); + //if(mTex == 0) + // throw Exception("Cannot create texture."); } Texture::~Texture() { - glDeleteTextures(1, &mTex); + // 释放纹理资源 + if(mTex != 0) + glDeleteTextures(1, &mTex); } GLuint Texture::GetGLTextureHandle() const @@ -37,6 +43,8 @@ namespace AsuraEngine t.externalformat = GL_RGBA; t.type = GL_FLOAT; break; + default: + ASSERT(false); // cant reach here } return t; } -- cgit v1.1-26-g67d0