mirror of https://github.com/axmolengine/axmol.git
Adds GL::activeTexture()
`GL::activeTexture()` is the cached version of `glActiveTexture` All code must use it.
This commit is contained in:
parent
a724fd9f6a
commit
ce633b44ab
12
CHANGELOG
12
CHANGELOG
|
@ -1,13 +1,15 @@
|
|||
cocos2d-x-3.0final ?.? ?
|
||||
[All]
|
||||
[NEW] DrawNode supports to draw triangle, quad bezier, cubic bezier.
|
||||
[NEW] Console: added the 'textures', 'fileutils dump' and 'config' commands
|
||||
[NEW] GLCache: glActiveTexture() is cached with GL::activeTexture(). All code MUST call the cached version in order to work correctly
|
||||
[NEW] Label: Uses a struct of TTF configuration for Label::createWithTTF to reduce parameters and make this interface more easily to use.
|
||||
[NEW] Renderer: Added BatchCommand. This command is not "batchable" with other commands, but improves performance in about 10%
|
||||
|
||||
[FIX] CocoStudio: TestColliderDetector in ArmatureTest can't work.
|
||||
[FIX] Crash if file doesn't exist when using FileUtils::getStringFromFile.
|
||||
[FIX] If setting a shorter string than before while using LabelAtlas, the effect will be wrong.
|
||||
[NEW] Label: Uses a struct of TTF configuration for Label::createWithTTF to reduce parameters and make this interface more easily to use.
|
||||
[FIX] Label: Crash when using unknown characters.
|
||||
[NEW] Console: added the 'textures', 'fileutils dump' and 'config' commands
|
||||
[NEW] DrawNode supports to draw triangle, quad bezier, cubic bezier.
|
||||
[NEW] Renderer: Added BatchCommand. This command is not "batchable" with other commands, but improves performance in about 10%
|
||||
[FIX] Console: log(format, va_args) is private to prevent possible resolution errors
|
||||
[FIX] Configuration: dumpInfo() -> getInfo()
|
||||
[FIX] ControlSlider doesn't support to set selected thumb sprite.
|
||||
|
@ -17,7 +19,7 @@ cocos2d-x-3.0final ?.? ?
|
|||
[FIX] Renderer: Performance improved in Sprite and SpriteBatchNode (and subclasses) sprites in about 20%
|
||||
[FIX] Sprite: removed _hasChildren optimization. It uses !_children.empty() now which is super fast as well
|
||||
[FIX] Tests: TestCpp works with CMake on Windows.
|
||||
[FIX] Tests: Sprites Performance Test has 3 new tests
|
||||
[FIX] Tests: Sprites Performance Test has 4 new tests
|
||||
[FIX] TextureCache: getTextureForKey and removeTextureForKey work as expected
|
||||
[FIX] TextureCache: dumpCachedTextureInfo() -> getCachedTextureInfo()
|
||||
[FIX] Websocket doesn't support send/receive data which larger than 4096 bytes.
|
||||
|
|
|
@ -44,7 +44,6 @@ namespace
|
|||
static bool s_vertexAttribColor = false;
|
||||
static bool s_vertexAttribTexCoords = false;
|
||||
|
||||
|
||||
#if CC_ENABLE_GL_STATE_CACHE
|
||||
|
||||
#define kMaxActiveTexture 16
|
||||
|
@ -55,6 +54,8 @@ namespace
|
|||
static GLenum s_blendingDest = -1;
|
||||
static int s_GLServerState = 0;
|
||||
static GLuint s_VAO = 0;
|
||||
static GLenum s_activeTexture = -1;
|
||||
|
||||
#endif // CC_ENABLE_GL_STATE_CACHE
|
||||
}
|
||||
|
||||
|
@ -159,7 +160,7 @@ void bindTexture2DN(GLuint textureUnit, GLuint textureId)
|
|||
if (s_currentBoundTexture[textureUnit] != textureId)
|
||||
{
|
||||
s_currentBoundTexture[textureUnit] = textureId;
|
||||
glActiveTexture(GL_TEXTURE0 + textureUnit);
|
||||
activeTexture(GL_TEXTURE0 + textureUnit);
|
||||
glBindTexture(GL_TEXTURE_2D, textureId);
|
||||
}
|
||||
#else
|
||||
|
@ -186,6 +187,18 @@ void deleteTextureN(GLuint textureUnit, GLuint textureId)
|
|||
glDeleteTextures(1, &textureId);
|
||||
}
|
||||
|
||||
void activeTexture(GLenum texture)
|
||||
{
|
||||
#if CC_ENABLE_GL_STATE_CACHE
|
||||
if(s_activeTexture != texture) {
|
||||
s_activeTexture = texture;
|
||||
glActiveTexture(s_activeTexture);
|
||||
}
|
||||
#else
|
||||
glActiveTexture(texture);
|
||||
#endif
|
||||
}
|
||||
|
||||
void bindVAO(GLuint vaoId)
|
||||
{
|
||||
if (Configuration::getInstance()->supportsShareableVAO())
|
||||
|
|
|
@ -129,6 +129,12 @@ void CC_DLL deleteTexture(GLuint textureId);
|
|||
*/
|
||||
void CC_DLL deleteTextureN(GLuint textureUnit, GLuint textureId);
|
||||
|
||||
/** Select active texture unit.
|
||||
If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glActiveTexture() directly.
|
||||
@since v3.0
|
||||
*/
|
||||
void CC_DLL activeTexture(GLenum texture);
|
||||
|
||||
/** If the vertex array is not already bound, it binds it.
|
||||
If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glBindVertexArray() directly.
|
||||
@since v2.0.0
|
||||
|
|
Loading…
Reference in New Issue