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

Started by
2 comments, last by Sphet 24 years ago
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.
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.
---Ranok---
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

--------> http://www.larswolter.de <---------
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.
---Ranok---

This topic is closed to new replies.

Advertisement