Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Sphet

OpenGL Unusual use of Direct3D and OpenGL: Can I do this?

This topic is 6686 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a program I am working on where I want to draw a number of interconnecting nodes at any scale. The nodes are connected using colored lines and the nodes themselves are drawn as sprites. I was thinking of using Direct3D for this since it would make drawing all the interconnecting lines fast and I could colour the lines using the hardware. My questions are these: 1. Do I have to draw my points as triangles, or can I just do line segments from vertex 1 to vertex 2? 2. Is there a platform independent API I could use for this? 3. Is this going to be faster then just locking a surface, using my own line drawing routines, then blitting the sprites ontop? 4. How would I do the sprites? As textured quads, right? Any thoughts on this would be great.

Share this post


Link to post
Share on other sites
Advertisement
1). You can just draw lines if you want.
2). OpenGL is Platform Independent
3). If there is hardware support it will be faster.
4). Yup, textured quads.

Note: I don''t know if this is what you were thinking of, but if you are going to use 3D you could have your nodes positioned in 3D space and could then use billboarding to draw the sprites always facing the user, and then draw the lines from each node to all connected nodes. By doing this you could have it so the user can rotate, zoom in, "fly" through your node connections to see what is connected to what. I think that this would be pretty cool.

Share this post


Link to post
Share on other sites
Hi

1. No There Drawing Functions for Lines

2. OpenGL is more independent then D3D (in some ways, cause you need to compile it on every Platform ).Maybe Java3D, it exists with OpenGL Support, and isn''t that slow.

3. Depends on the Number of Lines, if you wan''t 10 Lines, use standard GDI, if you wan''t 1.000 try D3D

4. yes, or just blitting ( you can combine those things in D3D ). But you have Special Effects like Transparency, free rotating and so on, when using Quads.

Lars

Share this post


Link to post
Share on other sites
You can draw line segments in OpenGL with something like this:

glBegin( GL_LINES );
[Vertex Pairs for each line segment]
glEnd();

This treats each pair of vertices as an independent line segment. Vertices 2n – 1 and 2n define line n. N/2 lines are drawn.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!