Flickering scrollers in Torque 2D
by Quentin Headen · in General Discussion · 10/15/2010 (11:19 pm) · 3 replies
Hello everyone! I have Torque 2D 2009 and sometimes when I reload the project or I start the game up, the scrollers in the scene turn a solid color (basically the general color of the texture) and it flickers. To fix it, I have to delete the scrollers and create them all over again. Has anyone had this issue?
Thanks
Thanks
About the author
Just your average programmer who tries to finish the projects he starts. :) I am currently focused on creating games with Torque engines. My website is http://phaseshiftsoftware.com
#2
I have looked at this thread and it has helped me a little bit (www.torquepowered.com/community/forums/viewthread/114831), but I am still having trouble. Any ideas?
10/20/2010 (8:28 am)
After further investigation, I've nailed it down to being a problem with the new source rect feature of the scrollers. For some reason, when you save your level file and close TGB, it sets weird values as the source rectangle values. As a result, when you start the game or editor back up, the texture looks super zoomed in.I have looked at this thread and it has helped me a little bit (www.torquepowered.com/community/forums/viewthread/114831), but I am still having trouble. Any ideas?
#3
This is when you first create the scrollers:

But after you save the level, reopen the editor, change anything in the scene and save the level, the next time you play the game or open the editor, you get this:

As you can see, the texture looks really zoomed in. This is because the level editor seems to save a crazy source rectangle value for the scrollers to the level file. In this case, it actually save the source rectangle value as "1.4013e-045 0 1.4013e-045 8.40779e-045"; even though in the editor, the value is supposed to be "0 0 0 0".
In my game project, using source rectangles on the scrollers wasn't needed, so I just simply disabled it with one line of code. To disable it, go into the source and open up the t2dScroller.cc code file. Once you are there, go to the function called void t2dScroller::setSourceTextureCoords(void).
Now right above the first line that says:
put this:
Recompile and the problem will go away. Of course, this is just a cover up, not a true fix. I really can't see how to fix this code. If anyone has a fix for this (including myself), please post it because this is a very serious problem.
10/20/2010 (1:30 pm)
Well, I couldn't figure out how to fix the issue, so I just simply disabled the source rectangle functionality on scrollers altogether. Here is an example of what was happening:This is when you first create the scrollers:

But after you save the level, reopen the editor, change anything in the scene and save the level, the next time you play the game or open the editor, you get this:

As you can see, the texture looks really zoomed in. This is because the level editor seems to save a crazy source rectangle value for the scrollers to the level file. In this case, it actually save the source rectangle value as "1.4013e-045 0 1.4013e-045 8.40779e-045"; even though in the editor, the value is supposed to be "0 0 0 0".
In my game project, using source rectangles on the scrollers wasn't needed, so I just simply disabled it with one line of code. To disable it, go into the source and open up the t2dScroller.cc code file. Once you are there, go to the function called void t2dScroller::setSourceTextureCoords(void).
Now right above the first line that says:
if(mUseSourceRect)
put this:
//FIX - Disable use of problematic source rectangles this->setUseSourceRect(false);
Recompile and the problem will go away. Of course, this is just a cover up, not a true fix. I really can't see how to fix this code. If anyone has a fix for this (including myself), please post it because this is a very serious problem.
Torque 3D Owner Quentin Headen
Thread Link: www.torquepowered.com/community/forums/viewthread/116991