Here is some code for displaying a polygon :
Why won´t it work? Could someone help me woth fixing this code so it displays the polygon ive created?
Code:
#include "sgl.h"
POINT point_poly1[] = {
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_poly1[] = {
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_poly1[] = {
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_poly1[] = {
point_Model00, sizeof(point_Model00)/sizeof(POINT),
polygon_Model00, sizeof(polygon_Model00)/sizeof(POLYGON),
attribute_Model00,
NULL,
};
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,
};
void ss_main(void)
{
static ANGLE ang[XYZ];
static FIXED pos[XYZ];
static FIXED light[XYZ];
slInitSystem(TV_320x224, NULL, 1);
ang[X]=toFIXED(120.50);
ang[Z]=toFIXED(0.0);
pos[X]=toFIXED(0.0);
pos[Y]=toFIXED(40.170);
pos[Z]=toFIXED(220.0);
light[X]=toFIXED(0.0);
light[Y]=light[Z]=toFIXED(-60.0);
slPutPolygon(&poly1);
slPrint("Saturn Demo Coding Contest June 2003", slLocate(1,1));
while(1){
slSynch()
}
}
void sleepuntilbutton (Uint32 frames)
{
while (frames > 0)
{
SlSynch();
if (Smpc_Peripheral[0].data && PER_DGT_TX) return;
frames--
}
}
Why won´t it work? Could someone help me woth fixing this code so it displays the polygon ive created?