Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Zern

Texture wrapping...

This topic is 5632 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

Hello, Has anyone came up with a solution (or perhaps there is one, however I don''t know it) where you have a texture (bitmap, .jpeg, whatever) and in this texture you have offsets for a smaller image, and based on these offsets you need to texture a quad with the offsets for this smaller image. Say for example, you have a 20x20 image in a 256x256 texture at XOffSet: 15 texels in, and YOffSet: 15 texels down ... and you want to wrap that 20x20 image three times in the x and y direction of a quad, however you can''t specify the right side have a texture coord (tu) of 3.0 and the bottom to have a textur coord (tv) of 3.0 due to the fact that the image you want is a small offset inside this 256x256 texture and thus causing this issue where you can''t wrap (or what I believe) that easy. Any solutions? thoughts? Any input is welcomed, even if it is not the answer, hopefully can point me in the right direction as I am lost. Thanks in advance, ~

Share this post


Link to post
Share on other sites
Advertisement
Perhaps my plea for help is a bit unclear so I''ll do some text art to show what I mean



  
*main texture (256x256) with offset inside*
_____________
| |
| ____ |
| | | |
| |____| |
| |
| |
|_____________|



What I need to do is take that smaller image inside the main texture and wrap it on a quad. How this is possible I am not sure as normally any texture coords greater than (or even)1.0 state that the texture pos is the rightmost or bottom-most of the main texture and all I want is the smaller texture :/ hopefully someone understands and can help !_!


Thanks again.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Wahh anyone? lol :*(

Share this post


Link to post
Share on other sites
if you're trying to do what I think you are, you have to use texture coords less than 1.


Click here for picture

in this example, for your upper left hand corner of the quad you would map the texture onto, the coordinates would be (50/255, 40/255), or (0.1961, 0.1568). The next corner would be (128/255, 40/255), or (0.5, 0.1568).

Just divide the pixel coordinate by the size of the image to get your texture coordinate.

'There's something out there....something stupid...'
'I think I'm going to be ill. Is that a problem for you?'
'[You] overestimate my conscience by assuming that I have one.'
- Daria

[edited by - masonium on April 20, 2003 9:22:14 PM]

[edited by - masonium on April 20, 2003 9:23:33 PM]

Share this post


Link to post
Share on other sites
Well I suppose if you have fillrate to burn, you could create an offscreen render target, draw a fullscreen textured quad using your "subtexture", then use the offscreen target as a texture that you could tile across a quad.

Share this post


Link to post
Share on other sites
Masonium: I know how to extract the offset image in the bigger one - the problem is getting this smaller offset to repeat Tx and Ty amount of times in the x and y directions - hence I can''t use TU = 2.0 to get the offset to repeat twice as it will repeat the current texture twice which is not what I want ....


Don: I think that''s what I''m going to need to do ... hopefully I can find another solution

Share this post


Link to post
Share on other sites
If you have hardware that can do dependent texture reads then you could use one complete texture to map the s,t to just a portion of a second texture.

Share this post


Link to post
Share on other sites
Yes that is a possbility but I''m looking for a solution that works on the majority of cards (older(GeForce2+) and newer), thanks though! :D


~

Share this post


Link to post
Share on other sites

  • 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!