DGL https://delphigl.com/forum/ |
|
Converting an 2D App in 3D https://delphigl.com/forum/viewtopic.php?f=19&t=5378 |
Seite 1 von 1 |
Autor: | mionut [ So Mär 26, 2006 21:46 ] |
Betreff des Beitrags: | Converting an 2D App in 3D |
Hi, I am developing an vector graphics applicatiion for some time now. The app. displays a vector map loaded from SHP files. I am wondering if it would pe possible to put some 3D features in the mode how the map is displayed on the screen, and I mean, for the start, only a perspective transformation with some blurring. How difficult would it be? I have no experience in 3d graphics or OpenGL. Any advice would be very appreciated. 10x Ionut Muntean |
Autor: | Phobeus [ Mo Mär 27, 2006 09:57 ] |
Betreff des Beitrags: | |
How hard is it to drive a car? Some people say it is easy as breathing some other are learning their whole life ![]() |
Autor: | mionut [ Mo Mär 27, 2006 15:20 ] |
Betreff des Beitrags: | |
Thank you for your response. Question: Is there any Delphi component that emulates a TCanvas but translates any line, lineto, brush, etc. into opengl? I'm asking this because I am using a TCanvas for drawing all 2D maps. I think that if there is such component, I will be able to do a Z axis rotation (perspective) and then add some blurring on the top of the screen. I'm not shure if you are familiar with the way TomTom or Route66 do the drawing of maps on PDA's. Thank's again for your answer. Ionut Muntean |
Autor: | luketheduke [ Mo Mär 27, 2006 15:31 ] |
Betreff des Beitrags: | |
I think I know what you want to do.... Maybe it's enough to write it all to a Tbitmap.canvas and use this Bitmap as a texture on a quad in 3d mode. you can then scale, rotate and translate that quad with the map on it just the way you could with a map on a sheet of paper (well, scaling would have to be shown yet ![]() with glbitmap.pas ( http://dev-center.de, glbitmap.pas ) you can load and bind textures very easily. EDIT: if you want to edit that map in real time, it could get a little bit more difficult... but with todays hardware ti shouldn't be too performance-killing to just edit and rebind it. |
Autor: | Phobeus [ Mo Mär 27, 2006 17:21 ] |
Betreff des Beitrags: | |
Yes, I know TomTom... but I out of my mind I don't know a canvas to opengl component for doing this job and I also think that you will not find much like these in the net. However, a port to opengl should be quite easy as long as you have all points your need to draw. You even can switch opengl into an orthogonal projection mode to simulate something like a 2D canvas. The orgin will be different (opengl orgin is 0/0 in the left bottom, instead of top), but then you should be able to draw lines as easy as you would use a canvas. |
Autor: | mionut [ Mo Mär 27, 2006 23:43 ] |
Betreff des Beitrags: | |
Are there any simple examples for this? I mean examples that shows me how to draw lines, polygons, etc. like I would on a simple tcanvas? Something to start with ... |
Autor: | Phobeus [ Di Mär 28, 2006 11:09 ] |
Betreff des Beitrags: | |
In fact there are quite some documentation, however currently only in german. However, let us try a small example. To get sure you have everything you need: http://files.delphigl.com/Download/dglsdk_2005_2.exe This is our DGLSDK Installer. It installs several common headers you might find interesting (OpenGL Header from us, SDL from the JEDIs, several Texture loader). It also add these headers to the search path of delphi. http://www.delphigl.com/download.php?cat=1 There you find our templates for a really basic opengl init. You will find especially the VCL example usefull: http://www.delphigl.com/do_download.php?f=8 Search there the method ApplicationEventsIdle and replace Code:
Code:
You might to change the arguments of glOrtho. I am not using VCL, but SDL under Linux with a fixed windows size of 800/600. So you might want to set in the size of the forum instead. You should then be able to see a colored line from 0/0 (left bottom) to 100/100 then straight ahead to 200/100. This way you easily could draw lines with opengl in "2D mode". Using GL_QUAD allows to draw filled rectangles even with texture for drawing "images". GL_POLYGON might be intersting if you have to fill out some unconvential area. Just circles are not that easy, cause they are not a shape a 3D card really likes. However, if you a drawing most times lines, triagles or quads, you can greatly benefit from your 3D card. Also notice our (old) template for using two render context: http://www.delphigl.com/do_download.php?f=3333 You might find it usefull, if you need two viewports on your frame. Also notice that there is shown how you could use a panel as opengl viewport instead of the whole form. Hope this helps a little bit. |
Seite 1 von 1 | Alle Zeiten sind UTC + 1 Stunde |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |