sghr / iGeo

iGeo: Computational Design and 3D Modeling Library for Processing
http://igeo.jp
GNU Lesser General Public License v3.0
146 stars 34 forks source link

BUG: Strange mesh for medium size surfaces #12

Open ivka15 opened 9 years ago

ivka15 commented 9 years ago

While working with data extracted from images I noticed a strange mesh behavior for ISurface. Ouliers occur and the contours flicker. Probably some overflow in the rendering part??? I have isolated the bug to be easily reproducable (see code below). Look at the lower left corner of the generated mesh. It occurs with uSize >= 63 for vSize = 4 and with increasign vSize the uSize threshold for the bug to be visible decreases. Can you please have a look on it and possibly fix it?

int uSize = 63;
int vSize = 4;
IVec4[][] controlPoints = new IVec4[uSize][vSize];

for(int i = 0; i < uSize; ++i)
  for(int j = 0; j < vSize; ++j)
    controlPoints[i][j] = new IVec4(i, i, j); //the bug is also visible for i,i+j,j i,i*j,j i,i/(j+1),j etc. 

new ISurface(controlPoints, 3, 3).clr(1,.5,1);
sghr commented 9 years ago

I tested it with your code and I couldn't observe the flicker. In my experience, I saw 3D display issues depending on graphic cards and settings around them especially after Processing versioned up to 2.0 with the new version of OpenGL. There is a possibility that you might not get the flicker if you use Processing 1.5 with the compiled binary of iGeo for 1.5. It's also possible that the future version of Processing solve the issue. And it's also true there might be a factor indirectly causing this issue in iGeo which I have no idea about right now but if somebody has any clue please let me know.