update vertex buffer to update color (#18283)

This commit is contained in:
minggo 2017-09-19 09:41:10 +08:00 committed by GitHub
parent 186e05f7c5
commit bb21a206a9
1 changed files with 7 additions and 0 deletions

View File

@ -282,6 +282,13 @@ bool CameraBackgroundColorBrush::init()
void CameraBackgroundColorBrush::setColor(const Color4F& color)
{
_quad.bl.colors = _quad.br.colors = _quad.tl.colors = _quad.tr.colors = Color4B(color);
if (_vertexBuffer)
{
glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer);
glBufferData(GL_ARRAY_BUFFER, sizeof(_quad), &_quad, GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
}
CameraBackgroundColorBrush* CameraBackgroundColorBrush::create(const Color4F& color, float depth)