Jump to content
  • Advertisement
Sign in to follow this  
Last Attacker

Sub Texture

This topic is 4321 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
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)?

Share this post


Link to post
Share on other sites
then you will have to adjust the texture coordinates of the quad to (0,0)->(0.5,0.5)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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

Share this post


Link to post
Share on other sites
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].

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:

I hope I am making sence.

doubt it .

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!