Dne Tuesday 12 September 2006 21:23 Kris Schnee napsal(a): > I was messing with a Pygame/OpenGL version of my tile graphics engine, > and am alarmed by a framerate issue. > This is the OpenGL version, which looks this bad because of hastily > drawn textures, full lighting, etc.: > http://kschnee.xepher.net/pics/3dthing.jpg > This is the older version using isometric tiles: > http://kschnee.xepher.net/pics/shiningsea060630-0.jpg > > In each case the underlying world data is the same. My thinking in doing > the GL version was that I wouldn't have to draw those awkward diagonal > tiles, and that I'd be able to rotate to any angle. I tested it just now > and got 12 FPS (using a time.sleep(.05) call so the max would be 20). > OK, I said, the tradeoff is that the Pygame isometric version would be > faster than the OpenGL. > > So I tested the isometric version. 6 FPS, even with the logo and > interface turned off. Not good. How can my pasting tiles on a 2D surface > be slower than calling an OpenGL list of lists of 3D cube-drawing > instructions? > > I'll post the complete "Pearl3D" code if you want to see it. > > Kris
Actually, if you want OpenGL version to do isometric rendering, you'll need to tweak the transformation matrix a bit. I didn't do it for a while, but you need something like this: in GL_PROJECTION matrix setup glOrtho view in GL_MODELVIEW glLoad something like this: | 1 0 0 0 | | 0 1 0 0 | | 0 x 1 0 | | 0 0 0 1 | where x is ratio by which Z axis distances (height in world) are translated to Y axis (up/down on screen), you'll probably use 0.5 you might also be able to use glMultMatrix on GL_PROJECTION instead of glLoad on GL_MODELVIEW, to have bigger freedom manipulating with modelview matrix