blob: 382cc939e16c168d5d3179d115f101986d9a9cf7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
#define SDL_MAIN_HANDLED
#include <abc.h>
#include <dtx.h>
#include <rez.h>
#include <GL/gl.h>
#include <osg/GLExtensions>
#include <osg/State>
#include <osgViewer/GraphicsWindow>
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <cstdlib>
#include <cstdio>
#include <iostream>
int main(int argc, char *argv[])
{
std::unique_ptr<rez::file> 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<osgViewer::GraphicsWindow *>(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();
}
|