Sub Texture

Started by
16 comments, last by Last Attacker 17 years, 6 months ago
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
"Take delight in the Lord and He will give you your heart's desires" - Psalm 37:4My Blog
Advertisement
...

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)?
"Take delight in the Lord and He will give you your heart's desires" - Psalm 37:4My Blog
then you will have to adjust the texture coordinates of the quad to (0,0)->(0.5,0.5)
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.
"Take delight in the Lord and He will give you your heart's desires" - Psalm 37:4My Blog
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
Oooops It was me not logged in.
If you absolutely have to keep the coordinates untouched, you can transform them so they are within the desired range.
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.
"Take delight in the Lord and He will give you your heart's desires" - Psalm 37:4My Blog
Quote:
I hope I am making sence.

doubt it .

This topic is closed to new replies.

Advertisement