Mikaran We can therefore simply say this:. In the GLScene component add a cube, a plane floora lightsource and a camera. Blscene Newton-GLScene binding based on Tag and User Data previously described will be very usefull here, since you will be able to write UpdateGraphicObject callback in a generic way, retrieving the graphical object to be updated from the body passed to it. These parameters are controlled by the newton body matrix. Glscenr Templates Work In Progress.
|Published (Last):||21 January 2012|
|PDF File Size:||17.38 Mb|
|ePub File Size:||16.65 Mb|
|Price:||Free* [*Free Regsitration Required]|
We are ready to take our first steps into the 3D openGL universe. In GLScene the universe or 3D world is called a scene. Hence the name. We are going to create our first application that will contain a 3D cube.
We will learn how to start a basic GLScene application and how to control the layout by manipulating the design time properties. The TGLSene is the master of the scene. Everything that happens is managed through the TGLScene control. Lets introduce you to the most important dialog in GLScene. The scene editor. Right click on the TGLScene editor icon on the form and select Show scene As a result the scene editor dialog will appear.
The world managed by TGLScene is still a blank canvas. You can add objects such as shapes, cameras and lights to build your world in this editor. Lets start by adding a 3D cube to the scene. Right click on Scene Objects and select a Cube from Basic geometry You can see there are a lot of objects you can choose from. Leave those for what they are for now. We will visit other objects later in the tutorial. The popup menu will collapse once you click on the the scene.
Cube object. The cube is now added to Lets close the scene editor and check out wat we see. Why cant you see the cube? Well that would be correct. There is a whole bunch of things that need to be considered before you will see anything. In the previous topic you build a GLScene application but so far you could not see any results. Well in order for you to see anything at all you will need to create a way to view the scene. This is done using a camera. We are now going to add a camera to the scene.
Need to know The scene editor doesnt always know where you click on. A work around is to select any other node in the editor and then select the node you want. Only then will the object inspector F10 and the context popup menu be correct. Left click on Left click on "Scene objects" to make that option active "Cameras" to make that option active This weird toggle action will sort out the Scene editor if it gets confused.
Use this trick whenever the object inspector or context menu fails to show the correct information. Open the scene editor again. Right click on the TGLScene form and select Show scene editor Right click on Cameras and select Add camera icon on the You now have a camera but dont bother to go and check out your creation on the form.
There is still nothing there! Need to know Every new object that is created is always placed in the center of the scene by default. So you can see that the camera occupies the same space as the cube. Besides the camera points at some default direction and chances are that it is not pointing to the cube anyway. Well that is easy to fix. We are going to tell the camera to look at the cube Select GLCamera1 and press F10 to bring up the object inspector.
In the object inspector you will see the camera properties. Still the GLSceneViewer wont show anything. The main reason for this is that the viewer has not yet been told for which camera it should display a view. In GLScene you can have multiple cameras and you can switch your view from one camera to another. This property defines wich camera should be used to render the 3D view for the viewer. Lets summarize what we have done and see if we can identify what we have missed. We created a cube and a camera.
We told the camera to look at the cube. We told the viewer to use camera1. However, we never told the camera and cube where to go! The camera is located in exactly the same spot as the cube so basically were too close to see anything at all. For now lets just get this thing working. After that we need to spend some time to talk about 3D coordinates. It looks pretty bad but at least its something right?
What you see is the silhouette of a 3D cube as seen from an angle. It is all black because There are no lights! Every scene needs lights. Without lights you cant see anything.
So lets add a light. The new light is added to the center of the scene and in our case the light would end up in the inside of the cube. We need to move the light up to get it out of the cube. Select the new light in the scene editor and press F10 to bring up the object inspector. Change the position of the light as shown below. And finally the cube is shown in all its glory.
Congratulations you have mastered the very basics of GLScene. We told the viewer to use our new camera. We made the camera look at the cube and placed the camera away from the cube so it can look at it. We added a light and placed it above the cube and presto we are done! Although we have achieved to display a 3D object in Delphi, we need to be able to manipulate the object in 3D space. Gain control so to speak. Save this project and name it "glscenebase. You will find that it will come in handy every time you want to try something.
Also you will need this project for the next tutorial. The Control Objects tutorial will teach you how to control objects in space. Control Objects So we know how to move thing around in 3D space but we still need to learn how to manage their orientation.
So far we have explained every step in detail. Before we continue we will list knowledge we assume from now on. Now we have a 3D cube in a viewer we can start messing around with the cubes position. The coordinate system in GLScene uses three axis that are perpendicular to each other. The manage placement in X, Y and Z direction. Lets illustrate this by turning on the Show Axis property of the cube. The three axis you see here are the X, Y and Z axis. We call this system of coordinates a coordinate system.
Now here is where things may become confusing: Every object has its own coordinate system! For now just accept this as a fact. Later you will find out the incredible power that can be gained from having this feature.
By default objects created in GLScene have a size of 1 unit. Therefore the cube is 1 unit wide, 1 unit height and 1 unit deep. You may wonder how large a unit is but in our 3D world a unit is whatever you want it to be as long as you are consistent.
A unit can be an inch, a furlong, a centimeter or the length of your little pinky. Lets move the cube along the x axis by changing the position. This should move the cube along the red X axis by exactly the width of the cube. Set the Position. Well the cube moved along the X axis as intended but the camera is programmed to keep looking at GLCube1. So the camera turned to follow GLCube1 and the above image is the result. We need to give the camera a fixed reference that does not move.
A quick and easy way is to use another object that stays in place while the cube moves around. Introducing the Dummy cube. This cube can be seen during design-time as a wireframe cube but is not rendered during run-time. The cube however is still very much part of the object structure.
Oh no! Some styles failed to load. 😵
PP4S: Sources of Help for GLScene Download an example project here: If you want to apply a force on a arbitrary point on the body we need to rewrite it as a equivalent force and torque system acting at the CoB. This way, the same callback can be used for any object sharing the same physical behaviour. Help File and Source Code The help file has been generated automatically by PasDocso depended on the depth of commenting in the source. Since the help file is hyperlinked, it is much quicker to use than inspecting the source directly. Finally the DummyCube is also commonly used as Camera Target with the Camera a child of its target dummy cube or vice-versa.
We are ready to take our first steps into the 3D openGL universe. In GLScene the universe or 3D world is called a scene. Hence the name. We are going to create our first application that will contain a 3D cube. We will learn how to start a basic GLScene application and how to control the layout by manipulating the design time properties. The TGLSene is the master of the scene. Everything that happens is managed through the TGLScene control.
GLSCENE - User Tutorial
Aber schon die Installation ist so komplex, dass einige daran scheitern. Ich habe auch eine Weile ca. Dann sollten Strukturen wie diese hier entstehen Das Formular ist ja ganz leer! Nun, anscheinend ist die Initialisierung doch nicht so einfach. Es folgt ein Rechtsklick auf Cameras und dann auf Add Camera. Schon ist die Kamera in unserer Szene implementiert.