[vtkusers] why vtkQuartzImageWindow.c has disappeared
Daniel Sáez Domingo
dsaez at iti.upv.es
Mon Jun 17 11:57:56 EDT 2002
Hello Ives,
Then, I'm going to tell you all the changes I did when I built VTK and I
would thank you tell me what things I have to do now an what things I don't
have to do.
First, in /usr/local/src/VTK/Rendering/CMakeLists.txt I added the next (see
//ADDED):
....
IF(UNIX)
IF(NOT WIN32)
IF(NOT APPLE)
SOURCE_FILES ( Rendering_SRCS
vtkXImageWindow
vtkXRenderWindowInteractor
vtkXTextMapper)
//ADDED
ELSE (NOT APPLE)
IF (NOT VTK_USE_QUARTZ)
IF (VTK_USE_X)
SOURCE_FILES ( Rendering_SRCS
vtkXImageWindow
vtkXRenderWindowInteractor
vtkXTextMapper)
ENDIF (VTK_USE_X)
ENDIF (NOT VTK_USE_QUARTZ)
//END ADDED
ENDIF(NOT APPLE)
ENDIF(NOT WIN32)
ENDIF(UNIX)
IF (WIN32)
SET(HAVE_OPENGL_SRCS ON)
SOURCE_FILES(RenderingOpenGL_SRCS
vtkWin32OpenGLRenderWindow
vtkWin32RenderWindowInteractor
vtkWin32OpenGLImageWindow
vtkWin32OpenGLTextMapper
vtkWin32TextMapper)
LINK_LIBRARIES ( ${OPENGL_LIBRARY} )
IF(MESA_OS_LIBRARY)
LINK_LIBRARIES( ${MESA_OS_LIBRARY} )
ENDIF(MESA_OS_LIBRARY)
ELSE (WIN32)
IF (APPLE)
//ADDED
IF (VTK_USE_QUARTZ)
ADD_DEFINITIONS(-DVTK_USE_QUARTZ)
SET(HAVE_OPENGL_SRCS ON)
SOURCE_FILES(RenderingOpenGL_SRCS
vtkQuartzImageWindow
vtkQuartzTextMapper
vtkQuartzRenderWindowInteractor
vtkQuartzRenderWindow
vtkQuartzWindow
vtkQuartzGLView)
WRAP_EXCLUDE_FILES(vtkQuartzGLView
vtkQuartzWindow)
LINK_LIBRARIES (${OPENGL_LIBRARY} )
IF(MESA_OS_LIBRARY)
LINK_LIBRARIES( ${MESA_OS_LIBRARY} )
ENDIF(MESA_OS_LIBRARY)
ADD_LIBRARY(vtkRendering Rendering_SRCS RenderingOpenGL_SRCS)
ELSE (VTK_USE_QUARTZ)
IF (VTK_USE_X)
IF (OPENGL_LIBRARY)
SET(HAVE_OPENGL_SRCS ON)
SOURCE_FILES(RenderingOpenGL_SRCS
vtkOpenGLImageWindow
vtkXOpenGLRenderWindow
vtkXOpenGLTextMapper)
ABSTRACT_FILES(
vtkXImageWindow
vtkXTextMapper)
LINK_LIBRARIES (${OPENGL_LIBRARY} )
IF(MESA_OS_LIBRARY)
LINK_LIBRARIES( ${OSMESA_LIBRARY} )
ENDIF(MESA_OS_LIBRARY)
ENDIF (OPENGL_LIBRARY)
ENDIF (VTK_USE_X)
ENDIF (VTK_USE_QUARTZ)
//END ADDED
ELSE (APPLE)
IF (OPENGL_LIBRARY)
SET(HAVE_OPENGL_SRCS ON)
SOURCE_FILES(RenderingOpenGL_SRCS
vtkOpenGLImageWindow
vtkXOpenGLRenderWindow
vtkXOpenGLTextMapper)
ABSTRACT_FILES(
vtkXImageWindow
vtkXTextMapper)
LINK_LIBRARIES (${OPENGL_LIBRARY} )
IF(MESA_OS_LIBRARY)
LINK_LIBRARIES( ${OSMESA_LIBRARY} )
ENDIF(MESA_OS_LIBRARY)
ENDIF (OPENGL_LIBRARY)
ENDIF (APPLE)
ENDIF (WIN32)
....
In /usr/local/src/VTK/Common/vtkJavaUtil.cxx to solve an error with synch.h
and thread.h, I added :
....
#ifdef _WIN32
HANDLE vtkGlobalMutex = NULL;
#define VTK_GET_MUTEX() WaitForSingleObject(vtkGlobalMutex,INFINITE)
#define VTK_RELEASE_MUTEX() ReleaseMutex(vtkGlobalMutex)
#include <mapiform.h>
#else
#ifdef VTK_USE_SPROC
// for SGI's
#include <abi_mutex.h>
abilock_t vtkGlobalMutex;
static void vtk_get_mutex() {
static int inited = 0;
if (!inited) {
if (init_lock(&vtkGlobalMutex) < 0)
perror("initializing mutex");
inited = 1;
}
spin_lock(&vtkGlobalMutex);
}
static void vtk_release_mutex() {
if (release_lock(&vtkGlobalMutex) < 0)
perror("releasing mutex");
}
#define VTK_GET_MUTEX() vtk_get_mutex()
#define VTK_RELEASE_MUTEX() vtk_release_mutex()
//ADDED
#elif defined(__FreeBSD__) || defined(__linux__) || defined(sgi) ||
defined(VTK_USE_QUARTZ)
//ADDED
#include <pthread.h>
pthread_mutex_t vtkGlobalMutex;
#define VTK_GET_MUTEX() pthread_mutex_lock(&vtkGlobalMutex)
#define VTK_RELEASE_MUTEX() pthread_mutex_unlock(&vtkGlobalMutex)
#else
// for solaris
#include <thread.h>
#include <synch.h>
mutex_t vtkGlobalMutex;
#define VTK_GET_MUTEX() mutex_lock(&vtkGlobalMutex)
#define VTK_RELEASE_MUTEX() mutex_unlock(&vtkGlobalMutex)
#endif
#endif
....
In /usr/local/src/VTK/Common/CMakeLists.txt I added the next definition:
...
IF (VTK_WRAP_JAVA)
VTK_WRAP_JAVA(vtkCommonJava CommonJava_SRCS Common_SRCS)
//ADDED
ADD_DEFINITIONS(-DVTK_USE_QUARTZ)
//END ADDED
ADD_LIBRARY(vtkCommonJava SHARED CommonJava_SRCS vtkJavaUtil)
INSTALL_TARGETS(/lib/vtk vtkCommonJava)
INSTALL_FILES(/include/vtk .h
vtkJavaUtil
)
ENDIF (VTK_WRAP_JAVA)
....
Well, I wanted to wrap Java, then as I haven't X support, I copied
/usr/local/src/VTK/Common/vtkJavaAwt.h into
/usr/local/src/VTK/Common/vtkJavaAwtQuartz.h and in this last file I added:
....
// Here is the win32 drawing code
#if defined(_WIN32) || defined(WIN32)
JAWT_Win32DrawingSurfaceInfo* dsi_win;
dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo;
temp0->SetWindowId((void *)dsi_win->hwnd);
//ADDED
#elif defined (VTK_USE_QUARTZ)
JAWT_MacDrawingSurfaceInfo* dsi_mac;
dsi_mac = (JAWT_MacDrawingSurfaceInfo*)dsi->platformInfo;
temp0->SetDisplayId((void *)dsi_mac->fQDDevice);
temp0->SetWindowId((void *)dsi_mac->fCGWindowID);
//ENDADDED
// otherwise use X11 code
#else
JAWT_X11DrawingSurfaceInfo* dsi_x11;
dsi_x11 = (JAWT_X11DrawingSurfaceInfo*)dsi->platformInfo;
temp0->SetDisplayId((void *)dsi_x11->display);
temp0->SetWindowId((void *)dsi_x11->drawable);
#endif
....
and then, in /usr/local/src/VTK/Wrapping/vtkWrapJava.c I changed vtkJavaAwt.h
by vtkJavaAwtQuartz.h:
/* for vtkRenderWindow we want to add a special method to support */
/* native AWT rendering */
if (!strcmp("vtkRenderWindow",data->ClassName))
{
fprintf(fp,"\n#include \"vtkJavaAwtQuartz.h\"\n\n");
}
Once these changes done, my cmake options were:
Variable Name: BUILD_DOCUMENTATION
Description: Build the documentation (Doxygen).
Current Value: OFF
New Value (Enter to keep current value):
Variable Name: BUILD_EXAMPLES
Description: Build VTK examples.
Current Value: ON
New Value (Enter to keep current value):
Variable Name: BUILD_SHARED_LIBS
Description: Build VTK with shared libraries.
Current Value: ON
New Value (Enter to keep current value):
Variable Name: BUILD_TESTING
Description: Build the testing tree.
Current Value: OFF
New Value (Enter to keep current value):
Variable Name: CMAKE_AR
Description: Archive program used to make archive libraries.
Current Value: /usr/bin/ar
New Value (Enter to keep current value):
Variable Name: CMAKE_AR_ARGS
Description: Arguments for CMAKE_AR program to create an archive library.
Current Value: cr
New Value (Enter to keep current value):
Variable Name: CMAKE_CXX_COMPILER
Description: Name of C++ compiler used.
Current Value: c++
New Value (Enter to keep current value):
Variable Name: CMAKE_CXX_FLAGS
Description: Flags used by CXX compiler.
Current Value: -g -O2
New Value (Enter to keep current value):
Variable Name: CMAKE_C_COMPILER
Description: Name of C compiler used.
Current Value: cc
New Value (Enter to keep current value):
Variable Name: CMAKE_C_FLAGS
Description: Flags for C compiler.
Current Value: -g -O2
New Value (Enter to keep current value):
Variable Name: CMAKE_DL_LIBS
Description: Dynamic link library to link in.
Current Value:
New Value (Enter to keep current value):
Variable Name: CMAKE_HP_PTHREADS
Description: Use HP pthreads.
Current Value: 0
New Value (Enter to keep current value):
Variable Name: CMAKE_INSTALL_PREFIX
Description: Install path prefix, prepended onto install directories.
Current Value: /usr/local
New Value (Enter to keep current value):
Variable Name: CMAKE_LIB_EXT
Description: Library extension used by this machine.
Current Value:
New Value (Enter to keep current value):
Variable Name: CMAKE_MAKE_PROGRAM
Description: Path to a program.
Current Value: /usr/bin/make
New Value (Enter to keep current value):
Variable Name: CMAKE_MODULE_BUILD_FLAGS
Description: Flag used by CXX to build a shared library.
Current Value: -bundle -flat_namespace -undefined suppress
New Value (Enter to keep current value):
Variable Name: CMAKE_MODULE_LINK_FLAGS
Description: Flags used to link a shared library.
Current Value:
New Value (Enter to keep current value):
Variable Name: CMAKE_MODULE_SUFFIX
Description: Module library suffix.
Current Value: .so
New Value (Enter to keep current value):
Variable Name: CMAKE_RANLIB
Description: Library randomizer program used on archive libraries.
Current Value: ranlib
New Value (Enter to keep current value):
Variable Name: CMAKE_SHLIB_BUILD_FLAGS
Description: Flag used by CXX to build a shared library.
Current Value: -dynamiclib
New Value (Enter to keep current value):
Variable Name: CMAKE_SHLIB_CFLAGS
Description: Flag used for building shared library objects.
Current Value:
New Value (Enter to keep current value):
Variable Name: CMAKE_SHLIB_LD_LIBS
Description: Libraries used by LD for shared libraries.
Current Value:
New Value (Enter to keep current value):
Variable Name: CMAKE_SHLIB_LINK_FLAGS
Description: Flags used to link a shared library.
Current Value:
New Value (Enter to keep current value):
Variable Name: CMAKE_SHLIB_RUNTIME_FLAG
Description: Flag used to specify run-time search paths.
Current Value:
New Value (Enter to keep current value):
Variable Name: CMAKE_SHLIB_RUNTIME_SEP
Description: If null, each runtime path is a separate option. Otherwise,
they are all joined, separated by this.
Current Value: :
New Value (Enter to keep current value):
Variable Name: CMAKE_SHLIB_SUFFIX
Description: Shared library suffix.
Current Value: .dylib
New Value (Enter to keep current value):
Variable Name: CMAKE_SKIP_RPATH
Description: If set, runtime paths are not added when using shared
libraries.
Current Value: NO
New Value (Enter to keep current value):
Variable Name: CMAKE_TEMPLATE_FLAGS
Description: CXX template flags used by compiler.
Current Value:
New Value (Enter to keep current value):
Variable Name: CMAKE_THREAD_LIBS
Description: Thread library used.
Current Value: -lpthread
New Value (Enter to keep current value):
Variable Name: CMAKE_USE_PTHREADS
Description: Use the pthreads library.
Current Value: 1
New Value (Enter to keep current value):
Variable Name: CMAKE_USE_SPROC
Description: Use sproc libs.
Current Value: 0
New Value (Enter to keep current value):
Variable Name: CMAKE_WORDS_BIGENDIAN
Description: is this system big endian
Current Value: 1
New Value (Enter to keep current value):
Variable Name: CMAKE_X_CFLAGS
Description: X11 extra flags.
Current Value: -I/usr/X11R6/include
New Value (Enter to keep current value):
Variable Name: CMAKE_X_LIBS
Description: Libraries and options used in X11 programs.
Current Value: -lSM -lICE -L/usr/X11R6/lib -lX11 -lXext
New Value (Enter to keep current value):
Variable Name: DART_ROOT
Description: If you have Dart installed, where is it located?
Current Value:
New Value (Enter to keep current value):
Variable Name: EXECUTABLE_OUTPUT_PATH
Description: Single output directory for building all executables.
Current Value: /usr/local/src/VTK/bin
New Value (Enter to keep current value):
Variable Name: JAVA_AWT_INCLUDE_PATH
Description: What is the path where the file jawt.h can be found
Current Value:
/System/Library/Frameworks/JavaEmbedding.framework/Versions/A/Headers
New Value (Enter to keep current value):
Variable Name: JAVA_AWT_LIBRARY
Description: Where can the jawt library be found
Current Value: -framework JavaEmbedding
New Value (Enter to keep current value):
Variable Name: JAVA_INCLUDE_PATH
Description: What is the path where the file jni.h can be found
Current Value: /System/Library/Frameworks/JavaVM.framework/Versions/A/Headers
New Value (Enter to keep current value):
Variable Name: JAVA_INCLUDE_PATH2
Description: What is the path where the file jni_md.h can be found
Current Value: /System/Library/Frameworks/JavaVM.framework/Versions/A/Headers/
New Value (Enter to keep current value):
Variable Name: LIBRARY_OUTPUT_PATH
Description: Single output directory for building all libraries.
Current Value: /usr/local/src/VTK/bin
New Value (Enter to keep current value):
Variable Name: OPENGL_INCLUDE_PATH
Description: What is the path where the file GL/gl.h can be found
Current Value: /System/Library/Frameworks/OpenGL.framework/Versions/A/Headers
New Value (Enter to keep current value):
Variable Name: OPENGL_LIBRARY
Description: Where can the GL library be found
Current Value: -framework AppKit -framework OpenGL
New Value (Enter to keep current value):
Variable Name: VTK_DATA_ROOT
Description: What is the path where the file VTKData.readme can be found
Current Value: /usr/local/share/VTKData
New Value (Enter to keep current value):
Variable Name: VTK_DEBUG_LEAKS
Description: Build leak checking support into vtk.
Current Value: OFF
New Value (Enter to keep current value):
Variable Name: VTK_JAVA_HOME
Description: Path to Java install
Current Value: /usr/local/src/VTK/java/vtk
New Value (Enter to keep current value):
Variable Name: VTK_MANGLE_MESA
Description: Use mangled Mesa with OpenGL
Current Value: OFF
New Value (Enter to keep current value):
Variable Name: VTK_OPENGL_HAS_OSMESA
Description: The opengl library being used supports off screen Mesa calls.
Current Value: OFF
New Value (Enter to keep current value):
Variable Name: VTK_PARSE_JAVA_EXE
Description: Path to an internal program.
Current Value: /usr/local/src/VTK/bin/./vtkParseJava
New Value (Enter to keep current value):
Variable Name: VTK_USE_64BIT_IDS
Description: Build VTK with 64 bit ids
Current Value: OFF
New Value (Enter to keep current value):
Variable Name: VTK_USE_ANSI_STDLIB
Description: Use the ANSI standard iostream library
Current Value: OFF
New Value (Enter to keep current value):
Variable Name: VTK_USE_HYBRID
Description: Build the hybrid directory classes
Current Value: OFF
New Value (Enter to keep current value):
Variable Name: VTK_USE_PARALLEL
Description: Build the parallel directory classes
Current Value: OFF
New Value (Enter to keep current value):
Variable Name: VTK_USE_PATENTED
Description: Build the patented directory classes, these classes are
patented and may require a license to use
Current Value: OFF
New Value (Enter to keep current value):
Variable Name: VTK_USE_QUARTZ
Description: Build classes for the Quartz window manager
Current Value: ON
New Value (Enter to keep current value):
Variable Name: VTK_USE_RENDERING
Description: Build the rendering classes used for displaying
Current Value: ON
New Value (Enter to keep current value):
Variable Name: VTK_USE_VOLUMEPRO
Description: Build VTK with volume pro support
Current Value: OFF
New Value (Enter to keep current value):
Variable Name: VTK_USE_X
Description: Build calsses for tha X window manager
Current Value: OFF
New Value (Enter to keep current value):
Variable Name: VTK_WRAP_HINTS
Description: Where can the hints file be found
Current Value: /usr/local/src/VTK/Wrapping/hints
New Value (Enter to keep current value):
Variable Name: VTK_WRAP_JAVA
Description: wrap classes into the Java language
Current Value: ON
New Value (Enter to keep current value):
Variable Name: VTK_WRAP_JAVA_EXE
Description: Path to an internal program.
Current Value: /usr/local/src/VTK/bin/./vtkWrapJava
New Value (Enter to keep current value):
Variable Name: VTK_WRAP_PYTHON
Description: wrap classes into the Python interpreted language
Current Value: OFF
New Value (Enter to keep current value):
Variable Name: VTK_WRAP_TCL
Description: wrap classes into the TCL intepreted language
Current Value: OFF
New Value (Enter to keep current value):
Once here, I did make and no error ocurred, but if I wanted to load libraries
in Java I had to create jnilib libraries. Then I create a unique library to
solve interdependencies problem doing:
c++ -bundle -g -O2 -fno-coalesce-templates -fno-coalesce-static-vtables
-I/usr/local/src/VTK/Common -I/usr/local/src/VTK/Rendering
-I/usr/local/src/VTK -I/usr/local/src/VTK/Common
-I/usr/local/src/VTK/Filtering -I/usr/local/src/VTK/Imaging
-I/usr/local/src/VTK/Graphics -I/usr/local/src/VTK/IO
-I/usr/local/src/VTK/Utilities/zlib -I/usr/local/src/VTK/Utilities/png
-I/usr/local/src/VTK/Utilities/jpeg -I/usr/local/src/VTK/Common/Testing/Cxx
-I/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers
-I/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers
-I/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers/
-I/System/Library/Frameworks/JavaEmbedding.framework/Versions/A/Headers
-DVTK_USE_QUARTZ -o /usr/local/src/VTK/bin/libvtkJava.jnilib
/usr/local/src/VTK/Common/*Java.o /usr/local/src/VTK/Common/vtkJavaUtil.o
/usr/local/src/VTK/Filtering/*Java.o /usr/local/src/VTK/Imaging/*Java.o
/usr/local/src/VTK/Graphics/*Java.o /usr/local/src/VTK/IO/*Java.o
/usr/local/src/VTK/Rendering/*Java.o -L/usr/local/src/VTK/bin/ -framework
JavaEmbedding -lpthread -lm -framework AppKit -framework OpenGL -lvtkCommon
-lvtkFiltering -lvtkImaging -lvtkGraphics -lvtkRendering -lvtkIO
And this is all. I had problems with vtkPanel (a Bus error) and I didn't know
how to solve it.
If I did any thing wrong or I have to do more other things, please tell me.
Thank you very much.
El Lun 17 Jun 2002 16:42, Yves Starreveld escribió:
> The Quartz classes were replaced with Carbon and Cocoa classes, since
> these are the names of the two different APIs to the Quartz Window
> Manager. I recommend building with the Carbon classes (option is set as
> default in CMakeCache.txt) since (currently) its integration with
> Apple's agl is better, so that fonts can be used in OpenGL graphics
> context using the aglUseFont call rather than using some CoreGraphics
> keniptions.
>
> Also, the Carbon API is accessible from C/C++ without needing to include
> ObjC calls, so the new files are .cxx files rather than .mm
>
> Yves
>
> On Monday, June 17, 2002, at 10:35 AM, Daniel Sáez Domingo wrote:
> > Hello, I once built VTK on a MAC OSX whith only quartz. Some features
> > with
> > Java doesn't function.
> > Now, I have download the Nightly SRC but I have find that
> > vtkQuartzImageWindow (.h .cxx) files don't appear in this version. Why?
> >
> > Thanks.
> > Daniel Saez
> > _______________________________________________
> > This is the private VTK discussion list.
> > Please keep messages on-topic. Check the FAQ at:
> > <http://public.kitware.com/cgi-bin/vtkfaq>
> > Follow this link to subscribe/unsubscribe:
> > http://public.kitware.com/mailman/listinfo/vtkusers
More information about the vtkusers
mailing list