Terrain Tuesday #6
I suspect that you all are extremely eager, to the point of violent fits of excitement and joy, to see the editor in action again, now with texture editing abilities. In fact, since you have been waiting patiently, despite such intense anticipation, I will put off telling you what I’ve done this week until after the video, which will come immediately following such time as this extremely long and unnecessarily convoluted sentence is over.
There were tweaks here and there, but the most important change to the code this week was vertex arrays. Warning: technical talk ahead. All this time, I’ve been rendering the terrain with immediate rendering – glVertex3fv, that type of thing. I know! But for those of you who don’t know, well, when you bump up the size of your terrain to, say, 193×193 vertices, for example, with multitexturing and color, you’re asking the program to make 1.3 million function calls per frame, just for rendering. I never intended to leave it that way, and that’s why. Enter vertex arrays. It takes some extra setup, basically setting up arrays and pointers for OpenGL referencing, but when it’s all said and done, it’s more like 25 function calls per frame. Nice, huh? What this means for you, the end user, is that you can work with bigger, more detailed terrains.