John
John

Reputation:

Using glTexSubimage2d with a dynamically sized texture array

Have anyone tried this (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.

Upvotes: 1

Views: 1410

Answers (2)

Rik Heywood
Rik Heywood

Reputation: 13972

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.

Upvotes: 0

Bahbar
Bahbar

Reputation: 18005

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.

Upvotes: 2

Related Questions