image Problem
3 posters
image Problem
I will add a png image in the SIO2 program,but it does not work. blank screen.the image loading was done,but it not show. this is my code,I don't know what happened,please help me,beacuse i don't familiar with SIO2.
Loading();
[/code]
SIO2stream *_SIO2stream = sio2StreamOpen( "loading.png", 1 );
if( _SIO2stream )
{
pImage = sio2ImageInit( "loading.png" );
_SIO2widget = sio2WidgetInit( "loading.png" );
sio2ImageLoadPNG( pImage,
_SIO2stream );
sio2ImageGenId(pImage,_SIO2widget->flags,sio2->tfilter);
_SIO2material = sio2MaterialInit( "loading.png" );
_SIO2material->blend = SIO2_MATERIAL_DIVIDE;
_SIO2material->_SIO2image[ SIO2_MATERIAL_CHANNEL0 ] = pImage;
_SIO2widget->_SIO2material = _SIO2material;
_SIO2widget->_SIO2transform->scl->x =400.0f;
_SIO2widget->_SIO2transform->scl->y =320.0f;
_SIO2widget->_SIO2transform->loc->x = 0.5f;
_SIO2widget->_SIO2transform->loc->y = 0.5f;
sio2TransformBindMatrix( _SIO2widget->_SIO2transform );
sio2EnableState(&_SIO2widget->flags,
SIO2_WIDGET_VISIBLE | SIO2_WIDGET_CENTERED |
SIO2_WIDGET_ALIGNH | SIO2_WIDGET_ALIGNV |
SIO2_WIDGET_ENABLED );
Render();
[code]
sio2WindowEnter2D( sio2->_SIO2window,-1000.0f, 1000.0f );
{
sio2WindowEnterLandscape2D( sio2->_SIO2window );
{
if(pImage)
{
sio2->tfilter = SIO2_IMAGE_BILINEAR;
sio2->afilter = SIO2_IMAGE_ANISOTROPIC_1X;
if( _SIO2widget->_SIO2material->_SIO2image[ SIO2_MATERIAL_CHANNEL0 ]->tid )
{
glDisable( GL_CULL_FACE );
sio2WidgetRender( _SIO2widget, sio2->_SIO2window, 1 );
sio2WidgetReset();
sio2MaterialReset();
sio2ResourceUpdateAllWidgetBoundaries( sio2->_SIO2resource,
sio2->_SIO2window );
}
}
}
sio2WindowLeaveLandscape2D( sio2->_SIO2window );
}
sio2WindowLeave2D();
Loading();
[/code]
SIO2stream *_SIO2stream = sio2StreamOpen( "loading.png", 1 );
if( _SIO2stream )
{
pImage = sio2ImageInit( "loading.png" );
_SIO2widget = sio2WidgetInit( "loading.png" );
sio2ImageLoadPNG( pImage,
_SIO2stream );
sio2ImageGenId(pImage,_SIO2widget->flags,sio2->tfilter);
_SIO2material = sio2MaterialInit( "loading.png" );
_SIO2material->blend = SIO2_MATERIAL_DIVIDE;
_SIO2material->_SIO2image[ SIO2_MATERIAL_CHANNEL0 ] = pImage;
_SIO2widget->_SIO2material = _SIO2material;
_SIO2widget->_SIO2transform->scl->x =400.0f;
_SIO2widget->_SIO2transform->scl->y =320.0f;
_SIO2widget->_SIO2transform->loc->x = 0.5f;
_SIO2widget->_SIO2transform->loc->y = 0.5f;
sio2TransformBindMatrix( _SIO2widget->_SIO2transform );
sio2EnableState(&_SIO2widget->flags,
SIO2_WIDGET_VISIBLE | SIO2_WIDGET_CENTERED |
SIO2_WIDGET_ALIGNH | SIO2_WIDGET_ALIGNV |
SIO2_WIDGET_ENABLED );
Render();
[code]
sio2WindowEnter2D( sio2->_SIO2window,-1000.0f, 1000.0f );
{
sio2WindowEnterLandscape2D( sio2->_SIO2window );
{
if(pImage)
{
sio2->tfilter = SIO2_IMAGE_BILINEAR;
sio2->afilter = SIO2_IMAGE_ANISOTROPIC_1X;
if( _SIO2widget->_SIO2material->_SIO2image[ SIO2_MATERIAL_CHANNEL0 ]->tid )
{
glDisable( GL_CULL_FACE );
sio2WidgetRender( _SIO2widget, sio2->_SIO2window, 1 );
sio2WidgetReset();
sio2MaterialReset();
sio2ResourceUpdateAllWidgetBoundaries( sio2->_SIO2resource,
sio2->_SIO2window );
}
}
}
sio2WindowLeaveLandscape2D( sio2->_SIO2window );
}
sio2WindowLeave2D();
LuisLee- Posts : 85
Join date : 2009-04-26
Age : 37
Re: image Problem
By default XCode will compress the .PNG, and then it become invalid when extracting it using sio2StreamOpen, disable in the options to compress .PNG inside the .app
Re: image Problem
sio2interactive wrote:By default XCode will compress the .PNG, and then it become invalid when extracting it using sio2StreamOpen, disable in the options to compress .PNG inside the .app
thank you for your help, but could you please say it more concretely, because i don not know how to do about it. thank you!
LuisLee- Posts : 85
Join date : 2009-04-26
Age : 37
Re: image Problem
sio2interactive wrote:Project -> Edit Project Settings -> Compress .png files
I try it,but,It does not work。I think it have other problems.
whether there are some problems with my code?
LuisLee- Posts : 85
Join date : 2009-04-26
Age : 37
Re: image Problem
I had the same issue happen to me and I was able to resolve it with these two steps:
1) In Xcode, rename the extension of your PNG image. For example: myimage.ppng. This will bypass the weirdness with Xcode loading the PNG image to the iphone when it installs your app.
2) Make sure your image is a power of 2 in size, e.g: 64x64, 128x128, 256x256 etc. It wont display unless the image meets this size requirement. You can resize the size of your widget to the desired resolution, or you can create a larger then needed image (like 128x128) and then only use the amount you need for your graphic with the rest blank. Take a look at the poweredby images included with the SDK for an example of this.
Hope this helps!
1) In Xcode, rename the extension of your PNG image. For example: myimage.ppng. This will bypass the weirdness with Xcode loading the PNG image to the iphone when it installs your app.
2) Make sure your image is a power of 2 in size, e.g: 64x64, 128x128, 256x256 etc. It wont display unless the image meets this size requirement. You can resize the size of your widget to the desired resolution, or you can create a larger then needed image (like 128x128) and then only use the amount you need for your graphic with the rest blank. Take a look at the poweredby images included with the SDK for an example of this.
Hope this helps!
spekkio- Posts : 1
Join date : 2009-05-04
Re: image Problem
1) In Xcode, rename the extension of your PNG image. For example: myimage.ppng. This will bypass the weirdness with Xcode loading the PNG image to the iphone when it installs your app.
>> Its not weird... you just have to disable the option (check above) and everything work like a charm
>> Its not weird... you just have to disable the option (check above) and everything work like a charm
Re: image Problem
thanks,I will try my best to do this.thank you !
LuisLee- Posts : 85
Join date : 2009-04-26
Age : 37
Re: image Problem
Thank you very much! It work perfect!
LuisLee- Posts : 85
Join date : 2009-04-26
Age : 37
Similar topics
» Camera problems
» md2 problem!
» Strange problem with sio2ObjectMapBuffer
» Passing Through Static Object (Beating my iPod seems to help)
» IPO Curve Problem...
» md2 problem!
» Strange problem with sio2ObjectMapBuffer
» Passing Through Static Object (Beating my iPod seems to help)
» IPO Curve Problem...
Permissions in this forum:
You cannot reply to topics in this forum