# OpenGL Rendering Real Time data

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

## Recommended Posts

Hello, I am having difficulties trying to render big chunks of data in real time. The case is this. A scanner is located above a conveyor belt that is transporting stuff. The scanner takes sweeps of material on the belt and then getting X and Y values of the objects passing through. # / / / / __|-|-|-|___ With current sweepangle, I get about 119 points with X and Y Values every sweep. The conveyor belt is moving with 177 mm/s and the scanner takes 180 sweeps/s. To calculate the Z coordinate for this visualization, I take: 177 mm/s / 180 sweeps/s = roughly 0.98 mm / sweep. To visualize 2 meters of the conveyor belt I need about 2000 sweeps. This results in many points that has to be calculated. I think I calculated it to 238.000 points for every two meter pass. Right now I am using a OpenGL bridge for C# to visualize this. And it is really slow using immediate mode (the only thing i got working with this bridge). Would other solutions like VBO's or Vertex Arrays prove more efficient? This is the way things get rendered now, roughly:
//ArrayList pointsList containing X coordinate and Y coordinate arrays
// method is executed every new sweep.
public void Update(ScannerData data)
{
// sweepbuffer is number of sweeps that will be rendered
while(pointsList.Count < sweepBuffer)
{
// transfer data.getXcoordinate() to pointsList
// transfer data.getYcoordinate() to pointsList

// send pointsList to method that creates all the vertices
}
pointsList.Remove(0); // remove the first sweep X and Y arrays to loop over
again
pointsList.Remove(0);
}



##### Share on other sites
im having trouble visualizing what u want (screenshot may help)
also for the poiunts instead of glBegin()..glEnd();
try with glDrawArrays( GL_POINTS, ... ) if that helps then look into VBOS etc

##### Share on other sites
The data i get from the scanner is rows of X and Y coordinates in mm, like this:

X: 34 45 34 45 34 45 34 143 143 23 45
Y: 9 4 15 42 3 49 23 42 32 32 43 55

That is coordinates for one sweep, generating a 2D graph curve.
To generate a 3D surface of sweeps, I need to collect a bunch of sweeps.
And then calculate the Z coordinate as the length between the sweeps.
And because there is so many sweeps to generate a surface of say 2 meters. That is alot of points.

I can switch between glBegin(GL_POINTS) and glBegin(GL_TRIANGLE_STRIP) in the program. But as I said that is too much information coming and going anyways for it to run smoothly.

And the rendering routine is not that good. Every new sweep I remove the oldest sweep and insert the new one -> then render all the points. Remove the old one insert new -> render all the points.
But I didn't come up with a better way to do it.

One reason to this is cause the Z coordinate to be recalculated, so the surface "stands still" and doesn't "move away" for every sweep that is removed and added.

Rendering loop goes:

- Get sweep data from scanner (integer X and Y coordinates)
- Add to an ArrayList until sweepBuffer is full.
- If full, remove oldes, insert newest sweep.
- Send to function that creates vertices (X,Y,Z) as a struct, points.x points.y
points.z. And also calculates face normals and vertex normals and adds this to the vertex struct.
- Another function uses this struct in glBegin glEnd with appropriate parameter.

This runs everytime the buffer gets full, and another sweep is removed/added.

[Edited by - spirre on June 27, 2006 4:41:43 AM]

##### Share on other sites
I don't understand everything completely, but ... Maybe it's usefull to make a more simple rendering, by reducing the amount of points being used?

Greetings, Michael

1. 1
2. 2
3. 3
frob
12
4. 4
5. 5

• 13
• 14
• 66
• 14
• 15
• ### Forum Statistics

• Total Topics
632130
• Total Posts
3004291

×