现在有一组数组
double CFiles::Translateto3D()
{
coordinates[0]=p[0]*x_scale_factor+x_offset;
coordinates[1]=p[1]*y_scale_factor+y_offset;
coordinates[2]=p[2]*z_scale_factor+z_offset;
return coordinates[3];
}
想向另一个函数glVertex3fv()作为参数传递
应该怎么写呢?
double CFiles::Translateto3D()
{
coordinates[0]=p[0]*x_scale_factor+x_offset;
coordinates[1]=p[1]*y_scale_factor+y_offset;
coordinates[2]=p[2]*z_scale_factor+z_offset;
return coordinates[3];
}
想向另一个函数glVertex3fv()作为参数传递
应该怎么写呢?
glVertex3fv(void*p)
double CFiles::Translateto3D()
{
coordinates[0]=p[0]*x_scale_factor+x_offset;
coordinates[1]=p[1]*y_scale_factor+y_offset;
coordinates[2]=p[2]*z_scale_factor+z_offset;
return coordinates[3];
}
想向另一个函数glVertex3fv()作为参数传递
应该怎么写呢?
首先double CFiles::Translateto3D()这个函数只能返回coordinates[3]这一个值,不能返回整个数组,而且coordinates[3]是下标越界
glVertex3fv(type *p)type根据你的需要来定
{
for(int i=0;i<3;i++)
int a[i] = *(p+i);
}
应该没错吧!
有错误的话欢迎指正