You are using fixed-points, right? Well, then you can kinda cheat a bit by setting the coordinates to e.g. 0.1 and 15.9 instead of 0 and 16. It's just as fast as the previous code, but after experimenting a bit with the values, you can get rid of the lines witouth visuall distorting the texture.
I'm doing that already. I have a nice SAFE_MODE #define which tells me if something is read out-of-bounds and it was triggered with OpenGL like texture coords (0 - 1 on the edges) vs. nGL coords (0-1 - 1px on the edge pixels). As the lines are a unique color (for each texture) I don't think it's some out-of-bounds read (texture atlas, see below).
Since these textures are repeated, it would actually make more sense to wrap the texture coordinates. It would have to be tested per-pixel, however it should be fairly fast (as long as textures are a power of two size), just a bitwise AND on each coordinate value. For a minecraft engine, this would also open up the ability to simplify meshes in large, flat areas of the same block.
The problem here is that I'm using a texture atlas.
As I preprocess every Chunk and basically just have to iterate over a array of vertices, I'd have to determine which texture to bind for every triangle.
That'd be horribly slow.
The problem is rather a rounding issue, as with fixed-point x / y = z can be true, but z * y = x doesn't have to be.
Or maybe I'm just completely wrong. Who knows. I'll have to fix those bugs anyway...
I'd say go for the fastest. It' only disturbing when blocks are really far.
Actually, with the improved indexed-rendering I'd have to do less floating-point calculations so it's not that slow.
Still 18 fps if textures enabled.
BTW: Who told me that floats wouldn't be much slower than fixed-point? It was you, Levak, wasn't it?
I'd say that you should include both mode (with and without textures) in the final version so that we can make beautiful screenshots with textures and build quickly too
(not that it is slow with textures, but it is faster without so if we want to make quick changes, we might want a quick way).
That'd mean switching without recompiling, the problem here is that I enable and disable textures by #define ing TEXTURE_SUPPORT
and an if EVERY PIXEL would be horribly slow. So:
- Code duplication (Copy nglDrawTriangle)
- Ugly preprocessor usage: Move nglDrawTriangle into a header file and #include it with various #define s.