tags:

views:

368

answers:

2

Have anyone tried this (stackoverflow.com/questions/679210/how-can-i-use-a-dynamically-sized-texture-array-with-glteximage2d) with glTexSubImage2D instead? I really need it and I can't put it to work properly, all I get is a striped, funny coloured square on my original texture.

Thanks in advance.

+1  A: 

What do you mean, you need it ?

glTexSubImage2D redefines a contiguous subregion of an existing two-dimensional texture image.

What that means is that you need to specify the size of your texture with glTexImage2D. That is what that API is for. glTexSubImage2D is only there to update (parts of) the contents of an already defined Texture.

Bahbar
A: 

glTexSubImage2D does not resize your texture.

All it does is update a rectangle of your existing texture with new texels/pixels.

If you need to change the size of your texture you will need to create a new texture of the correct size and discard the old one.

rikh