Game Development Community

image size issues (resolved*[ref for engine debugging])

by rennie moffat · in iTorque 2D · 06/01/2011 (8:58 am) · 44 replies

Hi there,
I have been waiting for the right time to express a certain concern I have regarding image size restraints. I Had been working on my iPod 4G until this morning when I dropped it and broke the screen. No problem, I switched to an older 2G. However, when on the 4G, while it ran, I was getting memory warnings I was concerned were related to imageSize preferably 1024x1024. Now, on my 2G, images that are 1024x1024 are deemed too big "ImageMap(xImageMap)SrcBitmap(game/data/images/x.png) Error: 'Filter-Padded Frame Width Too Big; Unsupported by current hardware!' (5)"


What happens is, they simply do not show up.


So I am wondering, what is the remedy?


About the author

My thanks to Garage Games and the Garage Games Community combined with owned determination I got one game up, Temple Racer and I am looking to build more interesting, fun games for the mass market of the iOS app store.

Page «Previous 1 2 3 Last »
#1
06/01/2011 (9:39 am)
Time for you to step up your debugging skills rennie. First step, find the error message "Filter-padded frame width too big" in the source code. Let me know when you locate it, then we will move on to the next step.
#2
06/01/2011 (9:55 am)
Ok no worries but where in source code would I find something like that? to me, it seems like a report, only spat out by the console.



::)(?
#3
06/01/2011 (9:59 am)
If you are in Xcode, use the search box. If you are in Visual Studio, use ctrl+shift+f. In either, copy and paste what I put in quotes. YOU have to find it.
#4
06/01/2011 (10:19 am)
ok, so I have found the message twice in "text only" in the t2dImageMapDatablock.cc

in the function(?)
static EnumTable::Enums imageMapErrorLookup[] =
{ t2dImageMapDatablock::T2D_IMAGEMAP_ERROR_FRAME_TOO_WIDE_HARDWARE,     "Frame Width Too Big; Unsupported by current hardware!" },

       { t2dImageMapDatablock::T2D_IMAGEMAP_ERROR_FRAME_TOO_WIDE_SOFTWARE,     "Frame Width Too Big; Larger than selected limit!" },

Not sure what to do from here.
#5
06/01/2011 (10:28 am)
Alright. So you found the error message. The variable it is associated with is T2D_IMAGEMAP_ERROR_FRAME_TOO_WIDE_HARDWARE. Do a find in files for that exact variable. Look for a place in a function it is being used.
#6
06/01/2011 (10:57 am)
ok I found it in the t2dImageMapDatablock.cc

in the function "validateFrames"

This is fascinating stuff and I would like to post a million questions for each line (essentially of the function:: names, calls etc, understanding what they mean beyond the obvious) but for now I will just keep it to the one "for statement" the variable it was associated with.


I have asked a few questions, if you can answer them but I suppose the REAL question is.. what do I do from here regarding the original problem?

** I wrote the questions in all caps, not because of importance, just so they are noticed. cheers.

// Check Acquired Frame Sizes.
 //*|/||THESE "AQUIRED FRAME SIZES" ARE ALL FRAMES OF ALL CELLS OF ALL IMAGEMAPS IN PROJECT?
    for ( U32 n = 0; n < mTotalFrames; n++ )
    //*|/||WHAT IS U32? WHAT IS mTotalFrames?
    {
        // Fetch Frame.
        //*|/||MUST STUDY MEANING OF const
        //*|/||what is the meaning of cFrame& and frameIn also mVec, probably too many questions but I would like to know this stuff
        const cFrameIn& frameIn = mVecFrameIn[n];

        // Check Frame Width.
        if ( frameIn.mOriginalPixelArea.mWidth > mMaximumCurrentTextureSize )
        {
            if ( hardwareLimit )
            {
                // Error!
                THROW_IMAGEMAP_ERROR( T2D_IMAGEMAP_ERROR_FRAME_TOO_WIDE_HARDWARE );
            }
            else
            {
                // Error!
                THROW_IMAGEMAP_ERROR( T2D_IMAGEMAP_ERROR_FRAME_TOO_WIDE_SOFTWARE );
            }
        }
#7
06/01/2011 (11:02 am)
Please use code blocks. It will make this a lot easier. Alright, you have located where the error is thrown. We can remove most of the code that is not important right now and focus on the pertinent stuff:

if ( hardwareLimit )
{
   // Error!
   THROW_IMAGEMAP_ERROR( T2D_IMAGEMAP_ERROR_FRAME_TOO_WIDE_HARDWARE );
}
else
{
   // Error!
   THROW_IMAGEMAP_ERROR( T2D_IMAGEMAP_ERROR_FRAME_TOO_WIDE_SOFTWARE );
}

The above code shows WHY the error occurs. If hardwareLimit is true, the error is thrown. Here's your next step: find in that function where hardwareLimit is set to true.
#8
06/01/2011 (11:35 am)
ok. I found
const bool hardwareLimit = (maximumSelectedTextureSize == 0);


So, if this is the one, how can a maximumSelectedTextureSize = 0 and how can I change that? If that is what i need to do.


::)(((
#9
06/01/2011 (11:37 am)
You are on the right track and just asked the perfect question. Where does maximumSelectedTextureSize get initialized in the source code?
#10
06/01/2011 (11:43 am)
I dont know. That's why I asked.

::}((
#11
06/01/2011 (11:46 am)
Ok.
sorry bout that. mind was somewhere else. I did find this line but I can not see how I would adjust it or even if it is the correct one.

const S32 maximumSelectedTextureSize = Con::getIntVariable( "$pref::T2D::imageMapFixedMaxTextureSize", 0 );
#12
06/01/2011 (11:55 am)
Good find. We are nearing a solution. Once I get you to where I need you to be, I will provide the full solution. Just one or two more steps. Let's dissect this piece of the code, because it is the key:

const S32 maximumSelectedTextureSize = Con::getIntVariable( "$pref::T2D::imageMapFixedMaxTextureSize", 0 );

That is where the source variable is set. What the code does is search the memory containing all of the global TorqueScript variables and grab the value of a specific one.

$pref::T2D::imageMapFixedMaxTextureSize is the TorqueScript variable. If you are on Windows and using Torsion, open your project and search for $pref::T2D::imageMapFixedMaxTextureSize. Let me know when you find that. If you are on OS X, let me know and I will skip to the final step.
#13
06/01/2011 (12:16 pm)
I am on Mac OSX.

::))) BOO get Torsion for the Mac some how!!


::))((
#14
06/01/2011 (12:21 pm)
Alright, we'll skip the step of manually finding the variable for the sake of time. Open YourGame/projectFiles/common/defaultPrefs.cs. Scroll through that and locate $pref::T2D::imageMapFixedMaxTextureSize. Tell me what its value is.
#15
06/01/2011 (12:35 pm)
ok.
line 47.



it is = to 0.


#16
06/01/2011 (1:01 pm)
@Rennie

you can get Torsion running in a Mac:

1) install Virtual Box
2) install Windows in it

