When to use Texture Views

I read about Texture views in the new Red Book. On page 322 it says:

OpenGL allows you to share one data warehouse between several textures, each with its own format and size.

(via texture views)

Now my questions are:

Does this mean that a single texture source refers to multiple instances (in this case, a texture view)?

How does this differ from using the same texture object, for example, but with different samplers?

Also, does this mean that changing the pixels of a texture through a texture preview will change the pixels in the original texture? (I believe the answer is yes, as doc says it is an alias for texture storage)

+6
source share
1 answer

Yes, sharing a data warehouse means accessing the same storage from different objects. Just like sharing a pointer means being able to access the same memory from two different locations.

This differs from using sampler objects in that there is no similarity between them. Sampler objects save the selection parameters. Texture objects have parameters that are not relevant to the selection , for example, the mipmap range , swizzle mask, and the like. This is not a sampler state; this is a state of texture.

Texture objects also have a specific texture type . Different types of the same store can have different types of textures (within) . You can have GL_TEXTURE_2D , which is a representation of a single texture layer GL_TEXTURE_2D_ARRAY . You can take GL_TEXTURE_2D_ARRAY from 6 or more layers and create GL_TEXTURE_CUBE_MAP from it.

Sampler objects cannot do this.

Texture objects have an internal format that defines how the repository should be interpreted. Different types of the same storage can have different formats (within). Samplers do not affect the format.

Sampler objects cannot do this either.

Can you use texture representations to achieve the same effect as sampler objects? No. With samplers, you separate sample parameters from texture objects. This allows you to use the same set of parameters for several different objects. And so you can change one sampler object and use it with multiple textures without going to each texture or changing it.

These are two different functions for two different purposes.

+6
source

Source: https://habr.com/ru/post/947486/


All Articles