Map UBO to change its value.
This commit is contained in:
parent
5f6d0bd63c
commit
8b81d0ac3f
@ -584,7 +584,8 @@ void IrrDriver::computeCameraMatrix(scene::ICameraSceneNode * const camnode, siz
|
||||
50.,
|
||||
};
|
||||
|
||||
float *tmp = new float[18 * 8];
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, SharedObject::ViewProjectionMatrixesUBO);
|
||||
float *tmp = (float *) glMapBufferRange(GL_UNIFORM_BUFFER, 0, (16 * 8 + 2) * sizeof(float), GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
|
||||
|
||||
memcpy(tmp, irr_driver->getViewMatrix().pointer(), 16 * sizeof(float));
|
||||
memcpy(&tmp[16], irr_driver->getProjMatrix().pointer(), 16 * sizeof(float));
|
||||
@ -710,10 +711,7 @@ void IrrDriver::computeCameraMatrix(scene::ICameraSceneNode * const camnode, siz
|
||||
|
||||
tmp[128] = float(width);
|
||||
tmp[129] = float(height);
|
||||
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, SharedObject::ViewProjectionMatrixesUBO);
|
||||
glBufferSubData(GL_UNIFORM_BUFFER, 0, (16 * 8 + 2) * sizeof(float), tmp);
|
||||
delete []tmp;
|
||||
glUnmapBuffer(GL_UNIFORM_BUFFER);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user