zorro68
15th February 2007, 02:25
Im trying to make a bezier surface. I read points from a file and then use and evaluator to print the surface. I have read some samples (red book or blue book and some links - all use the same sample) that works fine if the points definition is into the main program. But if i want to programm a class with this phylosopy, dont work:
class GLWidget : public QGLWidget
{
...
private:
GLuint makeSurf(const GLfloat *reflectance, GLfloat ***points);
GLfloat ***ctrlpoints;
...
GLWidget::GLWidget(QWidget *parent)
: QGLWidget(parent)
{
...
//ctrlpoints = new (GLfloat **);
GLfloat ctrlpoints[4][4][3]= <- this crash
{
{
{-1.5, -1.5, 4.0},
{-0.5, -1.5, 2.0},
{0.5, -1.5, -1.0},
{1.5, -1.5, 2.0}},
{
{-1.5, -0.5, 1.0},
{-0.5, -0.5, 3.0},
{0.5, -0.5, 0.0},
{1.5, -0.5, -1.0}},
{
{-1.5, 0.5, 4.0},
{-0.5, 0.5, 0.0},
{0.5, 0.5, 3.0},
{1.5, 0.5, 4.0}},
{
{-1.5, 1.5, -2.0},
{-0.5, 1.5, -2.0},
{0.5, 1.5, 0.0},
{1.5, 1.5, -1.0}}
};
...
void GLWidget::initializeGL()
{
....
surf1=makeSurf(reflectance3,&ctrlpoints[0][0][0]); <- this crash too
....
GLuint GLWidget::makeSurf(const GLfloat *reflectance, GLfloat ***points)
{
...
glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, &points[0][0][0]);
...
The problem is how to define a pointer dinamically with 3 indexes (¿[][][]->***?) in a class...
I hope you understand me.
Some help please :confused:
class GLWidget : public QGLWidget
{
...
private:
GLuint makeSurf(const GLfloat *reflectance, GLfloat ***points);
GLfloat ***ctrlpoints;
...
GLWidget::GLWidget(QWidget *parent)
: QGLWidget(parent)
{
...
//ctrlpoints = new (GLfloat **);
GLfloat ctrlpoints[4][4][3]= <- this crash
{
{
{-1.5, -1.5, 4.0},
{-0.5, -1.5, 2.0},
{0.5, -1.5, -1.0},
{1.5, -1.5, 2.0}},
{
{-1.5, -0.5, 1.0},
{-0.5, -0.5, 3.0},
{0.5, -0.5, 0.0},
{1.5, -0.5, -1.0}},
{
{-1.5, 0.5, 4.0},
{-0.5, 0.5, 0.0},
{0.5, 0.5, 3.0},
{1.5, 0.5, 4.0}},
{
{-1.5, 1.5, -2.0},
{-0.5, 1.5, -2.0},
{0.5, 1.5, 0.0},
{1.5, 1.5, -1.0}}
};
...
void GLWidget::initializeGL()
{
....
surf1=makeSurf(reflectance3,&ctrlpoints[0][0][0]); <- this crash too
....
GLuint GLWidget::makeSurf(const GLfloat *reflectance, GLfloat ***points)
{
...
glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, &points[0][0][0]);
...
The problem is how to define a pointer dinamically with 3 indexes (¿[][][]->***?) in a class...
I hope you understand me.
Some help please :confused: