Live-Dimension wrote:I
Code: Select all
// render all the quads on-to screen
glBegin(GL_QUADS);
// render all the tiles
for(x=0; x<25; x++){
for(y=0; y < 19; y++){
if (Map.tile[x + Camera.x][y + Camera.y].tileSet > 0){
drawSurface(gTileSet, (x) * 32, (y) * 32, 32, 32, 0, 0, 1.0, 1.0);
}
}
}
glEnd();
I'm even more sure that you have to glBegin() and glEnd() each square you use, although if they are done in a special order you can avoid that.
Anyway, your cpu sucking issue will be here in this loop.
Actually, that's legit. And it's probably more efficient, because you aren't having to resubmit a polygon/vertex header to GPU for every primitive.
evilbunnie wrote:Also, I'm planning on using a different tile from tileset per tile, although I could probably have a check to see if it is already binded.
Honestly, you'll be MUCH better off rendering everything from a single sheet together. Even with this method, if you are blindly rendering things off of different sheets, it'll only save you a few extra glBinds(). And even if you DO render sheets together, you still have an unnecessary check in there.
The preferred method is to render everything from one texture, change textures, render everything from the new one, change textures, etc.
evilbunnie wrote:Code: Select all
glTexCoord2i(sX, sY); glVertex2i(dX, dY);
glTexCoord2i(sX, sY + sH); glVertex2i(dX, dY + dH);
glTexCoord2i(sX + sW, sY + sH); glVertex2i(dX + dW, dY + dH);
glTexCoord2i(sX + sW, sY); glVertex2i(dX + dW, dY);
Might I recommend you use floats? I'm sure it looks perfectly fine now, but the minute you start using glRotate() and glScale() on integer vertices, you're going to see a lot of bounciness going on. The Sega Saturn and PSOne had this problem, because they didn't have FPUs. The N64 did, and look how much smoother it looked. Also, the chances are that those are being converted to floats in some form or another before they wind up on your GPU. Also, many OpenGL drivers can use SSE instructions to hardware accelerate matrix/vector multiplications that only operate on floating point numbers...
You may be fine now, but later down the road, if you wan to start adding some OpenGL fanciness to your engine, you may regret using integers.
Anyway, back on topic... I honestly don't see anything that should be slowing you down based on the code that you've given. Do other applications tend to use proportionally more CPU when compared to your other computers? I have no experience with that processor, but I think the chances of it sucking/dying are looking pretty high...