Posts

Showing posts from February, 2012

Unity3d: Forward Rendering Path Details

Titanium iOS/Android cross platform memo

As possible as you can choose non-dependent interface on specific platform. Be careful the include *.js path. Localization file at the string.xml file. When you find some item name displayed have problem, you need to check the file first.

JavaScript language advanced Tips & Tricks

http://code.google.com/p/jslibs/wiki/JavascriptTips#Singleton_pattern

Java script singleton: http://www.hardcode.nl/subcategory_1/article_526-singleton-examples-in-javascript.htm

var Setting =(function(){
    var instantiated;
    function init (){
        // all singleton code goes here
        return {
            publicWhatever:function(){
                alert('whatever')
            },
            userID:null,

            setUserID:function( id ) {
                userID = id;
            },

            getUserID:function() {
                return userID;
            }
        }
    }

    return {
        getInstance :function(){
            if (!instantiated){
                instantiated = init();
            }
            return instantiated;
        }
    }
})()

Write data to file in Titanium

var configDir = Titanium.Filesystem.getFile( Titanium.Filesystem.applicationDataDirectory, "dirPath" );

    if ( configDir.exists() ) {
         configDir.createDirectory();
     }

var config = Titanium.Filesystem.getFile( configDir.resolve(), "fileName" );

    if ( config.write( writeSettingToConfig( userID ) ) == false )
    {
        // handle write error
        var error;
    }
    config = null;
    configDir = null;

FETCHING DATA FROM GOOGLE PLACES API USING TITANIUM

Shadow map PCF vs. Variance filter

PCF(Percentage closer filer): Because texture precision is not enough to confirm lossless. Therefore, we can reference the neighbor pattern. I use four corner texel( left-top, right-top, left-bottom, right-bottom) and the current texel.
                           float2 texCoord;
                           float4 p;
                           texCoord.x = shadowPos.x + 1/shadowMapSize;
                           texCoord.y = shadowPos.y - 1/shadowMapSize;
                           p.x = tex( sm, texCoord );  // left-top

                           texCoord.xy = shadowPos.xy + 1/shadowMapSize;
                           p.y = tex( sm, texCoord );  // right-top

                           texCoord.xy = shadowPos.xy - 1/shadowMapSize;
                           p.z = tex( sm, texCoord );  // left-bottom

                           texCoord.x = shadowPos.x + 1/shadowMapSize;
                           texCoord.y = shadowPos.y - 1/shadowMapSize;
                           p.w = tex( sm, t…

iOS vs. Android GPU architecture

iOS outperform Android for OpenGL apps on the exact same hardware. iOS offers a fast path for OpenGL apps. ( there are no intermediate buffers on iOS, but on Android whose surfaceflinger system will creates an additional copy of the entire screen which need to be copied over the main bus every time you swap buffers)

Get friends checkin from FQL

https://graph.facebook.com/

fql?q=SELECT coords, tagged_uids, page_id, author_uid FROM checkin WHERE author_uid IN (SELECT uid2 FROM friend WHERE uid1 = me())

http://developers.facebook.com/docs/reference/fql/checkin/

We can test the result from  Graph API Explorer
http://developers.facebook.com/tools/explorer

Create Facebook app id