We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › cannot create 3d grid in P3D mode
Page Index Toggle Pages: 1
cannot create 3d grid in P3D mode (Read 250 times)
cannot create 3d grid in P3D mode
Aug 25th, 2008, 7:07pm
 
Hi,
I have a problem to create a 3d grid in P3D mode. the script as follow;

void drawGrid () {
//**drawing grid**
beginRaw(DXF, "confGrid.dxf");
stroke(255, 255, 0);
 for (int k =0; k < GSIZE[2]; k++) { //Z direction
  for (int i = 0; i < GSIZE[0]; i++) { //hor. direction
   line(minX + i * cellx,   minY,   minZ + k * cellz,     minX + i * cellx,   maxY,   minZ + k * cellz);}
     
 for (int j = 0; j < GSIZE[1]; j++) { //=vert.direction
   line(minX,   minY + j * celly,   minZ + k * cellz, maxX,   minY + j * celly,   minZ + k * cellz);}
 }
   
 for (int p = 0; p < GSIZE[1]; p++) {
    for (int q= 0; q < GSIZE[0]; q++) {
      line(minX + q * cellx,   minY + p * celly,   minZ, minX + q * cellx,   minY + p * celly, maxZ);
     }
   }
endRaw();  
}

Basically, it only consists of lines in 3 direction. unforunately, I only can export them in Opengl mode to dxf format with a minor shifting (275 units in X and Y axis, -476.3 units in Z axis). In P3D mode, the dxf file only have one level of grid.

Can anyone give advice ? many thanks.

BTW, I can display the ortho or camera view in P3D mode, but after change to opengl, it appears blank screen with only background colour. I have loaded the opengl library in the first line of my script and also define the parameter in size() function.

Thank again anyway.
Rick
Page Index Toggle Pages: 1