Cannot Convert struct** to const POINT* for argument?
hi everyo开发者_如何转开发ne im using winapi and i want to do a square in 3d im defining the points to unite them with a function and ive been trying 3 functions but i cant make them work i get the same error in the 3 of em >.<
The Error says
In member function `void Cube::Show(void)':|
cannot convert `const Cube::Show()::POINT3D**' to `const POINT*'
for argument `2' to `BOOL Polygon(HDC__*, const POINT*, int)'|
The error is pointing when im using either Polygon function or polybezier or polyline
Plz Any Help would really be appreciated
void Cube::Show(void)
{
typedef struct point3d
{
double x;
double y;
double z;
} POINT3D;
POINT3D Face1[] = {
{ 20.0,-20.0,-20.0},
{-20.0,-20.0,-20.0},
{-20.0, 20.0,-20.0},
{ 20.0, 20.0,-20.0}
};
POINT3D Face2[] = {
{-20.0,-20.0,-20.0},
{-20.0,-20.0, 20.0},
{-20.0, 20.0, 20.0},
{-20.0, 20.0,-20.0}
};
POINT3D Face3[] = {
{ 20.0, 20.0, 20.0},
{-20.0, 20.0, 20.0},
{-20.0,-20.0, 20.0},
{ 20.0,-20.0, 20.0}
};
POINT3D Face4[] = {
{ 20.0,-20.0, 20.0},
{ 20.0,-20.0,-20.0},
{ 20.0, 20.0,-20.0},
{ 20.0, 20.0, 20.0}
};
POINT3D Face5[] = {
{ 20.0,-20.0, 20.0},
{-20.0,-20.0, 20.0},
{-20.0,-20.0,-20.0},
{ 20.0,-20.0,-20.0}
};
POINT3D Face6[] = {
{ 20.0, 20.0,-20.0},
{-20.0, 20.0,-20.0},
{-20.0, 20.0, 20.0},
{ 20.0, 20.0, 20.0}
};
POINT3D *Faces[] = {Face1,Face2,Face3,Face4,Face5,Face6};
Rectangle(this->_hdc,this->DrawArea.left,this->DrawArea.top,this->DrawArea.right,this->DrawArea.bottom);
Polygon(_hdc,Faces,6);
/*BeginPath(_hdc);
PolyBezier(Faces,6);
EndPath(_hdc);*/
//Polyline(_hdc,Faces,6);
}
You're passing in your version of POINT the POINT3D not the POINT from the global namespace. Of the structures are the same just cast. In addition you're passing in an array of arrays not a single array.
So I suggest you revist the API to see what it needs - something like
Polygon(_hdc,((POINT *) (Faces[0])),6) perhaps
Polygon
and the other functions you're trying are 2D GDI functions. They weren't really designed for representing 3D graphics. Of course it's possible to get the desired effect using GDI, but it's sort of the wrong tool if you're going to be doing much 3D work, which it looks like you are.
You might want to look into DirectX or some other framework designed to work with 3D images.
精彩评论