Hi, I'm trying to program a surface with opengl evaluators or glunurbs, but this two functions needs a multidimensional array (three dimension) for points. I have my points in three Qvector (one for x, one for y and one for z). When I trying to convert this qvectors to a array i have an error, but i dont know what. The compiler says ok all, but when i run the program, the program exit with no warning. This is the code:
Qt Code:
  1. GLuint GLWidget::makeSurf(const GLfloat *reflectance,QVector<float> x,QVector<float> y,QVector<float> z)
  2. {
  3. float ***points;
  4. int dimx=x.size();
  5. int dimy=y.size();
  6.  
  7. points= new float **[dimx];
  8. for (int i=0;i<dimx;i++){
  9. points[i]=new float *[dimy];
  10. for (int j=0;j<dimy;j++){
  11. points[i][j]=new float[3];
  12. }
  13. }
  14. int cont=0;
  15. for (int ix=0; ix<dimx; ix++){
  16. for (int iy=0; iy<dimy; iy++){
  17. cont++;
  18. points[ix][iy][0]=x[cont];
  19. points[ix][iy][1]=y[cont];
  20. points[ix][iy][2]=z[cont];
  21. }
  22. }
  23.  
  24.  
  25. or this way:
  26.  
  27. points = new float **[dimx];
  28. for(int i=0;i<dimx;i++) {
  29. *(points+i) = new float *[dimy];
  30. for(int j=0;j<dimy;j++){
  31. *(*(points+i)+j) = new float[3];
  32. }
  33. }
  34. int cont=0;
  35. for(int i=0;i<dimx;i++) {
  36. for(int j=0;j<dimy;j++) {
  37. *(*(*(points+i)+j)+0) = x[cont];
  38. *(*(*(points+i)+j)+1) = y[cont];
  39. *(*(*(points+i)+j)+2) = z[cont];
  40. cont++;
  41. }
  42. }
  43. ..........
  44. }
To copy to clipboard, switch view to plain text mode 

Both samples crash. I have check dimension of qvectors and are ok. But exit the programm with no warning.
Need help please.
Thanks