Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Scrolling a texture across an object

Author
Message
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 7th Jun 2009 06:48
Hi! I have about 20 objects layed out in a massive square and applied a texture to each one. Then i have this code in the main loop:

But when I do this it makes an earthquake effect in the sense that the texture moves across the object then it moves back to the original position, and even if newV goes above 128 the effect still continues. So how can i fix this to do what i want (texture smoothly scrolling across the object) or what's another method of doing this? Thanks!

JustinKR6
15
Years of Service
User Offline
Joined: 3rd Jun 2009
Location:
Posted: 7th Jun 2009 09:37
I would maybe try blending your texture and making the bottom most viewable portion of your texture identical to the top most portion, that way itll be less noticeable when it loops through. And you may need to stop the scrolling texture early before reaching the end of the texture height to make sure your viewable area doesnt go beyond the edge of the texture. Just suggestions on what I might try.
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 7th Jun 2009 14:44
There are 2 things here that I think you need to get a handle on:

1 - Scrolling of textures is cumulative.

When you set the scroll to 0.1, and scroll again with 0.1, you have scrolled to 0.2. If you want to reset the texture from that point, you need to scroll by -0.2.

2 - Texture coordinates are much smaller than you are using.

Usually, texture coordinates range from 0.0 to 1.0. When you create a plane, no matter how big you make it, and no matter how big or small the texture that you use on it, the texture coordinates range from 0.0 to 1.0

So, reduce your numbers used in the scrolling, and don't change them to keep moving the texture:


heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 7th Jun 2009 23:08
Ok, thanks for the replies! It works with IanM's code, thanks again!

Login to post a reply

Server time is: 2024-11-25 10:38:16
Your offset time is: 2024-11-25 10:38:16