GLfloat ***controlPoints = new GLfloat**[1];
//Set up the array of control points.
for (j = 0; j < 6; ++j)
{
**controlPoints[j] = new GLfloat*[6];
for (i = 0; i < 3; ++i)
*controlPoints[j][i] = new GLfloat[3];
}
Notice you cannot dereference when you haven't allocated - which means the
data types above are not correct in all places. Also remember that the []
implicitly dereferences. So the *'s in front on controlPoints are not always
necessary:
controlPoints[j] = new GLfloat*[6]; //controlPoints[j] is a pointer to a
pointer to a GLfloat
controlPoints[j][i] = new GLfloat[3]; //conotrolPoints[j][i] is a pointer to
a GLfloat
--
You received this message because you are subscribed to the Google Groups
"PSUComputerGraphics" group.
To post to this group, send email to psucomput...@googlegroups.com.
To unsubscribe from this group, send email to
psucomputergrap...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/psucomputergraphics?hl=en.
-----Original Message-----
From: psucomput...@googlegroups.com
[mailto:psucomput...@googlegroups.com] On Behalf Of komplikaded
Sent: Tuesday, July 20, 2010 4:33 PM
To: PSUComputerGraphics
Subject: Re: [PSUComputerGraphics] Dynamically allocating a 3-D GLfloat
array.
Thanks. I worked past that hurdle. Now I'm getting a core dump when I try
to map the points in OpenGL. I already put cout statements as I'm drawing
the points, so I know that OpenGL drew the points (unless there's some way
OpenGL gives an error if I pass in incorrect arguments? I'm passing in
pointers instead of a static array). Any idea why glMap2f would give a core
dump?
glMap2f(GL_MAP2_VERTEX_3,
0.0f,
10.0f,
3,
3,
0.0f,
10.0f,
9.0f,
3.0f,
&controlPoints[0][0][0]
);