[CLOSED]Loading textures on the flow

Started by
15 comments, last by Aidamina 18 years, 11 months ago
How is that done?
Can you give some (pseudo) code
-->My Site<--
Advertisement
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.
____________________________________________________________Programmers Resource Central
Yeah but how do i (pre)load textures without using opengl functions?
-->My Site<--
Just load the image data into an array as you normally do before you do the following (or something similar)
                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.
____________________________________________________________Programmers Resource Central
Creating new thread, since topic has changed.
Please close this one moderators
-->My Site<--
If you are just doing a loading sceen, you probably don't care about constantly redrawing the sceen. You could just do this:
for (each item that has to be loaded) {  load_item();  draw_loading_sceen(progress);}

why waste cpu cycles when constant redrawing is not needed?
Its not a loading screen its a loading scene.
It renders a opengl scene while loading.
Later i hope to extend this thread to make the textures load dynamically if their needed, without any loading times/screens, while the game is runnings.
-->My Site<--

This topic is closed to new replies.

Advertisement