Sub Texture
Hey everyone.
I was just wondering if you can use an existing texture and use its sub region for texture mapping instead of the entire one without any copying or creation of new textures.
Is this possible?
Thanks
...
yes, by using texture coordinates to select only the section of texture you want...
yes, by using texture coordinates to select only the section of texture you want...
Yeah, but what if I have a 512x512 texture and a quad with (0, 0) -> (1, 1) texture coordinates and I want to use only half of the texture: (0, 0) -> (256, 256)?
No, I want to keep the texture coordinates static.
I want to actually take a piece of the texture and use it asif it was an entire one without adjusting any texture coordinates.
I want to actually take a piece of the texture and use it asif it was an entire one without adjusting any texture coordinates.
A solution should be to create another smaller texture and to copy the portion of the large one in the small one. But IMHO this is not very good. The right choice is to map the large original texture with the texture coordinates as said before.
Kind regards
Kind regards
If you absolutely have to keep the coordinates untouched, you can transform them so they are within the desired range.
Now the range [0, 1] is scaled to [0, 0.5].
glMatrixMode(GL_TEXTURE);glLoadIdentity();glScalef(0.5, 0.5, 1);
Now the range [0, 1] is scaled to [0, 0.5].
The thing is I am workig with Vertex Textures and I want to use a sub area of a texture untill I have to replace it with another texture. Think of it as a Radar in a RTS game. When that white box (your view port) moves to the side and reaches the edge, a new background is copied to the radar and the white box moves accordingly. Get what I'm saying? I am using it for a heightmap. Its for my year project.
If it were possible to do, would there be any speed increases since no new textures have to be created so many times?
Or how about the vertex shader?
I hope I am making sence. Sorry I'm typing in a rush.
If it were possible to do, would there be any speed increases since no new textures have to be created so many times?
Or how about the vertex shader?
I hope I am making sence. Sorry I'm typing in a rush.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement