Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <ol> <li><p>yes, if you don't need the transparency (alpha) use a format with no alpha, and smaller formats like (RGB565) means smaller size textures which certainly speed up the decoding and loading to opengl.</p></li> <li><p>definitely YES, if you load a texture with non power of 2 width/height, opengl will allocate a texture with the next power of 2 (513/513 texture will become 1024/1024), and that means you are wasting vram memory. and you cant command opengl to take a part of the image because "teximage2d" takes width/height of the loaded image, and specifying any other values will give you a corrupted image (if not crushing the app).</p></li> <li><p>no comment.</p></li> <li><p>I'm not sure of that, there is already a multi-threaded rendering engine based on opengl. and you can load a texture (from other thread) while issuing a rendering command (at least in native C/C++, not sure about java). and NO, do not ever try to load a texture in rendering loop, that's bad practice.</p></li> <li><p>not sure what you mean here</p></li> <li><p>this is the best way, the native code (C/C++) always better </p></li> <li><p>(if you mean vram here) yes, using a texture compression format like ETC1, PVRTC, ATC always a good idea, it take less vram memory and yields a better performance.</p></li> <li><p>consider switching to a fallback solution (even more smaller textures) rather that chopping off lower-end devices.</p></li> </ol> <p>EDIT:</p> <p>4.. you start loading contents (images) in a separate thread which indicate to the rendering thread the percentage of loading process, this can be used to draw a progress bar for the loading process.</p> <p>5.. this trick called "texture atlases" and it's for speeding up the rendering not the loading.</p> <p>6.. after loading a decoded image into an opengl texture, you are free to delete the decoded image (from system memory) than you load the next one. and after you done using the opengl texture you can delete it (from video memory).</p> <p>7.. texture compression is hardware-specific opengl extensions, so you have to check if the texture compression extension is present and then use it with "glCompressedTexImage2D" function instead of "texImage2D". PVRTC for PowerVR GPU; ATC for AMD GPU; ASTC for Mali GPU; ETC1 a standard texture format (supported in android 2.2+).</p> <p>8.. when you done loading an image to opengl texture, the image is no longer needed. so you have to free the ram from unneeded contents (images).</p> <p>EDIT2:</p> <p>5.. <a href="http://http.download.nvidia.com/developer/NVTextureSuite/Atlas_Tools/Texture_Atlas_Whitepaper.pdf" rel="noreferrer">http://http.download.nvidia.com/developer/NVTextureSuite/Atlas_Tools/Texture_Atlas_Whitepaper.pdf</a></p> <p>7.. after you have loaded two ETC textures (ex: the first texture hold the color, and the second store alpha in the red channel) using "glCompressedTexImage2D" in opengl (lets say textureId1, textureId2), bind the two textures in two texture units :</p> <pre><code>glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, textureId1); glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, textureId2); </code></pre> <p>and then create a shader program with the following fragment shader:</p> <pre><code>uniform sampler2D sTexture1; uniform sampler2D sTexture2; varying mediump vec2 vTexCoord; void main() { gl_FragColor.rgb = texture2D(sTexture1, vTexCoord).rgb; gl_FragColor.a = texture2D(sTexture2, vTexCoord).r; } </code></pre> <p>finally, bind the two shader texture samplers to the two textures units (which point to the two ETC textures):</p> <pre><code>GLint texture1Sampler = glGetUniformLocation(programObject, "sTexture1"); GLint texture2Sampler = glGetUniformLocation(programObject, "sTexture2"); glUniform1i(texture1Sampler, GL_TEXTURE0); glUniform1i(texture2Sampler, GL_TEXTURE1); </code></pre> <p>8.. you cant assume any thing, you keep allocating textures and buffer (as needed) untill you get GL_OUT_OF_MEMORY, than you have to free other unused resources (textures, buffers, ...).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload