steve3d Posted April 12, 2013 Share Posted April 12, 2013 I've created a simple test script to test the dynamic flag of a WidgetSprite, in document, it says int dynamic = 0 - Positive number if the image will be updated each frame; otherwice, 0. But after a simple test, I found there is no difference of setting this to 0 or 1. here is the code Image img; WidgetSprite sprite; int init() { img = new Image(); img.create2D(640, 480, IMAGE_FORMAT_RGB8); Gui ui = engine.getGui(); sprite = new WidgetSprite(ui); sprite.setWidth(800); sprite.setHeight(600); sprite.setLayerImage(0, img,1); ui.addChild(sprite, GUI_ALIGN_BACKGROUND); return 1; } int update() { float t = (engine.game.getTime() % 5.0f) / 5.0f; int c = t * 255; img.set(0, c); sprite.setLayerImage(0, img, 0); return 1; } My understanding is if I use dynamic=1, then I just need to focus on update the Image, and don't need to call sprite.setImage(img, 1). but the fact is no, whatever I use this dynamic flag, I always need to call setImage(img). And I found another problem, whatever the dynamic flag is, the performance is just exact same. So what is this dynamic flag for. how to use it and get some benifit from it? Link to comment
frustum Posted April 12, 2013 Share Posted April 12, 2013 This flag can help only on specific hardware like PlayStation3. All modern PC drivers are well optimized. And the difference is almost zero. But if you want to update the texture each frame please choose a 1 for dynamic parameter. It will help to select better video memory buffer for texture. Link to comment
steve3d Posted April 15, 2013 Author Share Posted April 15, 2013 Thanks for explanation. Link to comment
Recommended Posts