Commit a00b9bd8 authored by Yves Starreveld's avatar Yves Starreveld

ENH: Build for Cocoa and Carbon on OSX

parent fc24c9a2
......@@ -23,7 +23,7 @@
#include "vtkDebugLeaks.h"
// if using some sort of opengl, then include these files
#if defined(VTK_USE_OGLR) || defined(_WIN32) || defined(VTK_USE_QUARTZ)
#if defined(VTK_USE_OGLR) || defined(_WIN32) || defined(VTK_USE_COCOA) || defined(VTK_USE_CARBON)
#include "vtkOpenGLActor.h"
#include "vtkOpenGLCamera.h"
#include "vtkOpenGLImageActor.h"
......@@ -43,9 +43,13 @@
#endif
// Apple OSX stuff
#ifdef VTK_USE_QUARTZ
#include "vtkQuartzRenderWindow.h"
#include "vtkQuartzRenderWindowInteractor.h"
#ifdef VTK_USE_CARBON
#include "vtkCarbonRenderWindow.h"
#include "vtkCarbonRenderWindowInteractor.h"
#endif
#ifdef VTK_USE_COCOA
#include "vtkCocoaRenderWindow.h"
#include "vtkCocoaRenderWindowInteractor.h"
#endif
// X OpenGL stuff
......@@ -54,7 +58,7 @@
#include "vtkXOpenGLRenderWindow.h"
#endif
vtkCxxRevisionMacro(vtkGraphicsFactory, "1.26");
vtkCxxRevisionMacro(vtkGraphicsFactory, "1.27");
const char *vtkGraphicsFactory::GetRenderLibrary()
{
......@@ -91,8 +95,11 @@ const char *vtkGraphicsFactory::GetRenderLibrary()
#ifdef _WIN32
temp = "Win32OpenGL";
#endif
#ifdef VTK_USE_QUARTZ
temp = "QuartzOpenGL";
#ifdef VTK_USE_CARBON
temp = "CarbonOpenGL";
#endif
#ifdef VTK_USE_COCOA
temp = "CocoaOpenGL";
#endif
}
......@@ -143,19 +150,29 @@ vtkObject* vtkGraphicsFactory::CreateInstance(const char* vtkclassname )
}
#endif
#ifdef VTK_USE_QUARTZ
#ifdef VTK_USE_CARBON
if(strcmp(vtkclassname, "vtkRenderWindowInteractor") == 0)
{
return vtkCarbonRenderWindowInteractor::New();
}
if(strcmp(vtkclassname, "vtkRenderWindow") == 0)
{
return vtkCarbonRenderWindow::New();
}
#endif
#ifdef VTK_USE_COCOA
if(strcmp(vtkclassname, "vtkRenderWindowInteractor") == 0)
{
return vtkQuartzRenderWindowInteractor::New();
return vtkCocoaRenderWindowInteractor::New();
}
if(strcmp(vtkclassname, "vtkRenderWindow") == 0)
{
return vtkQuartzRenderWindow::New();
return vtkCocoaRenderWindow::New();
}
#endif
#if defined(VTK_USE_OGLR) || defined(_WIN32) || defined(VTK_USE_QUARTZ)
if (!strcmp("OpenGL",rl) || !strcmp("Win32OpenGL",rl) || !strcmp("QuartzOpenGL",rl))
#if defined(VTK_USE_OGLR) || defined(_WIN32) || defined(VTK_USE_COCOA) || defined(VTK_USE_CARBON)
if (!strcmp("OpenGL",rl) || !strcmp("Win32OpenGL",rl) || !strcmp("CarbonOpenGL",rl) || !strcmp("CocoaOpenGL",rl))
{
if(strcmp(vtkclassname, "vtkActor") == 0)
{
......
......@@ -37,16 +37,22 @@
#include "vtkOpenGLImageMapper.h"
#include "vtkWin32OpenGLTextMapper.h"
#include "vtkOpenGLPolyDataMapper2D.h"
#else
#ifdef VTK_USE_QUARTZ
#include "vtkOpenGLImageMapper.h"
#include "vtkOpenGLPolyDataMapper2D.h"
#include "vtkQuartzTextMapper.h"
#include "vtkQuartzImageMapper.h"
#endif
#endif
vtkCxxRevisionMacro(vtkImagingFactory, "1.21");
#ifdef VTK_USE_CARBON
#include "vtkOpenGLImageMapper.h"
#include "vtkCarbonTextMapper.h"
#include "vtkOpenGLPolyDataMapper2D.h"
#endif
#ifdef VTK_USE_COCOA
#include "vtkOpenGLImageMapper.h"
#include "vtkCocoaTextMapper.h"
#include "vtkOpenGLPolyDataMapper2D.h"
#endif
vtkCxxRevisionMacro(vtkImagingFactory, "1.22");
const char *vtkImagingFactoryGetRenderLibrary()
{
......@@ -100,8 +106,11 @@ const char *vtkImagingFactoryGetRenderLibrary()
#ifdef _WIN32
temp = "Win32OpenGL";
#endif
#ifdef VTK_USE_QUARTZ
temp = "QuartzOpenGL";
#ifdef VTK_USE_CARBON
temp = "CarbonOpenGL";
#endif
#ifdef VTK_USE_COCOA
temp = "CocoaOpenGL";
#endif
}
......@@ -161,12 +170,29 @@ vtkObject* vtkImagingFactory::CreateInstance(const char* vtkclassname )
}
#endif
#ifdef VTK_USE_QUARTZ
if (!strcmp("QuartzOpenGL",rl))
#ifdef VTK_USE_CARBON
if (!strcmp("CarbonOpenGL",rl))
{
if(strcmp(vtkclassname, "vtkTextMapper") == 0)
{
return vtkQuartzTextMapper::New();
return vtkCarbonTextMapper::New();
}
if(strcmp(vtkclassname, "vtkImageMapper") == 0)
{
return vtkOpenGLImageMapper::New();
}
if(strcmp(vtkclassname, "vtkPolyDataMapper2D") == 0)
{
return vtkOpenGLPolyDataMapper2D::New();
}
}
#endif
#ifdef VTK_USE_COCOA
if (!strcmp("CocoaOpenGL",rl))
{
if(strcmp(vtkclassname, "vtkTextMapper") == 0)
{
return vtkCocoaTextMapper::New();
}
if(strcmp(vtkclassname, "vtkImageMapper") == 0)
{
......@@ -202,3 +228,4 @@ vtkObject* vtkImagingFactory::CreateInstance(const char* vtkclassname )
}
......@@ -19,15 +19,20 @@
#include <string.h>
#include "vtkRenderWindow.h"
#ifdef VTK_USE_QUARTZ
#include "vtkQuartzRenderWindow.h"
#ifdef VTK_USE_CARBON
#include "vtkCarbonRenderWindow.h"
#else
#ifdef _WIN32
#include "vtkWin32OpenGLRenderWindow.h"
#else
#include "vtkOpenGLRenderWindow.h"
#endif
#ifdef VTK_USE_COCOA
#include "vtkCocoaRenderWindow.h"
#else
#ifdef _WIN32
#include "vtkWin32OpenGLRenderWindow.h"
#else
#include "vtkOpenGLRenderWindow.h"
#endif
#endif
#endif
#include "vtkOpenGLRenderer.h"
#include "vtkOpenGLImageActor.h"
#ifdef __APPLE__
......@@ -39,7 +44,7 @@
#ifndef VTK_IMPLEMENT_MESA_CXX
vtkCxxRevisionMacro(vtkOpenGLImageActor, "1.12");
vtkCxxRevisionMacro(vtkOpenGLImageActor, "1.13");
vtkStandardNewMacro(vtkOpenGLImageActor);
#endif
......@@ -300,15 +305,7 @@ void vtkOpenGLImageActor::Load(vtkRenderer *ren)
glNewList ((GLuint) this->Index, GL_COMPILE);
#endif
#ifdef VTK_USE_QUARTZ
((vtkQuartzRenderWindow *)(ren->GetRenderWindow()))->RegisterTextureResource( this->Index );
#else
#ifdef _WIN32
((vtkWin32OpenGLRenderWindow *)(ren->GetRenderWindow()))->RegisterTextureResource( this->Index );
#else
((vtkOpenGLRenderWindow *)(ren->GetRenderWindow()))->RegisterTextureResource( this->Index );
#endif
#endif
((vtkOpenGLRenderWindow *)(ren->GetRenderWindow()))->RegisterTextureResource( this->Index );
if (this->Interpolate)
{
......
......@@ -21,14 +21,18 @@
#include "vtkOpenGLPolyDataMapper.h"
#ifdef VTK_USE_QUARTZ
#include "vtkQuartzRenderWindow.h"
#ifdef VTK_USE_CARBON
#include "vtkCarbonRenderWindow.h"
#else
#ifdef _WIN32
#include "vtkWin32OpenGLRenderWindow.h"
#else
#include "vtkOpenGLRenderWindow.h"
#endif
#ifdef VTK_USE_COCOA
#include "vtkCocoaRenderWindow.h"
#else
#ifdef _WIN32
#include "vtkWin32OpenGLRenderWindow.h"
#else
#include "vtkOpenGLRenderWindow.h"
#endif
#endif
#endif
#include "vtkOpenGLRenderer.h"
#include "vtkPolyData.h"
......@@ -41,7 +45,7 @@
#include "vtkCommand.h"
#ifndef VTK_IMPLEMENT_MESA_CXX
vtkCxxRevisionMacro(vtkOpenGLPolyDataMapper, "1.69");
vtkCxxRevisionMacro(vtkOpenGLPolyDataMapper, "1.70");
vtkStandardNewMacro(vtkOpenGLPolyDataMapper);
#endif
......
......@@ -19,28 +19,33 @@
#include <string.h>
#include "vtkRenderWindow.h"
#ifdef __APPLE__
#include <OpenGL/gl.h>
#include "vtkQuartzRenderWindow.h"
#ifdef VTK_USE_CARBON
#include <OpenGL/gl.h>
#include "vtkCarbonRenderWindow.h"
#else
#ifdef _WIN32
#include "vtkWin32OpenGLRenderWindow.h"
#else
#include "vtkOpenGLRenderWindow.h"
#endif
#ifdef VTK_USE_COCOA
#include <OpenGL/gl.h>
#include "vtkCocoaRenderWindow.h"
#else
#ifdef _WIN32
#include "vtkWin32OpenGLRenderWindow.h"
#else
#include "vtkOpenGLRenderWindow.h"
#endif
#endif
#endif
#include "vtkOpenGLRenderer.h"
#include "vtkOpenGLTexture.h"
#ifndef VTK_IMPLEMENT_MESA_CXX
#ifndef __APPLE__
#include <GL/gl.h>
#endif
#ifndef __APPLE__
#include <GL/gl.h>
#endif
#endif
#include "vtkObjectFactory.h"
#ifndef VTK_IMPLEMENT_MESA_CXX
vtkCxxRevisionMacro(vtkOpenGLTexture, "1.47");
vtkCxxRevisionMacro(vtkOpenGLTexture, "1.48");
vtkStandardNewMacro(vtkOpenGLTexture);
#endif
......@@ -247,15 +252,7 @@ void vtkOpenGLTexture::Load(vtkRenderer *ren)
glNewList ((GLuint) this->Index, GL_COMPILE);
#endif
#ifdef __APPLE__
((vtkQuartzRenderWindow *)(ren->GetRenderWindow()))->RegisterTextureResource(this->Index);
#else
#ifdef _WIN32
((vtkWin32OpenGLRenderWindow *)(ren->GetRenderWindow()))->RegisterTextureResource( this->Index );
#else
((vtkOpenGLRenderWindow *)(ren->GetRenderWindow()))->RegisterTextureResource( this->Index );
#endif
#endif
if (this->Interpolate)
{
......
......@@ -21,13 +21,17 @@
#include "vtkRenderWindowInteractor.h"
#ifdef _WIN32
#pragma warning ( disable : 4273 )
#pragma warning ( disable : 4273 )
#else
#ifdef __APPLE__
#include "vtkQuartzRenderWindow.h"
#else
#include "vtkXOpenGLRenderWindow.h"
#endif
#ifdef VTK_USE_CARBON
#include "vtkCarbonRenderWindow.h"
#else
#ifdef VTK_USE_COCOA
#include "vtkCocoaRenderWindow.h"
#else
#include "vtkXOpenGLRenderWindow.h"
#endif
#endif
#endif
#define VTK_ALL_EVENTS_MASK \
......@@ -659,9 +663,9 @@ static int vtkTkImageViewerWidget_MakeImageViewer(struct vtkTkImageViewerWidget
// now the APPLE version
// now the APPLE version - only available using the Carbon APIs
#else
#ifdef __APPLE__
#ifdef VTK_USE_CARBON
//----------------------------------------------------------------------------
// Creates a ImageViewer window and forces Tk to use the window.
static int
......@@ -669,7 +673,7 @@ vtkTkImageViewerWidget_MakeImageViewer(struct vtkTkImageViewerWidget *self)
{
Display *dpy;
vtkImageViewer *ImageViewer;
vtkQuartzRenderWindow *ImageWindow;
vtkCarbonRenderWindow *ImageWindow;
if (self->ImageViewer)
{
......@@ -730,7 +734,7 @@ vtkTkImageViewerWidget_MakeImageViewer(struct vtkTkImageViewerWidget *self)
// get the window
ImageWindow = static_cast<vtkQuartzRenderWindow *>(ImageViewer->GetRenderWindow());
ImageWindow = static_cast<vtkCarbonRenderWindow *>(ImageViewer->GetRenderWindow());
// If the imageviewer has already created it's window, throw up our hands and quit...
if ( ImageWindow->GetWindowId() != (Window)NULL )
{
......
......@@ -25,8 +25,8 @@
#ifdef _WIN32
#include "vtkWin32OpenGLRenderWindow.h"
#else
#ifdef __APPLE__
#include "vtkQuartzRenderWindow.h"
#ifdef VTK_USE_CARBON
#include "vtkCarbonRenderWindow.h"
#else
#include "vtkXOpenGLRenderWindow.h"
#endif
......@@ -664,15 +664,15 @@ static int vtkTkRenderWidget_MakeRenderWindow(struct vtkTkRenderWidget *self)
}
#else
// the quartz version
#ifdef __APPLE__
// the carbon version - tk not available using the cocoa api
#ifdef VTK_USE_CARBON
//----------------------------------------------------------------------------
// Creates a render window and forces Tk to use the window.
static int
vtkTkRenderWidget_MakeRenderWindow(struct vtkTkRenderWidget *self)
{
Display *dpy;
vtkQuartzRenderWindow *renderWindow;
vtkCarbonRenderWindow *renderWindow;
if (self->RenderWindow)
{
......@@ -692,7 +692,7 @@ vtkTkRenderWidget_MakeRenderWindow(struct vtkTkRenderWidget *self)
self->RenderWindow = vtkRenderWindow::New();
self->RenderWindow->Register(NULL);
self->RenderWindow->Delete();
renderWindow = (vtkQuartzRenderWindow *)(self->RenderWindow);
renderWindow = (vtkCarbonRenderWindow *)(self->RenderWindow);
#ifndef VTK_PYTHON_BUILD
vtkTclGetObjectFromPointer(self->Interp, self->RenderWindow,
vtkRenderWindowCommand);
......@@ -708,13 +708,13 @@ vtkTkRenderWidget_MakeRenderWindow(struct vtkTkRenderWidget *self)
{
void *tmp;
sscanf(self->RW+5,"%p",&tmp);
renderWindow = (vtkQuartzRenderWindow *)tmp;
renderWindow = (vtkCarbonRenderWindow *)tmp;
}
else
{
#ifndef VTK_PYTHON_BUILD
int new_flag;
renderWindow = (vtkQuartzRenderWindow *)
renderWindow = (vtkCarbonRenderWindow *)
vtkTclGetPointerFromObject(self->RW,"vtkRenderWindow",self->Interp,
new_flag);
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment