TT logo
You are viewing a low-graphics version of this page. Click the headline to view full version:

OpenGL - graphics programming

Technical help

Toytown Germany > Discussion forum > Themes > Miscellaneous
the Boy From Bozlem
Ok so I’m about to start on a little project and I’m thinking of using openGL. I have no experience of using it but hey what the hell.

What I need to be able to do is draw a simple 2D map of the world and add some collision detection to it regarding land and boats.

So my questions are:

Can I achieve this using openGL? (I’m guessing I can)
Is openGL the way to go?
Any other options?

cheers
TBFB
boomtown_rat
I thought OpenGL was more for 3D stuff, but I guess you could use it for 2D things too.
Inflatablewoman
Dangeross is your man. His FYP was something similar to this.
Tom17
Well, certainly with DirectX, there are various different components. Namely DirectDraw and Direct3D. In this case, DirectDraw would be great for this kind of thing.

But I am not sure if there is a similar seperation of different parts of OpenGL liek there is for DirectX. I can only assume there is, so this would be a fine thing to do.
the Boy From Bozlem
QUOTE (boomtown_rat @ Aug 7 2006, 10:32 am) *
I thought OpenGL was more for 3D stuff, but I guess you could use it for 2D things too.

Cool that means I would have an extra D to play around with, you never know when it will come in handy wink.gif lol

TBH im just trying to get some views on which would be the best option to take before I invest the time in learning.
theLSB
For 2D you don't need OpenGL.
You'd be wise to use a GUI toolkit for that.
I can recommend Qt from trolltech (www.trolltech.com).
The advantage of Qt are:
- crossplatform (your code will compile on all platforms supported by Qt, which are most of what there is, windows, linux and OSX are ofcourse supported).
- dual license scheme - GPL (full version) and commercial. (so if this is not commercial you can use it for free)
- Very appropriate and well suited to the kind of task you described.
(has 2D graphic classes with collision detection built in)
- Very easy to code, uses a very comfortable signal/slot mechanism
- Very good documentation.
- Large and active community

I have lots of experience with it, you cna PM if you have more questions.

(I am just a satisfied Qt user, I have no connections with TrollTech rolleyes.gif )
the Boy From Bozlem
many thanks LSB, i will have a look at it when i get home.
Mr.Mosh
You can easily do what you want to achieve with OpenGL. it even offers built in "collision detection" functions, but seeing as you are want to do it in 2D you only really need the mouse pointer position.
If you have any more specific questions, you can PM me. I know my way around OpenGL and DirectX quite well.
Check out SDL too, which is a layer on top of OpenGL that facilitates many things (and is also cross platform).

and as theLSB said, QT is pretty damn good too.
the Boy From Bozlem
Morning biggrin.gif

Ok so I can create a basic window, change colours, draw lines, polygons, etc, etc.

What would be really handy for me is if I were able to set the coordinate system used to a range of my own (for example 0 to 360 and 0 to 180 to represent latitude and longitude) I guess that would be –180 to 180 and - 90 to 90 or the other way around lol.

Is this possible? (I’m sure it must be)

Come to think of it due to the curve of the earth etc etc etc …. when looking at a Mercator projection there is a stretch between lines of latitude so the ‘distance’ from 75n to 60n appears bigger than that from 60n to 45n (see pic). So is it possible to set this up? If not then I can add some code to do the stretch so an answer to the first part of this post is just as valuable.



Hope this makes sense to someone out there lol.

Any other advice on openGL, projections or coordinate systems is greatly appreciated.

TBFB
theLSB
TBFB,

I am not sure EXACTLY what you are up to, but it is VERY similar to a thing I need to do.
I am working on an application that on its gui, willo have a widget that shows a GPS location on a map.
I am going to realize it in QT though...
However, the math is the same, maybe we can collaborate...
I searched a bit about this, there are ready made libs (free or GPL) that do various conversions of coordinates (which is basically matrix transformations), including the calculation with the earth curvature etc...
(there are even libs that take two GPS coords and spit out relational info such as azimuth and distance)
If you search software for HAM radio amateurs you will find quite a lot...

If you like, PM me, and we can see how we can help each other... smile.gif

Cheers.
You are viewing a low fidelity version of this page. Click to view the full page.