fosphor/gl: Use glTexSubImage2D for texture update

Much faster than glTexImage2D since it only updates the data
and doesn't delete/create a new storage space for the data.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
This commit is contained in:
Sylvain Munaut 2015-01-19 00:52:42 +01:00
parent 1169b7efec
commit 64cf8a305b
1 changed files with 3 additions and 4 deletions

View File

@ -90,10 +90,9 @@ gl_tex2d_write(GLuint tex_id, float *src, int width, int height)
{
glBindTexture(GL_TEXTURE_2D, tex_id);
glTexImage2D(
GL_TEXTURE_2D,
0, GL_R32F,
width, height, 0,
glTexSubImage2D(
GL_TEXTURE_2D, 0,
0, 0, width, height,
GL_RED, GL_FLOAT,
src
);