Jump to content

Drawing of 3D Lines


Shard
 Share

Recommended Posts

This is a fairly complicated question so I hope I present it correctly.

 

I am looking to draw the orbit of planets for my solar system simulation and I'm not sure how to go about it.

 

Last time I tried this (with DarkGDK) I drew several spheres to show the line of the orbit, which then looked correct when viewed from a distance, but was very inefficient.

 

As far as the orbit code goes, I will figure that out using code (which in theory will give me a mathematical function) for what the orbit is. I am hoping I can use this in some way so that I can draw the orbit of the planets using 2D drawing to the screen.

 

 

Does anyone have any suggestions of how to do this?

simpleSigPNG.png

 

Programmer/Engineer/Student

www.reikumar.com

 

2.6 GHz Intel Core Duo - nVidia GeForce 8600 GT - Windows 7 64-bit - 4 Gigs RAM

C++ - Visual Studio Express - Dark GDK - Leadwerks SDK

Link to comment
Share on other sites

You don't need to use 2D drawing, but you can use 3D lines to connect real vertices with lines:

http://leadwerks.com/werkspace/index.php?/page/resources/_/programming/cpp/using-opengl-for-drawing-r19

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

Glancing over the code in that tutorial it may be fairly complicated although it has a far wider use. A perhaps somewhat easier solution would be to simply render a plane with a transparent texture that has an opaque circle on it and then scaling the plane to represent the correct orbit.

Link to comment
Share on other sites

Glancing over the code in that tutorial it may be fairly complicated although it has a far wider use. A perhaps somewhat easier solution would be to simply render a plane with a transparent texture that has an opaque circle on it and then scaling the plane to represent the correct orbit.

 

This doesn't quite work.

 

Because the orbits are based off of the gravitational pulls from the planets around it and the user will have the ability to move planets around, the orbit could be a perfect circle, an oval or not a shape at all and instead just a line.

simpleSigPNG.png

 

Programmer/Engineer/Student

www.reikumar.com

 

2.6 GHz Intel Core Duo - nVidia GeForce 8600 GT - Windows 7 64-bit - 4 Gigs RAM

C++ - Visual Studio Express - Dark GDK - Leadwerks SDK

Link to comment
Share on other sites

You don't need to use 2D drawing, but you can use 3D lines to connect real vertices with lines:

http://leadwerks.com/werkspace/index.php?/page/resources/_/programming/cpp/using-opengl-for-drawing-r19

 

 

Just glancing at it, this seems a little bit complicated. But alas, I do need it so I'll have to put some time into learning how to do it.

I suppose I'll just make a wrapper of sorts and tie it in with my sim initialization/drawing methods.

simpleSigPNG.png

 

Programmer/Engineer/Student

www.reikumar.com

 

2.6 GHz Intel Core Duo - nVidia GeForce 8600 GT - Windows 7 64-bit - 4 Gigs RAM

C++ - Visual Studio Express - Dark GDK - Leadwerks SDK

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...