Real Software Forums

OpenGL Class #5 - Mesh (Open Source)
Page 2 of 2

Author:  Notoobrite [ Sun Jun 06, 2010 3:40 pm ]
Post subject:  Re: OpenGL Class #5 - Mesh (Open Source)

Hi, I'm a newbie to RB as well as OpenGL. The project I am working on is to create a 3D environment using OpenGL and then importing GPS points into a matrix which will then allow a mesh or surface to cover these point (assuming 3 or more points) and hereby creating a bit of a topographic landscape. Later on I would like to partition/divide the landscape into blocks which can be interactively selected.... Either way, I'd appreciate it if you could help and guide me a bit on how to start off using this plugin.... Step-by-step example code would be much appreciated... :)


Author:  Blake [ Tue Jun 08, 2010 11:08 am ]
Post subject:  Re: OpenGL Class #5 - Mesh (Open Source)

It is not a plug-in, it is a set of classes that work with RB's built-in functionality. First you need to import (or drag and drop) the OpenGLCore Module, the OpenGLMesh, OpenGLMatrix and OpenGLVector3D classes into your project. Then to create a new mesh you would add a Mesh property to your window and add the following code in the open event:
Mesh = New OpenGLMesh()

Mesh.VertexCount = GPSPositionCount ' number of 'points' you have in your mesh

For i = 0 To GPSPositionCount - 1
Mesh.Vertex( i ) = New OpenGLVector( GPSPosition( i ).X, GPSPosition( i ).Y, GPSPosition( i ).Z )

Then add an OpenGLSurface to your window and put the following code in your render event.

Now you may not see anything unless you have your camera set up, if you don't have it set up import the OpenGLCamera class, add a Camera property to your window. In the the Open event of the window add:
Camera = New OpenGLCamera()
Camera.Position.X = 5
Camera.Position.Y = 10
Camera.Position.Z = 15
Camera.Pitch = 45
Camera.PerspectiveAngle = 45

And for your OpenGLSurface rendering code it should look like this:

To move the camera around just change its Position (X,Y,Z) values with the keydown event.

Author:  eugenedakin [ Sat Nov 03, 2012 1:27 pm ]
Post subject:  Re: OpenGL Class #5 - Mesh (Open Source)

Hello Everyone,

Although this is a great example, this file throws errors in Real Studio 2012 r1.2 on a Windows 8 machine.



Page 2 of 2 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group