How is that done?
Can you give some (pseudo) code
[CLOSED]Loading textures on the flow
You would just need to set a boolean to true when the loading has finished and check that every frame in the rendering code, and exit the rendering thread if the boolean is true. Then you will be able to create the textures as normal. You might want to pause after finishing loading and creating the textures (using a normal loop) to give the rendering thread time to finish.
Just load the image data into an array as you normally do before you do the following (or something similar)
If you don't know how to load the texture data you can look here and here.
Hope this helps.
glGenTextures(1, &texture[0]); glBindTexture(GL_TEXTURE_2D, texture[0]); glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[0]->sizeX, TextureImage[0]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR)
If you don't know how to load the texture data you can look here and here.
Hope this helps.
If you are just doing a loading sceen, you probably don't care about constantly redrawing the sceen. You could just do this:
why waste cpu cycles when constant redrawing is not needed?
for (each item that has to be loaded) { load_item(); draw_loading_sceen(progress);}
why waste cpu cycles when constant redrawing is not needed?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement