Image Troubles
3 posters
Image Troubles
I'm sorry to bother everyone with such a basic question, but I can't figure out how to render a 2d image. I've got fonts working, but I don't understand how to apply the technique to images.
So far I've got this:
and then this in my rendering loop:
What I don't understand is how i link ImageRender to the image that I set up in the stream, since images don't have an sio2FontBuild like fonts do. Is there some equivalent that I am missing? Thanks in advance!
So far I've got this:
- Code:
if( _SIO2stream )
{
_SIO2image = sio2ImageInit( "RFlag.tga" );
{
sio2ImageLoad( _SIO2image, _SIO2stream );
sio2ImageGenId( _SIO2image, 0 );
}
_SIO2stream = sio2StreamClose( _SIO2stream );
_SIO2image->height = 480.0f;//_SIO2video->_SIO2image->width;
_SIO2image->width = 240.0f;//_SIO2video->_SIO2image->height;
and then this in my rendering loop:
- Code:
sio2WindowEnter2D( sio2->_SIO2window, 0.0f, 1.0f );
{
sio2WindowEnterLandscape2D( sio2->_SIO2window );
{
// Render our widget
sio2ImageRender(_SIO2image);
What I don't understand is how i link ImageRender to the image that I set up in the stream, since images don't have an sio2FontBuild like fonts do. Is there some equivalent that I am missing? Thanks in advance!
samson- Posts : 27
Join date : 2008-11-29
Re: Image Troubles
Hmm I tried that too and didn't have any luck. This is as far as I got:
and then
It crashes when I use SIO2_WIDGET_VISIBLE
- Code:
_SIO2stream = sio2StreamOpen( "RFlag.tga", 1 );
if( _SIO2stream )
{
_SIO2image = sio2ImageInit( "RFlag.tga" );
{
sio2ImageLoad( _SIO2image, _SIO2stream );
sio2ImageGenId( _SIO2image, 0 );
}
_SIO2stream = sio2StreamClose( _SIO2stream );
_SIO2material = sio2MaterialInit( "RFlag" );
{
_SIO2material->blend = SIO2_MATERIAL_DIVIDE;
_SIO2material->_SIO2image[ SIO2_MATERIAL_CHANNEL0 ] = _SIO2image;
}
_SIO2widget = sio2WidgetInit( "RFlag" );
_SIO2widget->_SIO2material = _SIO2material;
// Initialize the size of the widget to be the same as our
// video image.
_SIO2widget->size->x = 480.0f;//_SIO2video->_SIO2image->width;
_SIO2widget->size->y = 240.0f;//_SIO2video->_SIO2image->height;
_SIO2widget->pos->x = 0.5f;
_SIO2widget->pos->y = 0.5f;
sio2EnableState( &_SIO2widget->flags,
SIO2_WIDGET_VISIBLE | SIO2_WIDGET_CENTERED |
SIO2_WIDGET_ALIGNH | SIO2_WIDGET_ALIGNV );
glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT );
}
and then
- Code:
sio2WindowEnter2D( sio2->_SIO2window, 0.0f, 1.0f );
{
sio2WindowEnterLandscape2D( sio2->_SIO2window );
{
// Render our widget
sio2WidgetRender( _SIO2widget, sio2->_SIO2window );
// Reset the rendering states set by SIO2widget.
sio2WidgetReset();
It crashes when I use SIO2_WIDGET_VISIBLE
samson- Posts : 27
Join date : 2008-11-29
Re: Image Troubles
You need to initialize the widget in EAGLview.mm.
Search the forum please; there was another thread on this just a few days ago.
-j
Search the forum please; there was another thread on this just a few days ago.
-j
meteors- Posts : 241
Join date : 2008-11-08
Location : Sunny Florida
Re: Image Troubles
Thank you meteors, that did it. My apologies, I had searched the forum for widget and didn't see any threads that answered my question
samson- Posts : 27
Join date : 2008-11-29
Similar topics
» Image Glitch after using io2ObjectDuplicate()
» consolidate into one image
» image Problem
» Drawing over an UIImagePickerController image
» Loading image textures on the fly
» consolidate into one image
» image Problem
» Drawing over an UIImagePickerController image
» Loading image textures on the fly
Permissions in this forum:
You cannot reply to topics in this forum