Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Repeating background image - Page 2 — Gideros Forum

Repeating background image

2»

Comments

  • ar2rsawseenar2rsawseen Maintainer
    edited May 2012
    Oh, thanks for reminding, updated first post to newer example, in case anyone will be looking at how to create repeating background.

    about @avo question.

    Are you sure that this region exists and method does not simply return nil value?

    Edited: sorry misread it, you said it provide table.

    Ok based on documentation: "The TextureRegion class specifies a texture and a rectangular region in it"

    How about iterating through returned table, maybe one if it's properties is the texture, other's just defining region?

    Well it would be just a hack, but it should work with region also, as Bitmap does.
  • berkayberkay Member
    Hi,

    I have the same problem with avo, I'm trying to fill my scene's background with a textureregion from my texturepack object. Filling shape method is not working with textureregion but frankly it works with texturepack object because it inherits texturebase class.

    I could not find any other way to fill a shape with an image other than creating a texturepack that contains a single textureregion or using an image outside texturepack.
    My question is there any significant difference in memory consumption between using these methods?
  • ar2rsawseenar2rsawseen Maintainer
    edited July 2012
    So, the example from the first post of this thread does not work for you?
  • berkayberkay Member
    It works, but one of rules I learned while developing games for mobile platforms is images should be in texturepacks or textureatlas(andengine) or it will consume more memory.
    I am simply asking if the image size is a power of 2x2, will it consume more memory when it is not in a texturepack or will it consume the same memory?

    Likes: Yan

    +1 -1 (+1 / -0 )Share on Facebook
  • Your correct, effective use of texture atlases (or tpages - however you want to call them) is the most efficient method of drawing as it removes the need for OpenGL to swap textures and re-upload data to the video card (the slowest bit), however currently I don't think shapes accept texture regions as a valid texture type - hopefully this will be changed in a future release.

    Depending on the size of the image you want to repeat, you might be better off to just create a single sprite that contains several bitmaps all pointing to the same texture - I suspect (as the texture is already loaded) that the actual draw time won't be that much slower.

    As for the power of 2 size - that's an OpenGL restriction and in your case will actually refer to the Atlas size (if you using a single large atlas (ie 1024x1024) to hold all your resources).
    WhiteTree Games - Home, home on the web, where the bits and bytes they do play!
    #MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
Sign In or Register to comment.