void DrawStuff (void) { #ifdef IBM_GL_32 scale (1.8, 1.8, 1.8); lmcolor (material_mode); (void) extrusion (NUM_TEXAS_PTS-1, texas_xsection, texas_normal, NULL, NUMPOINTS, tspine, tcolors); (void) extrusion (NUM_TEXAS_PTS-1, texas_xsection, texas_normal, NULL, HNUM, brand_points, brand_colors); lmcolor (LMC_COLOR); #endif #define OPENGL_10 #ifdef OPENGL_10 glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); /* set up some matrices so that the object spins with the mouse */ glPushMatrix (); glTranslatef (0.0, 0.0, -80.0); glRotatef (lastx, 0.0, 1.0, 0.0); glRotatef (lasty, 1.0, 0.0, 0.0); /* draw the brand and the handle */ gleExtrusion (NUM_TEXAS_PTS-1, texas_xsection, texas_normal, NULL, NUMPOINTS, tspine, tcolors); gleExtrusion (NUM_TEXAS_PTS-1, texas_xsection, texas_normal, NULL, HNUM, brand_points, brand_colors); glPopMatrix (); glutSwapBuffers (); }
MapExtruder::MapExtruder(const char* map2dFile,double height) { _map2dFile = map2dFile; _height = height; OGRRegisterAll(); OGRDataSource *poDS = OGRSFDriverRegistrar::Open(_map2dFile,FALSE); if( poDS == NULL) { printf("Open failed.\n"); exit(1); } _map2d = new OGRMultiPolygon(); OGRLayer *poLayer; poLayer = poDS->GetLayer(0); OGRFeature *poFeature; poLayer->ResetReading(); while((poFeature = poLayer->GetNextFeature())!=NULL) { OGRGeometry *poGeometry; poGeometry = poFeature ->GetGeometryRef(); if(poGeometry!=NULL) { if(poGeometry ->getGeometryType()==wkbPolygon) _map2d->addGeometry((OGRPolygon*) poGeometry); if(poGeometry ->getGeometryType()==wkbMultiPolygon) { int nPolygons = ((OGRMultiPolygon*)poGeometry)->getNumGeometries(); for(int i=0;i<nPolygons;i++) _map2d->addGeometry((OGRPolygon*)(((OGRMultiPolygon*)poGeometry)->getGeometryRef(i))); } } } extrusion(); }