www.virtualbox.org/

XCode debugger tips; the stack window lists all source file code execution until a certain breakpoint
#17
06/01/2011 (1:08 pm)
So I would have to pay for Windows OS right? Not in my scene right now. But thanks.



Quote:
XCode debugger tips; the stack window lists all source file code execution until a certain breakpoint

So would this mean I would have to manually install breakpoints?
#18
06/01/2011 (1:20 pm)
Bingo. Because the variable is set to 0, you are getting the error. Why? There are two ways to limit texture sizes in the engine: hardware or software. $pref::T2D::imageMapFixedMaxTextureSize controls the software limitation. If it is set to 0, the engine knows there is no software limitation for texture size and asks the hardware. This gets into OpenGL code, so we will not go down that road.

By default, an iT2D project is always using a hardware texture limitation. If you want to go past that, you will want to set the software limitation. In the script file, set $pref::T2D::imageMapFixedMaxTextureError to something like 1024 or 2048, depending on what your texture is. Keep in mind that you can possibly run our of memory or have other problems, if you are reckless.
#19
06/01/2011 (1:30 pm)
Hmm. So "0" is false and as such there is no software limit to size, so by default it goes to hardware. If that is the case, and I reset it, it bypasses asking the hardware?



And just another quickie before I run tests. Is that if "0" is false and not a number value, then how come if it equals 3333 it registers a number value, not an error? I am just thinking it can be 0 or 1.


Thanks.
#20
06/01/2011 (1:34 pm)
It is not false. It is 0, which is the default value. It can be any numerical value, not just 1 or 0.

Quote:If that is the case, and I reset it, it bypasses asking the hardware?
Wrong terminology here. If you set it to a non-0 value, the engine will use the software limitation instead of the hardware limitationn.
Page «Previous 1 2 3 Last »