Recommended Posts

Hey all
I got myself into a big muddle with my other engine so I have started on an engine to give me all the basics on OpenGL. I have ported all the other aspects I wrote (like the console, texture manager, font system, interface items etc) over to the new engine. However I decided to work on my own map very simple format that I could quickly write a basic map editor for. The syntax looks a bit like this (heres the TestLevel Example):

Anyway, I know how to improve on this (Tex coords, different primitives etc) but the test level is just to see if it renders properly.
Ok, i'm coming across big problems!
For some obscure reason I am unable to do the most basic of things...
What I want to do is make a room out of cube primitives. The 2 primitives in the example render properly.

-
| |
| |__
|____|
^
|
Cam

Except rotate it 90' on the Y Axis so you are in the 'cams' position so it looks like this:

----------
| |
| |
| |
| |
----------

Ok, now you know what it looks like. Thats Cube 1 being 1 unit wide, 10 units high, and 10 units depth. The second cube is 10 units wide, 10 units high and 1 unit depth. I have scaled it down by a factor (As shown in the map file) of 0.01 on every dimension.
Now, I need to display a third cube but this one needs to go here(Coloured in):

____
|\\\\| <-HERE
| |
| |__
|____|
^
|
Cam

Now, How i'm doing the display is translating according to the "Pos x y z" in the map file. So if the Map file says "Pos 0.0 0.0 -1.0" I translate(0.0 0.0 -1.0)
Looking at the map file you can see for the first 2 cubes I have translated -1 unit down the z axis. Umm, well, heres the source code so you can see when and where I do the different bits:

So from this I assume that the translations are not scaled (are they scaled ever?) because I do the translation before the scaling. I also push the matrix before scaling or translating and then pop it after I have down all the drawing so I basically start afresh on the next cube.
According to the map the first 2 cubes are drawing according to how they should be drawn.
However, the rendering comes unstuck when I want to draw a cube in the position the other side of cube one (The position I showed in the diagram- the coloured in cube). I wasn't sure how many units I should translate down the Z axis so I tried 1 more unit so the third cube has a pos of X=0 Y=0 Z=-2. However this did not actually change the Z position of the cube but actually made it smaller. So I decided to change the scaling to 1.0 so it wasn't scaled at all and then moved the whole thing -60 units down the Z axis so I could see the whole thing. Since its on a ratio of 1:1 I tried translating the 3rd cube to -70 so It would join up with the 10 units in the 1st cube goes down the Z axis.
Ok, so I try this and it the 3rd cube stays on the same Z as the rest of the cubes but appears smaller.
I have no idea whats going on. All I want to do it make it so it translates the right distance into the Z axis (according to the map file) so I can add an opposite wall to cube 2.
I'm very confused and I don't think I've made much sense on this post but I'm really stuck!
Thanks for any help
I'm very confused