Starting with 1.3 template

View previous topic View next topic Go down

Starting with 1.3 template

Post  jj on Thu Dec 11, 2008 12:37 am

Hi,

I've just updated and am trying to render a simple scene using V1.3 template project.

For some reason, whenever I touch or drag on the screen, I get intermittent flashes (my scene to BLACK) and back.

Here is the code for the template.mm: Am I forgetting something basic?

Code:

#include "template.h"

#include "../src/sio2/sio2.h"

int loaded = 0;

void templateRender( void )
{
   if (loaded == 0) {
      unsigned int i = 0;
   
      sio2ResourceCreateDictionary( sio2->_SIO2resource );
   
      sio2ResourceOpen( sio2->_SIO2resource,
                "MyScene.sio2", 1 );
   
      while( i != sio2->_SIO2resource->gi.number_entry )
      {
         sio2ResourceExtract( sio2->_SIO2resource );
         ++i;
      }
   
      sio2ResourceClose( sio2->_SIO2resource );
   
      sio2ResourceResetState();
   
      sio2ResourceBindAllImages( sio2->_SIO2resource );
   
      sio2ResourceBindAllMaterials( sio2->_SIO2resource );
   
      sio2ResourceBindAllMatrix( sio2->_SIO2resource );
   
      sio2ResourceGenId( sio2->_SIO2resource );

      loaded = 1;   
   }
   
   glMatrixMode( GL_MODELVIEW );
   glLoadIdentity();
   
   glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT );
   
   if( !sio2->_SIO2camera )
   {
      SIO2camera *_SIO2camera = ( SIO2camera * )sio2ResourceGet( sio2->_SIO2resource,
                                                  SIO2_CAMERA,
                                                  "camera/Camera" );
      sio2->_SIO2camera = _SIO2camera;
      
      sio2CameraSetPerspective( _SIO2camera, sio2->_SIO2window );
   }
   
   
   sio2CameraUpdateDir( sio2->_SIO2camera );
         
   sio2CameraRender( sio2->_SIO2camera );
      
   sio2CameraUpdateFrustum( sio2->_SIO2camera );
      
      
      // Run the culling algorithm on the
      // current scene.
      sio2ResourceCull( sio2->_SIO2resource,
                   sio2->_SIO2camera );
      
      // Render the solid object (the plane) and
      // our main emitter (if visible)
      sio2ResourceRender( sio2->_SIO2resource,
                    sio2->_SIO2window,
                    sio2->_SIO2camera,
                    SIO2_RENDER_SOLID_OBJECT );
      
      // Make sure that all material machine states
      // are resetted.
      sio2MaterialReset();
   
}

void templateShutdown( void )
{
   // Clean up
   sio2->_SIO2window = sio2WindowFree( sio2->_SIO2window );
   
   sio2ResourceUnloadAll( sio2->_SIO2resource );

   sio2->_SIO2resource = sio2ResourceFree( sio2->_SIO2resource );

   sio2 = sio2Shutdown();
   
   printf("\nSIO2: shutdown...\n" );
}


void templateScreenTap( void *_ptr, unsigned char _state )
{

}


void templateScreenTouchMove( void *_ptr )
{


}


void templateScreenAccelerometer( void *_ptr )
{


}

jj

Posts : 77
Join date : 2008-09-24

View user profile

Back to top Go down

Re: Starting with 1.3 template

Post  sio2interactive on Thu Dec 11, 2008 12:52 am

Hummm looking good to me... maybe try to check tutorial03 to make sure that you are doing the good thing...
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 37
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: Starting with 1.3 template

Post  jj on Thu Dec 11, 2008 1:02 am

I went with tutorial11 and got the camera to render, however, it's all grey blocks and it doesn't seem to be using any lights (2 lamps)...

I went back to square one, and think something may not be initalized properly... hmm

Anything I need to do to enable the lighting?

*tried with tutorial03 as well, and there's no shading going on... ?

jj

Posts : 77
Join date : 2008-09-24

View user profile

Back to top Go down

Re: Starting with 1.3 template

Post  sio2interactive on Thu Dec 11, 2008 1:50 am

Heuuuuuu yeah man... actually maybe you should start by watching ALL the video tutorials... in order to make sure that you grasp everything...
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 37
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: Starting with 1.3 template

Post  uprise78 on Sat Dec 13, 2008 8:20 pm

I have the same problem with tutorial 12. Every touch or touchMove causes the screen to flicker black. Any solutions to this?

uprise78

Posts : 228
Join date : 2008-10-31

View user profile

Back to top Go down

Re: Starting with 1.3 template

Post  sio2interactive on Sun Dec 14, 2008 12:41 am

It's caused by the new IO system, check like tutorial04 for how the new method works...
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 37
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: Starting with 1.3 template

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum