diff options
author | Adam Haberlach <haberlaa@users.sourceforge.net> | 2000-01-25 01:02:32 +0000 |
---|---|---|
committer | Adam Haberlach <haberlaa@users.sourceforge.net> | 2000-01-25 01:02:32 +0000 |
commit | 11c1e5de1a324375b1cbfc116893c7c24fb5dc6a (patch) | |
tree | 2a8fdcf77aca7e620037266bdf6dec907ec654e0 /src | |
parent | f4c7a4aaa0b16ff286ae5818b76ea77c60a21b5c (diff) |
Checkin of support for BeOS. Choice between BeOS and anything else is
done in common.mak, and hopefully I didn't break anything too severely.
Currently, the showtiff/showvis stuff does not work with BeOS because
it relies on GLUT. Will fix eventually.
Diffstat (limited to 'src')
-rw-r--r-- | src/glean/Makefile | 7 | ||||
-rw-r--r-- | src/glean/dsurf.cpp | 31 | ||||
-rw-r--r-- | src/glean/dsurf.h | 18 | ||||
-rw-r--r-- | src/glean/winsys.cpp | 23 | ||||
-rw-r--r-- | src/glean/winsys.h | 3 | ||||
-rw-r--r-- | src/libs/dsurf/dsconfig.cpp | 34 | ||||
-rw-r--r-- | src/libs/dsurf/dsconfig.h | 2 | ||||
-rw-r--r-- | src/tools/showtiff/Makefile | 7 | ||||
-rw-r--r-- | src/tools/showvis/Makefile | 2 |
9 files changed, 122 insertions, 5 deletions
diff --git a/src/glean/Makefile b/src/glean/Makefile index 09a2149..5ab98bf 100644 --- a/src/glean/Makefile +++ b/src/glean/Makefile @@ -3,6 +3,11 @@ include $(GLEAN_ROOT)/make/common.mak TARGET=glean -LIB=-lstats -ldsurf -llex -limage -ltimer -ltiff -lGLU -lGL -lXmu -lXext -lX11 + +ifeq ($(PLATFORM), BeOS) + LIB=-lstats -ldsurf -llex -limage -ltimer -ltiff -lGL -lbe +else + LIB=-lstats -ldsurf -llex -limage -ltimer -ltiff -lGLU -lGL -lXmu -lXext -lX11 +endif include $(GLEAN_ROOT)/make/app.mak diff --git a/src/glean/dsurf.cpp b/src/glean/dsurf.cpp index 4f6126d..1ac1e62 100644 --- a/src/glean/dsurf.cpp +++ b/src/glean/dsurf.cpp @@ -146,6 +146,12 @@ Window::Window(WindowSystem& ws, DrawingSurfaceConfig& c, int w, int h): PIXELFORMATDESCRIPTOR pfd; SetPixelFormat(hDC,config->pfdID,&pfd); + +#elif defined(__BEWIN__) + + tWindow = new GLTestWindow (BRect(100,100, 100+w, 100+h), "GL Test Window"); + tWindow->Show(); + #endif } // Window::Window @@ -165,6 +171,11 @@ Window::~Window() { #elif defined(__WIN__) ReleaseDC(hWindow,hDC); DestroyWindow(hWindow); + +#elif defined(__BEWIN__) + + tWindow->Lock(); + tWindow->Quit(); #endif } // Window::~Window @@ -178,6 +189,8 @@ Window::swap() { glXSwapBuffers(winSys->dpy, xWindow); # elif defined(__WIN__) SwapBuffers(hDC); +# elif defined(__BEWIN__) + tWindow->SwapBuffers(); # endif } // Window::swap @@ -202,4 +215,22 @@ Window::WindowProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam) #endif + +#if defined(__BEWIN__) + +GLTestWindow::GLTestWindow(BRect frame, const char *title) : + BWindow(frame, title, B_TITLED_WINDOW, B_NOT_RESIZABLE) +{ + /* right now we just create all the buffers we can */ + tView = new BGLView(Bounds(), "glean_view", B_FOLLOW_ALL, B_WILL_DRAW, + BGL_RGB | BGL_DOUBLE | BGL_DEPTH | BGL_ALPHA | BGL_STENCIL | BGL_ACCUM ); + AddChild(tView); +} + +void +GLTestWindow::SwapBuffers() +{ + tView->SwapBuffers(); +} +#endif } // namespace GLEAN diff --git a/src/glean/dsurf.h b/src/glean/dsurf.h index 925127d..574e72b 100644 --- a/src/glean/dsurf.h +++ b/src/glean/dsurf.h @@ -54,6 +54,20 @@ class DrawingSurface { }; // class DrawingSurface +/* we have to create a utility test window for BeOS */ +# if defined(__BEWIN__) +class GLTestWindow : public BWindow { +public: + GLTestWindow(BRect frame, const char *title); + void SwapBuffers(); +// void SwapBuffers( bool vSync ); + +private: + BGLView *tView; +}; +# endif + + class Window: public DrawingSurface { public: Window(WindowSystem& ws, DrawingSurfaceConfig& c, int w, int h); @@ -75,6 +89,10 @@ class Window: public DrawingSurface { ::HDC get_dc() const {return hDC;} static LRESULT CALLBACK WindowProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam); + +# elif defined(__BEWIN__) + GLTestWindow *tWindow; + # endif }; // class Window diff --git a/src/glean/winsys.cpp b/src/glean/winsys.cpp index b9c3cbe..1037d5a 100644 --- a/src/glean/winsys.cpp +++ b/src/glean/winsys.cpp @@ -125,6 +125,23 @@ WindowSystem::WindowSystem(Options& o) { DrawingSurfaceFilter f(o.visFilter); // may throw an exception! surfConfigs = f.filter(glpf); } + +#elif defined(__BEWIN__) +WindowSystem::WindowSystem(Options& o) { + //cout << "Implement Me! WindowSystem::WindowSystem(Options& o)\n"; + + theApp = new BApplication("application/x-AJH-glean"); + + /* for BeOS, we just stack the current config onto the vector so */ + /* there is at least one thing to iterate over */ + vector<DrawingSurfaceConfig*> glconfigs; + glconfigs.push_back(new DrawingSurfaceConfig()); + + DrawingSurfaceFilter f(o.visFilter); // may throw an exception! + surfConfigs = f.filter(glconfigs); + +} + #endif /////////////////////////////////////////////////////////////////////////////// @@ -133,11 +150,15 @@ WindowSystem::WindowSystem(Options& o) { #if defined(__X11__) WindowSystem::~WindowSystem() { XFree(vip); -} // WindowSystem:: ~WindowSystem +} #elif defined(__WIN__) WindowSystem::~WindowSystem() { } +#elif defined(__BEWIN__) +WindowSystem::~WindowSystem() { + delete theApp; +}// WindowSystem:: ~WindowSystem #endif /////////////////////////////////////////////////////////////////////////////// diff --git a/src/glean/winsys.h b/src/glean/winsys.h index 036954e..a579524 100644 --- a/src/glean/winsys.h +++ b/src/glean/winsys.h @@ -102,6 +102,9 @@ class WindowSystem { XVisualInfo* vip; // Array of raw XVisualInfo structures. # elif defined(__WIN__) + +# elif defined(__BEWIN__) + BApplication *theApp; # endif }; // class WindowSystem diff --git a/src/libs/dsurf/dsconfig.cpp b/src/libs/dsurf/dsconfig.cpp index 81fbaba..3a284ad 100644 --- a/src/libs/dsurf/dsconfig.cpp +++ b/src/libs/dsurf/dsconfig.cpp @@ -343,9 +343,41 @@ DrawingSurfaceConfig::DrawingSurfaceConfig(int id, ::PIXELFORMATDESCRIPTOR *ppfd transparent = false; transR = transG = transB = transA = transI = 0; } +#elif defined(__BEWIN__) -#endif +DrawingSurfaceConfig::DrawingSurfaceConfig() { + + if (!mapsInitialized) + initializeMaps(); + + /* these values are estimates for the moment */ + level = 0; + db = 1; + stereo =0; + r = g = b = a = 32; + + z = 30; + accR = 32; + accG = 32; + accB = 32; + accA = 32; + + + canWindow = 1; + canWinSysRender = 1; + + // This is a software-mode assumption + fast = false; + // we'll assume that the OpenGL implementation thinks it is conformant + conformant = true; + + // chromakeying isn't supported + transparent = false; + transR = transG = transB = transA = transI = 0; +} + +#endif DrawingSurfaceConfig::DrawingSurfaceConfig(string& str) { if (!mapsInitialized) diff --git a/src/libs/dsurf/dsconfig.h b/src/libs/dsurf/dsconfig.h index bc63b74..ada741d 100644 --- a/src/libs/dsurf/dsconfig.h +++ b/src/libs/dsurf/dsconfig.h @@ -61,6 +61,8 @@ class DrawingSurfaceConfig { # endif # elif defined(__WIN__) DrawingSurfaceConfig(int id, ::PIXELFORMATDESCRIPTOR *ppfd); +# elif defined(__BEWIN__) + DrawingSurfaceConfig(); # endif DrawingSurfaceConfig(string& s); // s is a canonical description diff --git a/src/tools/showtiff/Makefile b/src/tools/showtiff/Makefile index 44d189d..36d17a5 100644 --- a/src/tools/showtiff/Makefile +++ b/src/tools/showtiff/Makefile @@ -1,6 +1,11 @@ include $(GLEAN_ROOT)/make/common.mak TARGET=showtiff -LIB=-limage -ltiff -lglut -lGLU -lGL -lXmu -lXext -lXi -lX11 + +ifeq ($(PLATFORM), BeOS) + LIB=-limage -ltiff -lglut -lGL +else + LIB=-limage -ltiff -lglut -lGLU -lGL -lXmu -lXext -lXi -lX11 +endif include $(GLEAN_ROOT)/make/app.mak diff --git a/src/tools/showvis/Makefile b/src/tools/showvis/Makefile index 356b622..3a8cc3b 100644 --- a/src/tools/showvis/Makefile +++ b/src/tools/showvis/Makefile @@ -1,6 +1,6 @@ include $(GLEAN_ROOT)/make/common.mak TARGET=showvis -LIB=-ldsurf -llex -lGLU -lGL -lXext -lX11 +LIB=-ldsurf -llex -lGL include $(GLEAN_ROOT)/make/app.mak |