PDA

View Full Version : Help creating spheres with coordinates?



idistrust
03-09-2003, 05:08 PM
Hi there.

I'm having a problem. I'm trying to create a sphere, but I want to specify the coordinates, and I can't seem to figure out how to do it. Any suggestions?

I have abused every search engine I know of, but with no results.

Here's the big picture. I am trying to model particles in a system, and I have a data file with all of the coordinates of the particles at various points in time. So, I need to draw several hundred (thousand, million) tiny spheres, and be able to specify WHERE they're located at each time step.

Any suggestions would be much appreciated,
M.

Miguel_dup1
03-09-2003, 06:10 PM
I wrote a skydome algorithm and since a sky dome is only half a sphere, the other half you can draw by negating the Y values of the coordinate data you have... Take a look at my algorithm and you will see how you can generate the coordinates for a sphere...
http://cheo.resnet.wayne.edu/miguel/


Miguel Castillo


Originally posted by idistrust:
Hi there.

I'm having a problem. I'm trying to create a sphere, but I want to specify the coordinates, and I can't seem to figure out how to do it. Any suggestions?

I have abused every search engine I know of, but with no results.

Here's the big picture. I am trying to model particles in a system, and I have a data file with all of the coordinates of the particles at various points in time. So, I need to draw several hundred (thousand, million) tiny spheres, and be able to specify WHERE they're located at each time step.

Any suggestions would be much appreciated,
M.

fringe
03-11-2003, 01:46 AM
Hi,

I would create a display list in which a sphere is drawn, then

for (int i=0;i<number_of_points;i++)
{
glPushMatrix();
glTranslate3f(sphere_coord[i].x,.y, .z);
glCallList(spherelist);
glPopMatrix();
}

not sure whether this is completely right I am just a begineer,

fringe

[This message has been edited by fringe (edited 03-11-2003).]

mikael_aronsson
03-11-2003, 02:02 AM
Hi !

Wouldn't it be a waste to draw thousands of spheres ?, if you need that many I think you could get the same result by drawing antialiased GL_POINTS, just an idea.

Mikael