#define SDL_MAIN_HANDLED #include #include #include #include #include #include #include #include #include #include #include #include int main(int argc, char *argv[]) { std::unique_ptr f, abcf; rez::ball b("globalops.rez"); abc abc; dtx dtx; osgViewer::Viewer viewer; osg::Camera *cam; osg::GraphicsContext *gfx; osg::State *state; osg::GLExtensions *ext; osgViewer::GraphicsWindow *gfxw; viewer.setUpViewInWindow(0, 0, 640, 480); viewer.realize(); cam = viewer.getCamera(); gfx = cam->getGraphicsContext(); gfxw = dynamic_cast(gfx); if (!gfxw) { std::cerr << "Failed to cast osgViewe::GraphicContext to " "osgViewer::GraphicsWindow\n"; return EXIT_FAILURE; } gfxw->setWindowName("GlobalOps"); state = gfx->getState(); state->initializeExtensionProcs(); ext = osg::GLExtensions::Get(state->getContextID(), true); if (!ext) { std::cerr << "osg::GLExtensions::Get failed\n"; return EXIT_FAILURE; } else if (!ext->isCompressedTexImage2DSupported()) { std::cerr << "OpenGL extension glCompressedTextImage2D not supported\n"; return EXIT_FAILURE; } else if (!ext->isTextureCompressionS3TCSupported) { std::cerr << "OpenGL extension GL_EXT_texture_compression_s3tc " "not supported\n"; return EXIT_FAILURE; } else if (b.parse() || !(f = b.open("interface/blueprints/antarctica_tacmap.dtx")) || dtx.parse(*f) || !(f = b.open("models/grenades/v_frag.abc")) || abc.parse(*f)) return EXIT_FAILURE; return viewer.run(); }