10 million points in P3D mode?
in
Programming Questions
•
9 months ago
Hi all,
I am new to processing and programming in general, so forgive if something silly comes out of me!
I've got a sketch importing points coordinates from .csv file and plotting them in P3D mode.
It kind of works, but I know there are some major issues with code. I'd like it to be a bit more efficient on GPU side. I have read a few threads about VOBs and GLGraphics library, and them being helpful in such situations:) However, I have no idea where to start to implement that in my sketch, and whether it is suitable in P3D mode.
Thats what i got so far, any help much appreciated:
- //*** GLOBAL VARIABLES ***
- //-----------------------------------------------------------------------------*/
- ArrayList pointList; // arraylist to store the points in
- /*** GLOBAL INIT ***
- -----------------------------------------------------------------------------*/
- void setup(){
- //-------------------------------- GENERAL
- size(1600,900,P3D);
- background(0);
- //-------------------------------- POINTS
- pointList = new ArrayList(); // instantiate an ArrayList
- importTextFile(); // call our custom function
- }
- /*-----------------------------------------------------------------------------
- *** MAIN PROGRAM LOOP ***
- -----------------------------------------------------------------------------*/
- void draw(){
- //-------------------------------- GENERAL
- background(0);
- stroke(210);
- fill(210,90);
- //-------------------------------- CAMERA TEST
- camera(mouseX, height/2, (height/2) / tan(PI/6), mouseX, height/2, 0, 0, 1, 0);
- //-------------------------------- VISUALIZE THE POINT SET
- for(int i = 0; i < pointList.size(); ++i){
- PVector V = (PVector) pointList.get(i);
- point(V.x,V.y,V.z);
- }
- }
- /*-----------------------------------------------------------------------------
- *** CUSTOM IMPORT FUNCTION ***
- -----------------------------------------------------------------------------*/
- void importTextFile(){
- String[] strLines = loadStrings("primetest02.csv"); // the name and extension of the file to import!
- for(int i = 0; i < strLines.length; ++i){
- String[] arrTokens = split(strLines[i], ';'); // use the split array with character to isolate each component
- float xx = float(arrTokens[0]) * 100; // cast string value to a float values!
- float yy = float(arrTokens[1]) * 100; // cast string value to a float values!
- float zz = float(arrTokens[2]) * 100; // cast string value to a float values!
- pointList.add( new PVector(xx,yy,zz) ); // add values to a new array slot
- }
- }
1