emulator opengl: initialize new colorbuffers
Initialize new allocated color buffers with zeros. Change-Id: I64a63c2eda83fdec1926c387e171324fb07ebe83
This commit is contained in:
committed by
Guy Zadickario
parent
88ad268dd9
commit
4ef1f3474e
@@ -56,10 +56,16 @@ ColorBuffer *ColorBuffer::create(int p_width, int p_height,
|
||||
|
||||
s_gl.glGenTextures(1, &cb->m_tex);
|
||||
s_gl.glBindTexture(GL_TEXTURE_2D, cb->m_tex);
|
||||
int nComp = (texInternalFormat == GL_RGB ? 3 : 4);
|
||||
char *zBuff = new char[nComp*p_width*p_height];
|
||||
if (zBuff) {
|
||||
memset(zBuff, 0, nComp*p_width*p_height);
|
||||
}
|
||||
s_gl.glTexImage2D(GL_TEXTURE_2D, 0, texInternalFormat,
|
||||
p_width, p_height, 0,
|
||||
texInternalFormat,
|
||||
GL_UNSIGNED_BYTE, NULL);
|
||||
GL_UNSIGNED_BYTE, zBuff);
|
||||
delete [] zBuff;
|
||||
s_gl.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
s_gl.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
s_gl.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
|
||||
Reference in New Issue
Block a user