Original Post
There is one game, i want to make map editor for it. Map itself is made from simple block shapes. Nothing more. Game map stores specific numbers. Each number says to game engine what shape each block is. If for example number is 0 then this is just simple fixed size cube. If it's 1 then it's a slope etc... till ~60 of them. Map can contain any number and any of these blocks as much it can hold. There is no block coordinates (like X,Y,Z) or vertex information stored in file. They are hard coded in game and original editor. It's simple: predefined size of blocks are stored in map as specific numbers. Like i said above. Map size 256x256x8. To get a different shapes from specific co-ordinates i coded simple console app in Delphi.
var cube:integer;
.... By editing map and saving it. The app shows correctly the shape type (nr) and it's coordinates. So i don't have problems getting the correct shape. Main problem is with OpenGL, code and algorithm. I don't know exactly where is the problem. This is code which reads shape type from map file and returns it in global variable "which". procedure ReadGmp;
begin
repeat
until ms.Position>=ms.Size;
end; Then the DrawIt procedure comes into the action. It contains all glVertex3f and stuff. procedure DrawIt;
begin
end;
end; The main drawing function get's the shape and also calls DrawIt procedure to draw the shape it got. // The main drawing function.
procedure DrawGLScene;
begin
SDL_GL_SwapBuffers;
end; What i need is that every specific shape must have drawn at it's own co-ordinates, let's say one block is at X: 5, Y: 18, Z: 8, slope is at X:28 Y:125 Z:1. And then another simple block at X:31 Y:88 Z:1 So it must draw or render only those blocks at their X,Y,Z positions. But the problem is: the code doesn't care about this, it draws all blocks, even if at that X,Y,Z is no shapes defined. Look the screenshot: http://www.onlinedisk.ru/view/98090/buggg.JPG I don't understand where is the problem? Is it in code, algorithm or in both? Maybe the code is not organized well? Maybe the code that gets numbers should not be in drawing loop? Can somebody give some hints or anything that can help? Im willing to explain more about this, if somebody don't understand it. [Edited by - BytePtr on March 12, 2009 9:27:58 AM]