mirror of https://github.com/axmolengine/axmol.git
Director supports setting clear color
This commit is contained in:
parent
ca932a38e4
commit
b925689435
|
@ -157,6 +157,12 @@ bool Director::init(void)
|
|||
_renderer = new (std::nothrow) Renderer;
|
||||
|
||||
_console = new (std::nothrow) Console;
|
||||
|
||||
// default clear color
|
||||
_clearColor.r = 0;
|
||||
_clearColor.g = 0;
|
||||
_clearColor.b = 0;
|
||||
_clearColor.a = 1.0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -242,7 +248,7 @@ void Director::setGLDefaultValues()
|
|||
setProjection(_projection);
|
||||
|
||||
// set other opengl default values
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
glClearColor(_clearColor.r, _clearColor.g, _clearColor.b, _clearColor.a);
|
||||
}
|
||||
|
||||
// Draw the Scene
|
||||
|
@ -705,6 +711,12 @@ void Director::setDepthTest(bool on)
|
|||
CHECK_GL_ERROR_DEBUG();
|
||||
}
|
||||
|
||||
void Director::setClearColor(const Color4F& clearColor)
|
||||
{
|
||||
_clearColor = clearColor;
|
||||
glClearColor(clearColor.r, clearColor.g, clearColor.b, clearColor.a);
|
||||
}
|
||||
|
||||
static void GLToClipTransform(Mat4 *transformOut)
|
||||
{
|
||||
if(nullptr == transformOut) return;
|
||||
|
|
|
@ -322,6 +322,9 @@ public:
|
|||
|
||||
/** enables/disables OpenGL alpha blending */
|
||||
void setAlphaBlending(bool on);
|
||||
|
||||
/** set clear values for the color buffers, value range of each element is [0.0, 1.0] */
|
||||
void setClearColor(const Color4F& clearColor);
|
||||
|
||||
/** enables/disables OpenGL depth test */
|
||||
void setDepthTest(bool on);
|
||||
|
@ -463,6 +466,9 @@ protected:
|
|||
unsigned int _totalFrames;
|
||||
float _secondsPerFrame;
|
||||
|
||||
/* clear color set outside be used in setGLDefaultValues() */
|
||||
Color4F _clearColor;
|
||||
|
||||
/* The running scene */
|
||||
Scene *_runningScene;
|
||||
|
||||
|
|
Loading…
Reference in New Issue