I've been teaching myself OpenGL in Delphi XE2, and am having some difficulties learning the main concepts which I need to know. I've started a project wrapping OpenGL into a control and while I can get it to draw, I lack the knowledge to really do something with it. I don't want to use any third-party libraries such as GLScene because this project is intended for me to learn lower-level coding.
What I'm trying to do is simply draw a ground with buildings, and be able to move around this virtual 'city'. No special drawing necessary like textures, just a flat surface for a ground and a grid of square shaped towers. User shall be able to move down the streets from building to building.
What I have done with this control is made a common list of items, where I have a base class `TGLItem` which a number of inherited objects are made, such as `TGLGround` and `TGLBuilding`. These items are added to this list and when the control draws, it iterates through this list and calls the `Draw` procedure for each item. The inherited items then draw their image to the control.
The problems I'm facing is how to keep the ground still, and not rotate it when I rotate the objects. I need to know how to move the camera around on the X/Y/Z axis, as well as rotate the camera up/down/right/left. `TGLCamera` is a class which controls the position of the camera.
With the code I have in the attachment, how do I make this work properly? Comments are in the code where I need help.
Currently, I cannot even get it to lay the ground flat and draw 1 building. Each of these items has a `Position` property as well as a `Direction` property. Position defines where the item is placed, and Direction defines how it is rotated. Each of those properties has 3 properties for X/Y/Z.
The sample application has buttons on the top - currently only the 'Triangle' buttons do anything, the camera buttons haven't been implemented yet. This is what I need help with, how to actually draw this thing correctly and how to move the camera around through it. Each item (ground and buildings) is created as an object declared in the main form's private section (FGround, FBldg1, FBldg2, etc.) and as soon as they're created, they add themselves to a list inside the control. The control then recognizes these items and draws them in a loop.
uMain.pas / uMain.dfm = main form
GLCtrls.pas = main class for my custom control
GLGround.pas = item for drawing ground
GLBuilding.pas = item for drawing a building
GLTri.pas = item for drawing a triangular object
[The triangle comes from the original tutorial I went through to get this far in the first place]
Someone please help, I'm so lost in this thing. As long as I can get the ground and buildings working right, I can learn the rest.