Thank you, I will need to group the textures together to not bind them many times.
VBO's and Frame buffers will work on every computer with a gpu? Or it will only work on newer ones like I read that Shader only work in newer gpus (correct me if I am wrong). I want my game to run on my grandma computer with a very old gpu of 32 MB :) (At the moment it is working smoothly :D)
Opengl drawing many textures!
Why it is a wrong method I posted?
Nanoha's approach has one drawback: if the texture changes many times (for example checked pattern), it will mean no speed boost.
This way, you have exactly the same number of binding/begin-end, as your types of textures. The extra time spent in the more loops is negligible compared to the other methods. I'm beginning to think that my posts are invisible, or maybe I became the legendary ABARABA?
Nanoha's approach has one drawback: if the texture changes many times (for example checked pattern), it will mean no speed boost.
glBindTexture(GL_TEXTURE_2D, texture1);glBegin(GL_QUADS);for(int i = 0; i < numTiles; i++){ if( tiles.texture == texture1) { vertices/tex to draw quad (use actual vertices not translate) }}glEnd();glBindTexture(GL_TEXTURE_2D, texture2);glBegin(GL_QUADS);for(int i = 0; i < numTiles; i++){ if( tiles.texture == texture2) { vertices/tex to draw quad (use actual vertices not translate) }}glEnd();glBindTexture(GL_TEXTURE_2D, texture3);...//or place it in a loop too.
To Szecs: Nanoha's approach is cleaner and more general (ie no advance knowledge of tile textures needed). He also mentioned to sort the tiles based on texture, so a checkerboard will not cause needless state changes :)
Quote:Original post by szecsor maybe I became the legendary ABARABA?
Lol Szecs, I did mine based on yours :P so your certainly not invisible. Its yours just a little more general/expandable. Each tile should be sorted based on texture first. So if its a checkbord type texture all the tiles would be sorted white first, then all the black ones so only 2 texture changes will be done.
If there are 200 different textures then yes, there will have to be 200 different texture changes but thats a problem with any method.
Quote:Original post by szecsThe same with state changes (glEnable/Disable)
Texture binding and transformations aren't allowed between glBegin-glEnd
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement