I have defined a polygon :
And to display it, something like this :
I found the code in an example program. How to combine those to display the polygon first created? I cant get it to work...
Code:
POINT point_Model00[] = {
POStoFIXED(-50.0000,-50.0000,-50.0000),
POStoFIXED( 50.0000,-50.0000,-50.0000),
POStoFIXED( 50.0000, 50.0000,-50.0000),
POStoFIXED(-50.0000, 50.0000,-50.0000),
POStoFIXED(-50.0000,-50.0000, 50.0000),
POStoFIXED( 50.0000,-50.0000, 50.0000),
POStoFIXED( 50.0000, 50.0000, 50.0000),
POStoFIXED(-50.0000, 50.0000, 50.0000),
};
POLYGON polygon_Model00[] = {
NORMAL( 0.0000, 0.0000, -1.0000), VERTICES( 0, 1, 2, 3),
NORMAL( 1.0000, 0.0000, 0.0000), VERTICES( 1, 5, 6, 2),
NORMAL( 0.0000, 0.0000, 1.0000), VERTICES( 5, 4, 7, 6),
NORMAL( -1.0000, 0.0000, 0.0000), VERTICES( 4, 0, 3, 7),
NORMAL( 0.0000, -1.0000, 0.0000), VERTICES( 0, 4, 5, 1),
NORMAL( 0.0000, 1.0000, 0.0000), VERTICES( 2, 6, 7, 3),
};
ATTR attribute_Model00[] = {
ATTRIBUTE(Single_Plane, SORT_CEN, No_Texture, C_RGB( 0,31, 0), No_Gouraud, CL32KRGB|MESHoff, sprPolygon, UseLight),
ATTRIBUTE(Single_Plane, SORT_CEN, No_Texture, C_RGB( 0,31, 0), No_Gouraud, CL32KRGB|MESHoff, sprPolygon, UseLight),
ATTRIBUTE(Single_Plane, SORT_CEN, No_Texture, C_RGB( 0,31, 0), No_Gouraud, CL32KRGB|MESHoff, sprPolygon, UseLight),
ATTRIBUTE(Single_Plane, SORT_CEN, No_Texture, C_RGB( 0,31, 0), No_Gouraud, CL32KRGB|MESHoff, sprPolygon, UseLight),
ATTRIBUTE(Single_Plane, SORT_CEN, No_Texture, C_RGB( 0,31, 0), No_Gouraud, CL32KRGB|MESHoff, sprPolygon, UseLight),
ATTRIBUTE(Single_Plane, SORT_CEN, No_Texture, C_RGB( 0,31, 0), No_Gouraud, CL32KRGB|MESHoff, sprPolygon, UseLight),
};
XPDATA xpdata_Model00[] = {
point_Model00, sizeof(point_Model00)/sizeof(POINT),
polygon_Model00, sizeof(polygon_Model00)/sizeof(POLYGON),
attribute_Model00,
NULL,
};
/*
* OBJECTS = 1
*/
OBJECT object_Model00[] = {
(PDATA*)xpdata_Model00,
TRANSLATION( 0.0000, 0.0000, 0.0000),
ROTATION( 0.0000, 0.0000, 0.0000),
SCALING( 1.0000, 1.0000, 1.0000),
NULL,
NULL,
};
And to display it, something like this :
Code:
void ss_main(void)
{
static ANGLE ang[XYZ];
static FIXED pos[XYZ];
static FIXED light[XYZ];
slInitSystem(TV_320x224, NULL, 1);
ang[X]=ang[Y]=DEGtoANG(30.0);
ang[Z]=DEGtoANG(60.0);
pos[X]=toFIXED(0.0);
pos[Y]=toFIXED(0.0);
pos[Z]=toFIXED(220.0);
light[X]=toFIXED(0.0);
light[Y]=light[Z]=toFIXED(-60.0);
I found the code in an example program. How to combine those to display the polygon first created? I cant get it to work...