mirror of https://github.com/axmolengine/axmol.git
bugfix: TextureCube will be crashed on release environment
This commit is contained in:
parent
93437f92d0
commit
3835675cab
|
@ -26,6 +26,8 @@
|
||||||
#include "platform/CCImage.h"
|
#include "platform/CCImage.h"
|
||||||
#include "platform/CCFileUtils.h"
|
#include "platform/CCFileUtils.h"
|
||||||
|
|
||||||
|
#include "renderer/ccGLStateCache.h"
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
|
||||||
unsigned char* getImageData(Image* img, Texture2D::PixelFormat& ePixFmt)
|
unsigned char* getImageData(Image* img, Texture2D::PixelFormat& ePixFmt)
|
||||||
|
@ -189,7 +191,8 @@ bool TextureCube::init(const std::string& positive_x, const std::string& negativ
|
||||||
|
|
||||||
GLuint handle;
|
GLuint handle;
|
||||||
glGenTextures(1, &handle);
|
glGenTextures(1, &handle);
|
||||||
glBindTexture(GL_TEXTURE_CUBE_MAP, handle);
|
|
||||||
|
GL::bindTextureN(0, handle, GL_TEXTURE_CUBE_MAP);
|
||||||
|
|
||||||
for (int i = 0; i < 6; i++)
|
for (int i = 0; i < 6; i++)
|
||||||
{
|
{
|
||||||
|
@ -231,7 +234,7 @@ bool TextureCube::init(const std::string& positive_x, const std::string& negativ
|
||||||
|
|
||||||
_name = handle;
|
_name = handle;
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_CUBE_MAP, 0);
|
GL::bindTextureN(0, 0, GL_TEXTURE_CUBE_MAP);
|
||||||
|
|
||||||
for (auto img: images)
|
for (auto img: images)
|
||||||
{
|
{
|
||||||
|
@ -245,14 +248,14 @@ void TextureCube::setTexParameters(const TexParams& texParams)
|
||||||
{
|
{
|
||||||
CCASSERT(_name != 0, __FUNCTION__);
|
CCASSERT(_name != 0, __FUNCTION__);
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_CUBE_MAP, _name);
|
GL::bindTextureN(0, _name, GL_TEXTURE_CUBE_MAP);
|
||||||
|
|
||||||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, texParams.wrapS);
|
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, texParams.minFilter);
|
||||||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, texParams.wrapS);
|
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, texParams.magFilter);
|
||||||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, texParams.wrapS);
|
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, texParams.wrapS);
|
||||||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, texParams.wrapT);
|
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, texParams.wrapT);
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_CUBE_MAP, 0);
|
GL::bindTextureN(0, 0, GL_TEXTURE_CUBE_MAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TextureCube::reloadTexture()
|
bool TextureCube::reloadTexture()
|
||||||
|
|
Loading…
Reference in New Issue