简体   繁体   中英

How does GLKTextureLoader loads cube-map from image-strip?

Is there a way to load cube-map using giant image-strip in OpenGL-ES? (or desktop GL or extension, anything)

For example, GLKTextureLoader class offers loading cube-map at once if they're sequenced vertically. I want to know there's some GL functions for this feature or the class is just splitting textures when loading. Of course, I can use this class, but I want to know which is more efficient between loading long image-stip or separated 6 images for each side.

My guess is that this function is indeed just splitting up the image into 6 sets of faces after loading the image file and then using these to do standard cubemap generation via the standard cubemap calls:

glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X...)
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y...)
etc

Note that the GLKTextureLoader class also defines cubeMapWithContentsOfFiles which allows you to specify 6 individual image files to define the face textures.

You could check the time it takes to setup the cubemap using the 6-files input versus the cube strip input (cubeMapWithContentsOfFile). Whhich runs faster will depend on if the loading of 6 files is faster than loading one big file and having the method split it up. Otherwise, I bet all the rest of the code between the two functions is identical and uses the standard cubemap texture calls as above.

Since GLKit is Apple proprietary, we can't just look at the source as we can with most OpenGl functions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM