androidopengl-escropvboatlassprites

Android OpenGL ES draw_texture with cropping or VBO's?


Hey all, i was re-working my android app to use OpenGL instead of canvas (as it is ungodly slow) and i was wondering, since i'm using a tile sheet (atlas texture) would it be faster to use VBO's or draw_texture with the crop set like so:

// Crop our texture
((GL11) gl).glTexParameteriv(GL10.GL_TEXTURE_2D, GL11Ext.GL_TEXTURE_CROP_RECT_OES, cropRect[cropIndex], 0);
gl.glColor4f(1, 1, 1, 1);

After listening a while to Chris Pruett I gathered that draw_texture is undoubtably the fastest for an individual sprite but if i am cropping an atlas is this still true?


Solution

  • would it be faster to use VBO's or draw_texture

    Draw using atlas texture

    Note that he is using a "tiled world" which explains why he is using this technique. If you're not using a tiled world you should probably go with draw_texture.

    After listening a while to Chris Pruett I gathered that draw_texture is undoubtably the fastest for an individual sprite but if i am cropping an atlas is this still true?

    Not always. If you're using a big atlas texture with many sprites the glTexParameteriv() function will be too expensive. If you're just using a lower amount of sprites it will probably be faster, which also depends on number of calls to the glTexParameteriv() function.