gl-render.cc: framework OpenGL on MacOSX

classic Classic list List threaded Threaded
44 messages Options
123
Reply | Threaded
Open this post in threaded view
|

gl-render.cc: framework OpenGL on MacOSX

Thomas Treichl
Hi,

I'm currently trying to compile gl-render.cc against Mac's OpenGL framework. If
I compile against Mac's "X11/GL" then everything is just fine, but with
"framework OpenGL" I have got problems. I already was able to do a hack for this:

gl-render.cc: In member function 'virtual void opengl_renderer::draw(const
axes::properties&)':
gl-render.cc:595: error: invalid conversion from 'int*' to 'GLint*'
gl-render.cc:595: error:   initializing argument 2 of 'void
glGetIntegerv(GLenum, GLint*)'
gl-render.cc: In member function 'virtual void
opengl_renderer::init_marker(const std::string&, double, float)':
gl-render.cc:2634: error: invalid conversion from 'int*' to 'GLint*'
gl-render.cc:2634: error:   initializing argument 2 of 'void
glGetIntegerv(GLenum, GLint*)'

but I'm not able to find out what the compiler wants from me for this:

gl-render.cc: In member function 'virtual void opengl_tesselator::init()':
gl-render.cc:273: error: invalid conversion from 'void (*)()' to 'GLvoid (*)(...)'
gl-render.cc:273: error:   initializing argument 3 of 'void
gluTessCallback(GLUtesselator*, GLenum, GLvoid (*)(...))'
gl-render.cc:275: error: invalid conversion from 'void (*)()' to 'GLvoid (*)(...)'
gl-render.cc:275: error:   initializing argument 3 of 'void
gluTessCallback(GLUtesselator*, GLenum, GLvoid (*)(...))'
gl-render.cc:277: error: invalid conversion from 'void (*)()' to 'GLvoid (*)(...)'
gl-render.cc:277: error:   initializing argument 3 of 'void
gluTessCallback(GLUtesselator*, GLenum, GLvoid (*)(...))'
gl-render.cc:279: error: invalid conversion from 'void (*)()' to 'GLvoid (*)(...)'
gl-render.cc:279: error:   initializing argument 3 of 'void
gluTessCallback(GLUtesselator*, GLenum, GLvoid (*)(...))'
gl-render.cc:281: error: invalid conversion from 'void (*)()' to 'GLvoid (*)(...)'
gl-render.cc:281: error:   initializing argument 3 of 'void
gluTessCallback(GLUtesselator*, GLenum, GLvoid (*)(...))'
gl-render.cc:283: error: invalid conversion from 'void (*)()' to 'GLvoid (*)(...)'
gl-render.cc:283: error:   initializing argument 3 of 'void
gluTessCallback(GLUtesselator*, GLenum, GLvoid (*)(...))'

Looking inside the OpenGL framework I get:

bash$ grep -re "gluTessCallback" /System/Library/Frameworks/OpenGL.framework/*
/System/Library/Frameworks/OpenGL.framework/Headers/glu.h:extern void
gluTessCallback (GLUtesselator* tess, GLenum which, GLvoid (*CallBackFunc)());

Looking inside X11R6/GL I get:

bash$ grep -re "gluTessCallback" /usr/X11R6/include/GL/*.h
/usr/X11R6/include/GL/glu.h:extern void gluTessCallback (GLUtesselator* tess,
GLenum which, _GLUfuncptr CallBackFunc);
bash$ grep -re "_GLUfuncptr" /usr/X11R6/include/GL/*.h
/usr/X11R6/include/GL/glu.h:typedef GLvoid (*_GLUfuncptr)();
/usr/X11R6/include/GL/glu.h:typedef GLvoid (*_GLUfuncptr)(GLvoid);

Can somebody please send me a suggestion what I should change?

The second question is: Are there any other platforms that have a header
"OpenGL/gl.h" instead of "GL/gl.h" or do we just have this "OpenGL/gl.h" on Mac?
I'm asking this question because I'd like to adjust the test procedure
OCTAVE_OPENGL in aclocal.m4.

Best regards,

   Thomas
Reply | Threaded
Open this post in threaded view
|

Re: gl-render.cc: framework OpenGL on MacOSX

bpabbott
Administrator

On Jan 30, 2009, at 6:09 PM, Thomas Treichl wrote:

> Hi,
>
> I'm currently trying to compile gl-render.cc against Mac's OpenGL  
> framework. If I compile against Mac's "X11/GL" then everything is  
> just fine, but with "framework OpenGL" I have got problems. I  
> already was able to do a hack for this:
>
> gl-render.cc: In member function 'virtual void  
> opengl_renderer::draw(const
> axes::properties&)':
> gl-render.cc:595: error: invalid conversion from 'int*' to 'GLint*'
> gl-render.cc:595: error:   initializing argument 2 of 'void
> glGetIntegerv(GLenum, GLint*)'
> gl-render.cc: In member function 'virtual void
> opengl_renderer::init_marker(const std::string&, double, float)':
> gl-render.cc:2634: error: invalid conversion from 'int*' to 'GLint*'
> gl-render.cc:2634: error:   initializing argument 2 of 'void
> glGetIntegerv(GLenum, GLint*)'
>
> but I'm not able to find out what the compiler wants from me for this:
>
> gl-render.cc: In member function 'virtual void  
> opengl_tesselator::init()':
> gl-render.cc:273: error: invalid conversion from 'void (*)()' to  
> 'GLvoid (*)(...)'
> gl-render.cc:273: error:   initializing argument 3 of 'void
> gluTessCallback(GLUtesselator*, GLenum, GLvoid (*)(...))'
> gl-render.cc:275: error: invalid conversion from 'void (*)()' to  
> 'GLvoid (*)(...)'
> gl-render.cc:275: error:   initializing argument 3 of 'void
> gluTessCallback(GLUtesselator*, GLenum, GLvoid (*)(...))'
> gl-render.cc:277: error: invalid conversion from 'void (*)()' to  
> 'GLvoid (*)(...)'
> gl-render.cc:277: error:   initializing argument 3 of 'void
> gluTessCallback(GLUtesselator*, GLenum, GLvoid (*)(...))'
> gl-render.cc:279: error: invalid conversion from 'void (*)()' to  
> 'GLvoid (*)(...)'
> gl-render.cc:279: error:   initializing argument 3 of 'void
> gluTessCallback(GLUtesselator*, GLenum, GLvoid (*)(...))'
> gl-render.cc:281: error: invalid conversion from 'void (*)()' to  
> 'GLvoid (*)(...)'
> gl-render.cc:281: error:   initializing argument 3 of 'void
> gluTessCallback(GLUtesselator*, GLenum, GLvoid (*)(...))'
> gl-render.cc:283: error: invalid conversion from 'void (*)()' to  
> 'GLvoid (*)(...)'
> gl-render.cc:283: error:   initializing argument 3 of 'void
> gluTessCallback(GLUtesselator*, GLenum, GLvoid (*)(...))'
>
> Looking inside the OpenGL framework I get:
>
> bash$ grep -re "gluTessCallback" /System/Library/Frameworks/
> OpenGL.framework/*
> /System/Library/Frameworks/OpenGL.framework/Headers/glu.h:extern void
> gluTessCallback (GLUtesselator* tess, GLenum which, GLvoid  
> (*CallBackFunc)());
>
> Looking inside X11R6/GL I get:
>
> bash$ grep -re "gluTessCallback" /usr/X11R6/include/GL/*.h
> /usr/X11R6/include/GL/glu.h:extern void gluTessCallback  
> (GLUtesselator* tess,
> GLenum which, _GLUfuncptr CallBackFunc);
> bash$ grep -re "_GLUfuncptr" /usr/X11R6/include/GL/*.h
> /usr/X11R6/include/GL/glu.h:typedef GLvoid (*_GLUfuncptr)();
> /usr/X11R6/include/GL/glu.h:typedef GLvoid (*_GLUfuncptr)(GLvoid);
>
> Can somebody please send me a suggestion what I should change?
>
> The second question is: Are there any other platforms that have a  
> header "OpenGL/gl.h" instead of "GL/gl.h" or do we just have this  
> "OpenGL/gl.h" on Mac? I'm asking this question because I'd like to  
> adjust the test procedure OCTAVE_OPENGL in aclocal.m4.
>
> Best regards,
>
>  Thomas

I don't get those errors, and my config.log has

#define HAVE_OPENGL_GL_H 1
#define HAVE_OPENGL_GLU_H 1
#define HAVE_OPENGL 1

The configure options used (from config.log) are below

./configure --prefix=/sw FLIBS=/sw/lib/gcc4.3/lib/libgfortran.dylib  
F77=/sw/bin/gfortran --infodir=${prefix}/s      hare/info --mandir=$
{prefix}/share/man --libexecdir=${prefix}/lib -enable-shared -enable-
dl --disable-static --wit      hout-mpi --with-hdf5 --with-fftw  
CPPFLAGS=-g -I/sw/include -FOpenGL -I/sw/include/freetype2  FFLAGS=-g -
ff2c LDFLA      GS=-L/sw/lib/fltk-aqua/lib -L/sw/lib -lfltk_gl -
framework AGL -framework OpenGL -lfltk -lpthread -framework  
Carbon       --with-lapack=-Wl,-framework,Accelerate,-dylib_file,/
System/Library/Frameworks/Accelerate.framework/Versions/A/Fr      
ameworks/vecLib.framework/Versions/A/libLAPACK.dylib:/System/Library/
Frameworks/Accelerate.framework/Versions/A/Fr      ameworks/
vecLib.framework/Versions/A/libLAPACK.dylib --with-blas=-Wl,-
framework,Accelerate,-dylib_file,/System/Lib      rary/Frameworks/
Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/
libBLAS.dylib:/System/Libra      ry/Frameworks/Accelerate.framework/
Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib

Although I don't get errors, the new backend isn't functional for me  
either.

Ben

Reply | Threaded
Open this post in threaded view
|

Re: gl-render.cc: framework OpenGL on MacOSX

Shai Ayal-2
In reply to this post by Thomas Treichl
On Sat, Jan 31, 2009 at 1:09 AM, Thomas Treichl <[hidden email]> wrote:

> Hi,
>
> I'm currently trying to compile gl-render.cc against Mac's OpenGL framework.
> If I compile against Mac's "X11/GL" then everything is just fine, but with
> "framework OpenGL" I have got problems. I already was able to do a hack for
> this:
>
> gl-render.cc: In member function 'virtual void opengl_renderer::draw(const
> axes::properties&)':
> gl-render.cc:595: error: invalid conversion from 'int*' to 'GLint*'
> gl-render.cc:595: error:   initializing argument 2 of 'void
> glGetIntegerv(GLenum, GLint*)'
> gl-render.cc: In member function 'virtual void
> opengl_renderer::init_marker(const std::string&, double, float)':
> gl-render.cc:2634: error: invalid conversion from 'int*' to 'GLint*'
> gl-render.cc:2634: error:   initializing argument 2 of 'void
> glGetIntegerv(GLenum, GLint*)'
>
> but I'm not able to find out what the compiler wants from me for this:
>
> gl-render.cc: In member function 'virtual void opengl_tesselator::init()':
> gl-render.cc:273: error: invalid conversion from 'void (*)()' to 'GLvoid
> (*)(...)'
> gl-render.cc:273: error:   initializing argument 3 of 'void
> gluTessCallback(GLUtesselator*, GLenum, GLvoid (*)(...))'
> gl-render.cc:275: error: invalid conversion from 'void (*)()' to 'GLvoid
> (*)(...)'
> gl-render.cc:275: error:   initializing argument 3 of 'void
> gluTessCallback(GLUtesselator*, GLenum, GLvoid (*)(...))'
> gl-render.cc:277: error: invalid conversion from 'void (*)()' to 'GLvoid
> (*)(...)'
> gl-render.cc:277: error:   initializing argument 3 of 'void
> gluTessCallback(GLUtesselator*, GLenum, GLvoid (*)(...))'
> gl-render.cc:279: error: invalid conversion from 'void (*)()' to 'GLvoid
> (*)(...)'
> gl-render.cc:279: error:   initializing argument 3 of 'void
> gluTessCallback(GLUtesselator*, GLenum, GLvoid (*)(...))'
> gl-render.cc:281: error: invalid conversion from 'void (*)()' to 'GLvoid
> (*)(...)'
> gl-render.cc:281: error:   initializing argument 3 of 'void
> gluTessCallback(GLUtesselator*, GLenum, GLvoid (*)(...))'
> gl-render.cc:283: error: invalid conversion from 'void (*)()' to 'GLvoid
> (*)(...)'
> gl-render.cc:283: error:   initializing argument 3 of 'void
> gluTessCallback(GLUtesselator*, GLenum, GLvoid (*)(...))'
>

The type for the gluTessCallback was always problematic. In fact in
octplot I dedicated a whole h file just for gettign it right. Have a
look for what used to work for octplot:
http://octplot.svn.sourceforge.net/viewvc/octplot/trunk/octplot/src/glutesscb.h?revision=437&view=markup


> The second question is: Are there any other platforms that have a header
> "OpenGL/gl.h" instead of "GL/gl.h" or do we just have this "OpenGL/gl.h" on
> Mac? I'm asking this question because I'd like to adjust the test procedure
> OCTAVE_OPENGL in aclocal.m4.

Why don't you implement a test for the feature, not version -- i.e. if
"GL/gl.h" is not found, try "OpenGL/gl.h" ?

Shai
Reply | Threaded
Open this post in threaded view
|

Re: gl-render.cc: framework OpenGL on MacOSX

Thomas Treichl
Shai Ayal schrieb:

> On Sat, Jan 31, 2009 at 1:09 AM, Thomas Treichl <[hidden email]> wrote:
>> Hi,
>>
>> I'm currently trying to compile gl-render.cc against Mac's OpenGL framework.
>> If I compile against Mac's "X11/GL" then everything is just fine, but with
>> "framework OpenGL" I have got problems. I already was able to do a hack for
>> this:
>> but I'm not able to find out what the compiler wants from me for this:
>>
>> gl-render.cc: In member function 'virtual void opengl_tesselator::init()':
>> gl-render.cc:273: error: invalid conversion from 'void (*)()' to 'GLvoid
>> (*)(...)'
>> gl-render.cc:273: error:   initializing argument 3 of 'void
>> gluTessCallback(GLUtesselator*, GLenum, GLvoid (*)(...))'
>
> The type for the gluTessCallback was always problematic. In fact in
> octplot I dedicated a whole h file just for gettign it right. Have a
> look for what used to work for octplot:
> http://octplot.svn.sourceforge.net/viewvc/octplot/trunk/octplot/src/glutesscb.h?revision=437&view=markup

Thank you so much Shai, I nearly was going crazy ;) My quick hack in line 224 of
gl-render.cc now is

   typedef GLvoid (CALLBACK *fcn) (...);

instead of

   typedef void (CALLBACK *fcn) (void);

I didn't know that (...) is something C++ valid. I can continue working on
gl-render.cc in the evening. Thanks again!

>> The second question is: Are there any other platforms that have a header
>> "OpenGL/gl.h" instead of "GL/gl.h" or do we just have this "OpenGL/gl.h" on
>> Mac? I'm asking this question because I'd like to adjust the test procedure
>> OCTAVE_OPENGL in aclocal.m4.
>
> Why don't you implement a test for the feature, not version -- i.e. if
> "GL/gl.h" is not found, try "OpenGL/gl.h" ?

Right now "GL/gl.h" is found and "OpenGL/gl.h" is found, it depends on which
-Ipath is given first ;) I'll have a look how I put the test for framework
OpenGL into configure.in.

Best regards,

   Thomas

Reply | Threaded
Open this post in threaded view
|

Re: gl-render.cc: framework OpenGL on MacOSX

Thomas Treichl
In reply to this post by bpabbott
Ben Abbott schrieb:

>
> I don't get those errors, and my config.log has
>
> #define HAVE_OPENGL_GL_H 1
> #define HAVE_OPENGL_GLU_H 1
> #define HAVE_OPENGL 1
>
> The configure options used (from config.log) are below
>
> ./configure --prefix=/sw FLIBS=/sw/lib/gcc4.3/lib/libgfortran.dylib
> F77=/sw/bin/gfortran --infodir=${prefix}/s      hare/info
> --mandir=${prefix}/share/man --libexecdir=${prefix}/lib -enable-shared
> -enable-dl --disable-static --wit      hout-mpi --with-hdf5 --with-fftw
> CPPFLAGS=-g -I/sw/include -FOpenGL -I/sw/include/freetype2  FFLAGS=-g
> -ff2c LDFLA      GS=-L/sw/lib/fltk-aqua/lib -L/sw/lib -lfltk_gl
> -framework AGL -framework OpenGL -lfltk -lpthread -framework
> Carbon      
> --with-lapack=-Wl,-framework,Accelerate,-dylib_file,/System/Library/Frameworks/Accelerate.framework/Versions/A/Fr      
> ameworks/vecLib.framework/Versions/A/libLAPACK.dylib:/System/Library/Frameworks/Accelerate.framework/Versions/A/Fr      
> ameworks/vecLib.framework/Versions/A/libLAPACK.dylib
> --with-blas=-Wl,-framework,Accelerate,-dylib_file,/System/Lib      
> rary/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib:/System/Libra      
> ry/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
>

Hi Ben,

can you please run this and send the output back. I expect we also have a API
change between 10.4.11 and 10.5.x:

bash$ grep -re "gluTessCallback" \
/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers/glu.h

and this one please

bash$ grep -re "glGetIntegerv" \
/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers/gl.h

> Although I don't get errors, the new backend isn't functional for me
> either.

That is not quite correct. It does work very well - what does not work is
resizing the figure window and therefore the callback if the figure window
should be resized. I spent some time some while ago to find out what is going
wrong, but I've not been successful - maybe somebody else on a Mac can have a
look at this (but I still expect it has nothing to do with the sources Octave -
I expect the problem is in the sources of fltk).

Meanwhile you can change the function "default_size" in
src/DLD-functions/fltk_backend.cc to this:

   void default_size (int& x, int& y, int& w, int& h)
   {
     x = 0;
     y = 0;
     w = 560;
     h = 440;
   }

then your drawings should be good (mouse resizing window still without
functionality). Am I right or wrong?

Best regards,

   Thomas
Reply | Threaded
Open this post in threaded view
|

Re: gl-render.cc: framework OpenGL on MacOSX

c.-2
In reply to this post by Thomas Treichl

On 31 Jan 2009, at 08:50, [hidden email] wrote:

> Why don't you implement a test for the feature, not version -- i.e. if
> "GL/gl.h" is not found, try "OpenGL/gl.h" ?
>
> Shai

I sent a patch for doing this some time ago, I'll look for it in the  
list archives...
c.

Reply | Threaded
Open this post in threaded view
|

Re: gl-render.cc: framework OpenGL on MacOSX

bpabbott
Administrator
In reply to this post by Thomas Treichl

On Jan 31, 2009, at 3:50 AM, Thomas Treichl wrote:

> Ben Abbott schrieb:
>> I don't get those errors, and my config.log has
>> #define HAVE_OPENGL_GL_H 1
>> #define HAVE_OPENGL_GLU_H 1
>> #define HAVE_OPENGL 1
>> The configure options used (from config.log) are below
>> ./configure --prefix=/sw FLIBS=/sw/lib/gcc4.3/lib/libgfortran.dylib  
>> F77=/sw/bin/gfortran --infodir=${prefix}/s      hare/info --mandir=$
>> {prefix}/share/man --libexecdir=${prefix}/lib -enable-shared -
>> enable-dl --disable-static --wit      hout-mpi --with-hdf5 --with-
>> fftw CPPFLAGS=-g -I/sw/include -FOpenGL -I/sw/include/freetype2  
>> FFLAGS=-g -ff2c LDFLA      GS=-L/sw/lib/fltk-aqua/lib -L/sw/lib -
>> lfltk_gl -framework AGL -framework OpenGL -lfltk -lpthread -
>> framework Carbon       --with-lapack=-Wl,-framework,Accelerate,-
>> dylib_file,/System/Library/Frameworks/Accelerate.framework/Versions/
>> A/Fr      ameworks/vecLib.framework/Versions/A/libLAPACK.dylib:/
>> System/Library/Frameworks/Accelerate.framework/Versions/A/Fr      
>> ameworks/vecLib.framework/Versions/A/libLAPACK.dylib --with-blas=-
>> Wl,-framework,Accelerate,-dylib_file,/System/Lib      rary/
>> Frameworks/Accelerate.framework/Versions/A/Frameworks/
>> vecLib.framework/Versions/A/libBLAS.dylib:/System/Libra      ry/
>> Frameworks/Accelerate.framework/Versions/A/Frameworks/
>> vecLib.framework/Versions/A/libBLAS.dylib
>
> Hi Ben,
>
> can you please run this and send the output back. I expect we also  
> have a API change between 10.4.11 and 10.5.x:
>
> bash$ grep -re "gluTessCallback" \
> /System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers/
> glu.h
>
> and this one please
>
> bash$ grep -re "glGetIntegerv" \
> /System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers/
> gl.h

bens-macbook:~ bpabbott$  grep -re "gluTessCallback" \
 > /System/Library/Frameworks/OpenGL.framework/Versions/Current/
Headers/glu.h
extern void gluTessCallback (GLUtesselator* tess, GLenum which, GLvoid  
(*CallBackFunc)());
bens-macbook:~ bpabbott$ grep -re "glGetIntegerv" \
 > /System/Library/Frameworks/OpenGL.framework/Versions/Current/
Headers/gl.h
typedef void (* glGetIntegervProcPtr) (GLenum pname, GLint *params);
extern void glGetIntegerv (GLenum pname, GLint *params);

>> Although I don't get errors, the new backend isn't functional for  
>> me either.
>
> That is not quite correct. It does work very well - what does not  
> work is resizing the figure window and therefore the callback if the  
> figure window should be resized. I spent some time some while ago to  
> find out what is going wrong, but I've not been successful - maybe  
> somebody else on a Mac can have a look at this (but I still expect  
> it has nothing to do with the sources Octave - I expect the problem  
> is in the sources of fltk).
>
> Meanwhile you can change the function "default_size" in src/DLD-
> functions/fltk_backend.cc to this:
>
>  void default_size (int& x, int& y, int& w, int& h)
>  {
>    x = 0;
>    y = 0;
>    w = 560;
>    h = 440;
>  }
>
> then your drawings should be good (mouse resizing window still  
> without functionality). Am I right or wrong?

My problems are more complicated. I get a window, but rather than  
containing the proper image/plot it contains pieces of other things on  
my screen (related to Fink I think). For the time being, I have no  
real interest in fixing that particular problem. Instead I'm looking  
at what can be done to improve the gnuplot backend and improving lower  
level support for the backend (property related stuff and soon  
listeners).

Ben




Reply | Threaded
Open this post in threaded view
|

Re: gl-render.cc: framework OpenGL on MacOSX

Shai Ayal-2
In reply to this post by Thomas Treichl
On Sat, Jan 31, 2009 at 10:50 AM, Thomas Treichl <[hidden email]> wrote:

> Ben Abbott schrieb:
>>
>> I don't get those errors, and my config.log has
>>
>> #define HAVE_OPENGL_GL_H 1
>> #define HAVE_OPENGL_GLU_H 1
>> #define HAVE_OPENGL 1
>>
>> The configure options used (from config.log) are below
>>
>> ./configure --prefix=/sw FLIBS=/sw/lib/gcc4.3/lib/libgfortran.dylib
>> F77=/sw/bin/gfortran --infodir=${prefix}/s      hare/info
>> --mandir=${prefix}/share/man --libexecdir=${prefix}/lib -enable-shared
>> -enable-dl --disable-static --wit      hout-mpi --with-hdf5 --with-fftw
>> CPPFLAGS=-g -I/sw/include -FOpenGL -I/sw/include/freetype2  FFLAGS=-g -ff2c
>> LDFLA      GS=-L/sw/lib/fltk-aqua/lib -L/sw/lib -lfltk_gl -framework AGL
>> -framework OpenGL -lfltk -lpthread -framework Carbon
>> --with-lapack=-Wl,-framework,Accelerate,-dylib_file,/System/Library/Frameworks/Accelerate.framework/Versions/A/Fr
>>
>>  ameworks/vecLib.framework/Versions/A/libLAPACK.dylib:/System/Library/Frameworks/Accelerate.framework/Versions/A/Fr
>>      ameworks/vecLib.framework/Versions/A/libLAPACK.dylib
>> --with-blas=-Wl,-framework,Accelerate,-dylib_file,/System/Lib
>>  rary/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib:/System/Libra
>>
>>  ry/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
>
> Hi Ben,
>
> can you please run this and send the output back. I expect we also have a
> API change between 10.4.11 and 10.5.x:
>
> bash$ grep -re "gluTessCallback" \
> /System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers/glu.h
>
> and this one please
>
> bash$ grep -re "glGetIntegerv" \
> /System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers/gl.h
>
>> Although I don't get errors, the new backend isn't functional for me
>> either.
>
> That is not quite correct. It does work very well - what does not work is
> resizing the figure window and therefore the callback if the figure window
> should be resized. I spent some time some while ago to find out what is
> going wrong, but I've not been successful - maybe somebody else on a Mac can
> have a look at this (but I still expect it has nothing to do with the
> sources Octave - I expect the problem is in the sources of fltk).

This problem is addressed by using a post-compile stage with fltk on OSX:
see what the "fltk-config --post" command does on your system (on mine
it simply does nothing).

Shai
Reply | Threaded
Open this post in threaded view
|

Re: gl-render.cc: framework OpenGL on MacOSX

Thomas Treichl
In reply to this post by bpabbott
Ben Abbott schrieb:
> bens-macbook:~ bpabbott$  grep -re "gluTessCallback" \
> /System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers/glu.h
> extern void gluTessCallback (GLUtesselator* tess, GLenum which, GLvoid
> (*CallBackFunc)());

This is the same than on my Mac.

> bens-macbook:~ bpabbott$ grep -re "glGetIntegerv" \
> /System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers/gl.h
> typedef void (* glGetIntegervProcPtr) (GLenum pname, GLint *params);
> extern void glGetIntegerv (GLenum pname, GLint *params);

This also is the same than on my Mac.

The API has not changed between 10.4.11 and 10.5.x. Now I'm completely confused
why I get an error if I mix up "int *" with "GLint *" and you don't get an
error. Is there a third OpenGL library on your Mac, maybe it comes with Fink? If
that is true can you find for me the gl.h please, somehow like this

bash$ find /sw -iname gl.h

or even better, can you send me the output of this please

bash$ find / -iname gl.h

I will do some tests and write a small script and/or program we can then play
with (if you want to). I suspect something is being set wrong.

> My problems are more complicated. I get a window, but rather than
> containing the proper image/plot it contains pieces of other things on
> my screen (related to Fink I think). For the time being, I have no real
> interest in fixing that particular problem. Instead I'm looking at what
> can be done to improve the gnuplot backend and improving lower level
> support for the backend (property related stuff and soon listeners).

So I was wrong ;)

Yes I know that you're working on the Gnuplot backend, I sometimes have a look
at that many changesets you send ;) Thanks for them! But if you don't mind I
send the one or more source file to you in the near future for tests on a 10.5
system - currently nobody else joined up as volunteer ;(

Best regards,

   Thomas
Reply | Threaded
Open this post in threaded view
|

Re: gl-render.cc: framework OpenGL on MacOSX

Thomas Treichl
In reply to this post by Shai Ayal-2
Shai Ayal schrieb:

> On Sat, Jan 31, 2009 at 10:50 AM, Thomas Treichl <[hidden email]> wrote:
>> That is not quite correct. It does work very well - what does not work is
>> resizing the figure window and therefore the callback if the figure window
>> should be resized. I spent some time some while ago to find out what is
>> going wrong, but I've not been successful - maybe somebody else on a Mac can
>> have a look at this (but I still expect it has nothing to do with the
>> sources Octave - I expect the problem is in the sources of fltk).
>
> This problem is addressed by using a post-compile stage with fltk on OSX:
> see what the "fltk-config --post" command does on your system (on mine
> it simply does nothing).

I already tried this so often without any success. It seems like "fltk-config
--post" also does not change anything with the files I take as input (neither
the Octave main binary or the fltk_backend.oct file). Maybe it has to do with
that fltk_backend.oct is not a program but a dynamic lib file - I can't say, I'm
not an expert on this...

Thanks again,

   Thomas
Reply | Threaded
Open this post in threaded view
|

Re: gl-render.cc: framework OpenGL on MacOSX

Shai Ayal-2
On Sat, Jan 31, 2009 at 9:20 PM, Thomas Treichl <[hidden email]> wrote:

> Shai Ayal schrieb:
>>
>> On Sat, Jan 31, 2009 at 10:50 AM, Thomas Treichl <[hidden email]>
>> wrote:
>>>
>>> That is not quite correct. It does work very well - what does not work is
>>> resizing the figure window and therefore the callback if the figure
>>> window
>>> should be resized. I spent some time some while ago to find out what is
>>> going wrong, but I've not been successful - maybe somebody else on a Mac
>>> can
>>> have a look at this (but I still expect it has nothing to do with the
>>> sources Octave - I expect the problem is in the sources of fltk).
>>
>> This problem is addressed by using a post-compile stage with fltk on OSX:
>> see what the "fltk-config --post" command does on your system (on mine
>> it simply does nothing).
>
> I already tried this so often without any success. It seems like
> "fltk-config --post" also does not change anything with the files I take as
> input (neither the Octave main binary or the fltk_backend.oct file). Maybe
> it has to do with that fltk_backend.oct is not a program but a dynamic lib
> file - I can't say, I'm not an expert on this...

Maybe you can gain some insight from the fltk README.mac file:
http://svn.easysw.com/public/fltk/fltk/tags/branch-1.1.9/README.mac

Also, what verdion of fltk are you using? reading the README.mac file
for version <=1.1.7 I see the following:

KNOWN MacFLTK BUGS

    The following FLTK things are not implemented or don't work
    at present:
       ....
        - OpenGL subwindow during window resize changes position

So maybe an fltk upgrade will solve this problem?

Shai
Reply | Threaded
Open this post in threaded view
|

Re: gl-render.cc: framework OpenGL on MacOSX

bpabbott
Administrator
In reply to this post by Thomas Treichl

On Jan 31, 2009, at 2:17 PM, Thomas Treichl wrote:

> Ben Abbott schrieb:
>> bens-macbook:~ bpabbott$  grep -re "gluTessCallback" \
>> /System/Library/Frameworks/OpenGL.framework/Versions/Current/
>> Headers/glu.h
>> extern void gluTessCallback (GLUtesselator* tess, GLenum which,  
>> GLvoid (*CallBackFunc)());
>
> This is the same than on my Mac.
>
>> bens-macbook:~ bpabbott$ grep -re "glGetIntegerv" \
>> /System/Library/Frameworks/OpenGL.framework/Versions/Current/
>> Headers/gl.h
>> typedef void (* glGetIntegervProcPtr) (GLenum pname, GLint *params);
>> extern void glGetIntegerv (GLenum pname, GLint *params);
>
> This also is the same than on my Mac.
>
> The API has not changed between 10.4.11 and 10.5.x. Now I'm  
> completely confused why I get an error if I mix up "int *" with  
> "GLint *" and you don't get an error. Is there a third OpenGL  
> library on your Mac, maybe it comes with Fink? If that is true can  
> you find for me the gl.h please, somehow like this
>
> bash$ find /sw -iname gl.h

This migh explain my problems with the new backend.

bens-macbook:~ bpabbott$ find /sw -iname gl.h
/sw/include/FL/gl.h
/sw/include/mesa/GL/gl.h
/sw/src/fink.build/jogl-1.1.1-1/jogl/make/stub_includes/opengl/GL/gl.h

> or even better, can you send me the output of this please
>
> bash$ find / -iname gl.h

I've removed the "permssion denied" warnings, as well as some local  
versions in located in some sources in my home folder (not in any path).

bens-macbook:~ bpabbott$ find / -iname gl.h
/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/
AGL.framework/Versions/A/Headers/gl.h
/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/
OpenGL.framework/Versions/A/Headers/gl.h
/Developer/SDKs/MacOSX10.4u.sdk/usr/X11R6/include/GL/gl.h
/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/AGL.framework/
Versions/A/Headers/gl.h
/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/
OpenGL.framework/Versions/A/Headers/gl.h
/Developer/SDKs/MacOSX10.5.sdk/usr/X11/include/GL/gl.h
/sw/include/FL/gl.h
/sw/include/mesa/GL/gl.h
/sw/src/fink.build/jogl-1.1.1-1/jogl/make/stub_includes/opengl/GL/gl.h
/System/Library/Frameworks/AGL.framework/Versions/A/Headers/gl.h
/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers/gl.h
/usr/X11/include/GL/gl.h
/usr/X11R6 1/include/GL/gl.h

> I will do some tests and write a small script and/or program we can  
> then play with (if you want to). I suspect something is being set  
> wrong.

I'm always happy to help out.

>> My problems are more complicated. I get a window, but rather than  
>> containing the proper image/plot it contains pieces of other things  
>> on my screen (related to Fink I think). For the time being, I have  
>> no real interest in fixing that particular problem. Instead I'm  
>> looking at what can be done to improve the gnuplot backend and  
>> improving lower level support for the backend (property related  
>> stuff and soon listeners).
>
> So I was wrong ;)
>
> Yes I know that you're working on the Gnuplot backend, I sometimes  
> have a look at that many changesets you send ;) Thanks for them! But  
> if you don't mind I send the one or more source file to you in the  
> near future for tests on a 10.5 system - currently nobody else  
> joined up as volunteer ;(

Send all the files you want. I'm happy to do testing on Leopard.

Ben

Reply | Threaded
Open this post in threaded view
|

Re: gl-render.cc: framework OpenGL on MacOSX

Thomas Treichl
Ben Abbott schrieb:
> Send all the files you want. I'm happy to do testing on Leopard.

Hi Ben,

I think I got it. I did some more Internet search and found a nice
implementation that (from my point of view) is not the way how we should do it:

   #if defined(__APPLE_CC__) && __APPLE_CC__ > 4000 &&
    __APPLE_CC__ < 5450 && !defined(__INTEL_COMPILER)
      typedef GLvoid (*GLUTesselatorFunction)(...);
   #elif defined( __mips ) || defined( __linux__ ) || defined( __FreeBSD__ ) ||
    defined( __OpenBSD__ ) || defined( __sun ) || defined (__CYGWIN__) ||
    defined (__APPLE__)
      typedef GLvoid (*GLUTesselatorFunction)();
   <SNIP>

but there are also some good implementations for this problem, eg.

   http://autoconf-archive.cryp.to/ax_check_glu.html

I created another macro "OCTAVE_GLUTESSCALLBACK_THREEDOTS" that is called if a
valid framework OpenGL is found. It separates the way of calling gluTessCallback
on our different Mac systems.

I attached a script "configure.in" to this email, can you please try this on
your system (there are some files created while doing autoheader and autoconf,
so the best would be if you put configure.in into /tmp and work there):

   bash$ autoheader && autoconf && ./configure

The relevant output on my machine that should be checked on your Mac is:

   checking whether ld accepts -framework OpenGL... yes
   configure: adding -Wl,-framework -Wl,OpenGL to OPENGL_LIBS
   checking whether gluTessCallback is called with "(...)"... yes
   OPENGL_LIBS: -Wl,-framework -Wl,OpenGL

On your Mac it should be "checking whether gluTessCallback is called with
"(...)"... no". The second test is

   bash$ autoheader && autoconf && ./configure --without-framework-opengl

my output once again then is

   checking whether ld accepts -framework OpenGL... yes
   configure: Framework rejected by --without-framework-opengl
   checking for GL/gl.h... no
   checking for OpenGL/gl.h... yes
   checking for GL/glu.h... no
   checking for OpenGL/glu.h... yes
   checking for glEnable in -lGL... yes
   OPENGL_LIBS: -L/usr/X11R6/lib -lGL -lGLU

ie. the OpenGL libs from our X11 system are taken. If this works and there is no
other objection then I'll prepare the changeset for Octave and Mac's framework
OpenGL.

Best regards,

   Thomas

PS. Can somebody on a GNU/Linux box please check this, too, so that I can be
sure that I didn't damage anything else.

AC_INIT
AC_REVISION($Revision: 1.0 $)
AC_PREREQ(2.57)
AC_CONFIG_HEADER(config.h)

dnl
dnl Check to see if the compiler and the linker can handle the flags
dnl "-framework $1" for the given prologue $2 and the given body $3 of
dnl a source file.  Arguments 2 and 3 optionally can also be empty.
dnl Add options (lower case letters $1) "--with-framework-$1" and
dnl "--without-framework-$1". If this test is successful then perform
dnl $4, otherwise do $5.
dnl
dnl OCTAVE_HAVE_FRAMEWORK
AC_DEFUN(OCTAVE_HAVE_FRAMEWORK, [
  AC_MSG_CHECKING(whether ${LD-ld} accepts -framework $1)
  AC_CACHE_VAL(octave_cv_framework_$1, [
    XLDFLAGS="$LDFLAGS"
    LDFLAGS="$LDFLAGS -framework $1"
    AC_LANG_PUSH(C++)
    AC_LINK_IFELSE([AC_LANG_PROGRAM([$2], [$3])],
      eval "octave_cv_framework_$1=yes",
      eval "octave_cv_framework_$1=no")
    AC_LANG_POP(C++)
    LDFLAGS="$XLDFLAGS"
  ])
  if test "$octave_cv_framework_$1" = "yes"; then
    AC_MSG_RESULT(yes)
    AC_ARG_WITH(framework-m4_tolower($1),
      [AS_HELP_STRING([--without-framework-m4_tolower($1)],
        [don't use framework $1])],
         with_have_framework=$withval, with_have_framework="yes")
    if test "$with_have_framework" = "yes"; then
      [$4]
    else
      AC_MSG_NOTICE([Framework rejected by --without-framework-m4_tolower($1)])
      [$5]
    fi
  else
    AC_MSG_RESULT(no)
    [$5]
  fi
])

dnl
dnl See if function gluTessCallback is called with "(...)"
dnl
AC_DEFUN(OCTAVE_GLUTESSCALLBACK_THREEDOTS,
[AC_CACHE_CHECK([whether gluTessCallback is called with "(...)"],
octave_cv_glutesscallback_threedots,
[AC_LANG_PUSH(C++)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifdef HAVE_GL_GLU_H
#include <GL/glu.h>
#elif defined HAVE_OPENGL_GLU_H || defined HAVE_FRAMEWORK_OPENGL
#include <OpenGL/glu.h>
#endif]],
[[GLvoid (*func)(...); gluTessCallback(0, 0, func);]])],
octave_cv_glutesscallback_threedots="yes", octave_cv_glutesscallback_threedots="no")])
AC_LANG_POP(C++)
if test $octave_cv_glutesscallback_threedots = "yes"; then
  AC_DEFINE(HAVE_GLUTESSCALLBACK_THREEDOTS, 1,
    [Define if gluTessCallback is called with (...)])
fi
])

dnl
dnl Check for OpenGL. If found, define OPENGL_LIBS
dnl
AC_DEFUN([OCTAVE_OPENGL], [
OPENGL_LIBS=
### On MacOSX systems the OpenGL framework can be used
OCTAVE_HAVE_FRAMEWORK(OpenGL, [
#include <OpenGL/gl.h>
#include <OpenGL/glu.h> ], [GLint par; glGetIntegerv (GL_VIEWPORT, &par);],
  [have_framework_opengl="yes"], [have_framework_opengl="no"])

if test $have_framework_opengl = "yes"; then
  AC_DEFINE(HAVE_FRAMEWORK_OPENGL, 1, [Define if framework OPENGL is available.])
  OPENGL_LIBS="-Wl,-framework -Wl,OpenGL"
  AC_MSG_NOTICE([adding -Wl,-framework -Wl,OpenGL to OPENGL_LIBS])
  OCTAVE_GLUTESSCALLBACK_THREEDOTS
else
  case $canonical_host_type in
    *-*-mingw32* | *-*-msdosmsvc)
      AC_CHECK_HEADERS(windows.h)
    ;;
  esac
  have_opengl_incs=no
  AC_CHECK_HEADERS([GL/gl.h OpenGL/gl.h], [
    AC_CHECK_HEADERS([GL/glu.h OpenGL/glu.h], [
      have_opengl_incs=yes; break], [], [
#ifdef HAVE_WINDOWS_H
#include <windows.h>
#endif
    ])
    break
    ], [], [
#ifdef HAVE_WINDOWS_H
#include <windows.h>
#endif
    ])

  if test "$have_opengl_incs" = "yes"; then
    case $canonical_host_type in
      *-*-mingw32* | *-*-msdosmsvc)
        save_LIBS="$LIBS"
        LIBS="$LIBS -lopengl32"
        AC_MSG_CHECKING([for glEnable in -lopengl32])
        AC_TRY_LINK([
#if HAVE_WINDOWS_H
#include <windows.h>
#endif
#if defined (HAVE_GL_GL_H)
#include <GL/gl.h>
#elif defined (HAVE_OPENGL_GL_H)
#include <OpenGL/gl.h>
#endif
], [glEnable(GL_SMOOTH);], OPENGL_LIBS="-lopengl32 -lglu32")
        LIBS="$save_LIBS"
        if test "x$OPENGL_LIBS" != "x"; then
          AC_MSG_RESULT(yes)
        else
          AC_MSG_RESULT(no)
        fi
        ;;
      *)
        save_LDFLAGS="$LDFLAGS"
        LDFLAGS="$LDFLAGS -L/usr/X11R6/lib"
        AC_CHECK_LIB(GL, glEnable, OPENGL_LIBS="-L/usr/X11R6/lib -lGL -lGLU")
        LDFLAGS="$save_LDFLAGS"
        ;;
    esac
  fi
fi
AC_SUBST(OPENGL_LIBS)
])

dnl
dnl
dnl


OCTAVE_OPENGL
echo "OPENGL_LIBS: $OPENGL_LIBS"

AC_OUTPUT
Reply | Threaded
Open this post in threaded view
|

Re: gl-render.cc: framework OpenGL on MacOSX

Shai Ayal-2
On Sun, Feb 8, 2009 at 11:31 AM, Thomas Treichl <[hidden email]> wrote:
>
> PS. Can somebody on a GNU/Linux box please check this, too, so that I can be
> sure that I didn't damage anything else.

on a fedora 8 machine:

[shaia@mars Download]$ autoheader && autoconf && ./configure
checking for g++... g++
checking for C++ compiler default output file name... a.out
checking whether the C++ compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking whether ld accepts -framework OpenGL... no
checking for GL/gl.h... yes
checking for GL/glu.h... yes
checking for glEnable in -lGL... yes
OPENGL_LIBS: -L/usr/X11R6/lib -lGL -lGLU
configure: creating ./config.status
config.status: creating config.h

[shaia@mars Download]$ autoheader && autoconf && ./configure
--without-framework-opengl
checking for g++... g++
checking for C++ compiler default output file name... a.out
checking whether the C++ compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking whether ld accepts -framework OpenGL... no
checking for GL/gl.h... yes
checking for GL/glu.h... yes
checking for glEnable in -lGL... yes
OPENGL_LIBS: -L/usr/X11R6/lib -lGL -lGLU
configure: creating ./config.status
config.status: creating config.h
config.status: config.h is unchanged
[
Reply | Threaded
Open this post in threaded view
|

Re: gl-render.cc: framework OpenGL on MacOSX

Thomas Treichl
Shai Ayal schrieb:
> On Sun, Feb 8, 2009 at 11:31 AM, Thomas Treichl <[hidden email]> wrote:
>> PS. Can somebody on a GNU/Linux box please check this, too, so that I can be
>> sure that I didn't damage anything else.
>
> on a fedora 8 machine:

It looks good, thanks,

   Thomas
Reply | Threaded
Open this post in threaded view
|

Re: gl-render.cc: framework OpenGL on MacOSX

bpabbott
Administrator
In reply to this post by Thomas Treichl

On Feb 8, 2009, at 4:31 AM, Thomas Treichl wrote:

> Ben Abbott schrieb:
>> Send all the files you want. I'm happy to do testing on Leopard.
>
> Hi Ben,
>
> I think I got it. I did some more Internet search and found a nice  
> implementation that (from my point of view) is not the way how we  
> should do it:
>
>  #if defined(__APPLE_CC__) && __APPLE_CC__ > 4000 &&
>   __APPLE_CC__ < 5450 && !defined(__INTEL_COMPILER)
>     typedef GLvoid (*GLUTesselatorFunction)(...);
>  #elif defined( __mips ) || defined( __linux__ ) ||  
> defined( __FreeBSD__ ) ||
>   defined( __OpenBSD__ ) || defined( __sun ) || defined (__CYGWIN__)  
> ||
>   defined (__APPLE__)
>     typedef GLvoid (*GLUTesselatorFunction)();
>  <SNIP>
>
> but there are also some good implementations for this problem, eg.
>
>  http://autoconf-archive.cryp.to/ax_check_glu.html
>
> I created another macro "OCTAVE_GLUTESSCALLBACK_THREEDOTS" that is  
> called if a valid framework OpenGL is found. It separates the way of  
> calling gluTessCallback on our different Mac systems.
>
> I attached a script "configure.in" to this email, can you please try  
> this on your system (there are some files created while doing  
> autoheader and autoconf, so the best would be if you put  
> configure.in into /tmp and work there):
>
>  bash$ autoheader && autoconf && ./configure
>
> The relevant output on my machine that should be checked on your Mac  
> is:
>
>  checking whether ld accepts -framework OpenGL... yes
>  configure: adding -Wl,-framework -Wl,OpenGL to OPENGL_LIBS
>  checking whether gluTessCallback is called with "(...)"... yes
>  OPENGL_LIBS: -Wl,-framework -Wl,OpenGL
>
> On your Mac it should be "checking whether gluTessCallback is called  
> with "(...)"... no". The second test is

$ autoheader && autoconf && ./configure
checking for g++... g++
checking for C++ compiler default output file name... a.out
checking whether the C++ compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking whether ld accepts -framework OpenGL... yes
configure: adding -Wl,-framework -Wl,OpenGL to OPENGL_LIBS
checking whether gluTessCallback is called with "(...)"... no
OPENGL_LIBS: -Wl,-framework -Wl,OpenGL
configure: creating ./config.status
config.status: creating config.h

>  bash$ autoheader && autoconf && ./configure --without-framework-
> opengl
>
> my output once again then is
>
>  checking whether ld accepts -framework OpenGL... yes
>  configure: Framework rejected by --without-framework-opengl
>  checking for GL/gl.h... no
>  checking for OpenGL/gl.h... yes
>  checking for GL/glu.h... no
>  checking for OpenGL/glu.h... yes
>  checking for glEnable in -lGL... yes
>  OPENGL_LIBS: -L/usr/X11R6/lib -lGL -lGLU
>
> ie. the OpenGL libs from our X11 system are taken. If this works and  
> there is no other objection then I'll prepare the changeset for  
> Octave and Mac's framework OpenGL.

$ autoheader && autoconf && ./configure --without-framework-opengl
checking for g++... g++
checking for C++ compiler default output file name... a.out
checking whether the C++ compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking whether ld accepts -framework OpenGL... yes
configure: Framework rejected by --without-framework-opengl
checking for GL/gl.h... no
checking for OpenGL/gl.h... yes
checking for GL/glu.h... no
checking for OpenGL/glu.h... yes
checking for glEnable in -lGL... yes
OPENGL_LIBS: -L/usr/X11R6/lib -lGL -lGLU
configure: creating ./config.status
config.status: creating config.h

Looks good!

Ben
Reply | Threaded
Open this post in threaded view
|

Re: gl-render.cc: framework OpenGL on MacOSX

Thomas Treichl
Ben Abbott schrieb:
> Looks good!

Ok, thanks. I attached the changeset to add support for "framework OpenGL" on Macs.

Best regards,

   Thomas

# HG changeset patch
# User Thomas Treichl <[hidden email]>
# Date 1234128246 -3600
# Node ID 4dd64abe72da6866f16424836518c38c92257469
# Parent  b227213a70c3c2848af47db7e94f1d7bd63d72ff
Introduce new macro OCTAVE_GLUTESSCALLBACK_THREEDOTS. Use definitions HAVE_FRAMEWORK_OPENGL and HAVE_GLUTESSCALLBACK_THREEDOTS for Mac's framework OpenGL implementation.

diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-02-08  Thomas Treichl  <[hidden email]>
+
+ * aclocal.m4 (OCTAVE_GLUTESSCALLBACK_THREEDOTS): New macro.
+ (OCTAVE_OPENGL): Use it in OpenGL check.
+
 2009-02-07  John W. Eaton  <[hidden email]>
 
  * octMakefile.in (all): Display $(prefix) in summary message.
diff --git a/aclocal.m4 b/aclocal.m4
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1014,36 +1014,48 @@
 dnl
 dnl Check for OpenGL. If found, define OPENGL_LIBS
 dnl
-dnl FIXME -- add tests for apple
-dnl
 AC_DEFUN([OCTAVE_OPENGL], [
 OPENGL_LIBS=
-case $canonical_host_type in
-   *-*-mingw32* | *-*-msdosmsvc)
-    AC_CHECK_HEADERS(windows.h)
+
+### On MacOSX systems the OpenGL framework can be used
+OCTAVE_HAVE_FRAMEWORK(OpenGL, [
+#include <OpenGL/gl.h>
+#include <OpenGL/glu.h> ], [GLint par; glGetIntegerv (GL_VIEWPORT, &par);],
+  [have_framework_opengl="yes"], [have_framework_opengl="no"])
+
+if test $have_framework_opengl = "yes"; then
+  AC_DEFINE(HAVE_FRAMEWORK_OPENGL, 1, [Define if framework OPENGL is available.])
+  OPENGL_LIBS="-Wl,-framework -Wl,OpenGL"
+  AC_MSG_NOTICE([adding -Wl,-framework -Wl,OpenGL to OPENGL_LIBS])
+  OCTAVE_GLUTESSCALLBACK_THREEDOTS
+else
+  case $canonical_host_type in
+    *-*-mingw32* | *-*-msdosmsvc)
+      AC_CHECK_HEADERS(windows.h)
     ;;
-esac
-have_opengl_incs=no
-AC_CHECK_HEADERS([GL/gl.h OpenGL/gl.h], [
-  AC_CHECK_HEADERS([GL/glu.h OpenGL/glu.h], [
-    have_opengl_incs=yes; break], [], [
+  esac
+  have_opengl_incs=no
+  AC_CHECK_HEADERS([GL/gl.h OpenGL/gl.h], [
+    AC_CHECK_HEADERS([GL/glu.h OpenGL/glu.h], [
+      have_opengl_incs=yes; break], [], [
 #ifdef HAVE_WINDOWS_H
 #include <windows.h>
 #endif
-])
-break
-], [], [
+    ])
+    break
+    ], [], [
 #ifdef HAVE_WINDOWS_H
 #include <windows.h>
 #endif
-])
-if test "$have_opengl_incs" = "yes"; then
-  case $canonical_host_type in
-    *-*-mingw32* | *-*-msdosmsvc)
-      save_LIBS="$LIBS"
-      LIBS="$LIBS -lopengl32"
-      AC_MSG_CHECKING([for glEnable in -lopengl32])
-      AC_TRY_LINK([
+    ])
+
+  if test "$have_opengl_incs" = "yes"; then
+    case $canonical_host_type in
+      *-*-mingw32* | *-*-msdosmsvc)
+        save_LIBS="$LIBS"
+        LIBS="$LIBS -lopengl32"
+        AC_MSG_CHECKING([for glEnable in -lopengl32])
+        AC_TRY_LINK([
 #if HAVE_WINDOWS_H
 #include <windows.h>
 #endif
@@ -1052,24 +1064,46 @@
 #elif defined (HAVE_OPENGL_GL_H)
 #include <OpenGL/gl.h>
 #endif
-], [
-glEnable(GL_SMOOTH);], OPENGL_LIBS="-lopengl32 -lglu32")
-      LIBS="$save_LIBS"
-      if test "x$OPENGL_LIBS" != "x"; then
-        AC_MSG_RESULT(yes)
-      else
-        AC_MSG_RESULT(no)
-      fi
-      ;;
-    *)
-      save_LDFLAGS="$LDFLAGS"
-      LDFLAGS="$LDFLAGS -L/usr/X11R6/lib"
-      AC_CHECK_LIB(GL, glEnable, OPENGL_LIBS="-L/usr/X11R6/lib -lGL -lGLU")
-      LDFLAGS="$save_LDFLAGS"
-      ;;
-  esac
+], [glEnable(GL_SMOOTH);], OPENGL_LIBS="-lopengl32 -lglu32")
+        LIBS="$save_LIBS"
+        if test "x$OPENGL_LIBS" != "x"; then
+          AC_MSG_RESULT(yes)
+        else
+          AC_MSG_RESULT(no)
+        fi
+        ;;
+      *)
+        save_LDFLAGS="$LDFLAGS"
+        LDFLAGS="$LDFLAGS -L/usr/X11R6/lib"
+        AC_CHECK_LIB(GL, glEnable, OPENGL_LIBS="-L/usr/X11R6/lib -lGL -lGLU")
+        LDFLAGS="$save_LDFLAGS"
+        ;;
+    esac
+  fi
 fi
 AC_SUBST(OPENGL_LIBS)
+])
+dnl
+dnl See if function gluTessCallback is called with "(...)"
+dnl
+dnl OCTAVE_GLUTESSCALLBACK_THREEDOTS
+AC_DEFUN(OCTAVE_GLUTESSCALLBACK_THREEDOTS,
+[AC_CACHE_CHECK([whether gluTessCallback is called with "(...)"],
+octave_cv_glutesscallback_threedots,
+[AC_LANG_PUSH(C++)
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#ifdef HAVE_GL_GLU_H
+#include <GL/glu.h>
+#elif defined HAVE_OPENGL_GLU_H || defined HAVE_FRAMEWORK_OPENGL
+#include <OpenGL/glu.h>
+#endif]],
+[[GLvoid (*func)(...); gluTessCallback(0, 0, func);]])],
+octave_cv_glutesscallback_threedots="yes", octave_cv_glutesscallback_threedots="no")])
+AC_LANG_POP(C++)
+if test $octave_cv_glutesscallback_threedots = "yes"; then
+  AC_DEFINE(HAVE_GLUTESSCALLBACK_THREEDOTS, 1,
+    [Define if gluTessCallback is called with (...)])
+fi
 ])
 dnl
 dnl Configure paths for FreeType2
diff --git a/src/ChangeLog b/src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
+2009-02-08  Thomas Treichl  <[hidden email]>
+
+ * gl-render.h: Use HAVE_FRAMEWORK_OPENGL.
+ * gl-render.cc (opengl_tesselator, opengl_renderer::draw,
+ opengl_renderer::init_marker): Use HAVE_FRAMEWORK_OPENGL.
+
+
 2009-02-07  John W. Eaton  <[hidden email]>
 
  * parse.y (eval_string): Use the one true evaluator.
diff --git a/src/gl-render.cc b/src/gl-render.cc
--- a/src/gl-render.cc
+++ b/src/gl-render.cc
@@ -221,7 +221,11 @@
 opengl_tesselator
 {
 public:
+#if defined (HAVE_FRAMEWORK_OPENGL) && defined (HAVE_GLUTESSCALLBACK_THREEDOTS)
+  typedef GLvoid (CALLBACK *fcn) (...);
+#else
   typedef void (CALLBACK *fcn) (void);
+#endif
 
 public:
 
@@ -591,7 +595,12 @@
   xZ1 = x_zlim(0)-(x_zlim(1)-x_zlim(0))/2;
   xZ2 = x_zlim(1)+(x_zlim(1)-x_zlim(0))/2;
 
+#if defined (HAVE_FRAMEWORK_OPENGL)
+  GLint vw[4];
+#else
   int vw[4];
+#endif
+
   glGetIntegerv (GL_VIEWPORT, vw);
 
   glMatrixMode (GL_MODELVIEW);
@@ -2672,7 +2681,11 @@
 void
 opengl_renderer::init_marker (const std::string& m, double size, float width)
 {
+#if defined (HAVE_FRAMEWORK_OPENGL)
+  GLint vw[4];
+#else
   int vw[4];
+#endif
 
   glGetIntegerv (GL_VIEWPORT, vw);
 
diff --git a/src/gl-render.h b/src/gl-render.h
--- a/src/gl-render.h
+++ b/src/gl-render.h
@@ -29,13 +29,13 @@
 
 #ifdef HAVE_GL_GL_H
 #include <GL/gl.h>
-#elif defined HAVE_OPENGL_GL_H
+#elif defined HAVE_OPENGL_GL_H || defined HAVE_FRAMEWORK_OPENGL
 #include <OpenGL/gl.h>
 #endif
 
 #ifdef HAVE_GL_GLU_H
 #include <GL/glu.h>
-#elif defined HAVE_OPENGL_GLU_H
+#elif defined HAVE_OPENGL_GLU_H || defined HAVE_FRAMEWORK_OPENGL
 #include <OpenGL/glu.h>
 #endif
 
Reply | Threaded
Open this post in threaded view
|

Re: gl-render.cc: framework OpenGL on MacOSX

bpabbott
Administrator

On Feb 8, 2009, at 4:31 PM, Thomas Treichl wrote:

> Ben Abbott schrieb:
>> Looks good!
>
> Ok, thanks. I attached the changeset to add support for "framework  
> OpenGL" on Macs.
>
> Best regards,

It is possible my email client mangled something, but your changeset  
did not apply for me.

Ben

Reply | Threaded
Open this post in threaded view
|

Re: gl-render.cc: framework OpenGL on MacOSX

Thomas Treichl
Ben Abbott schrieb:

>
> On Feb 8, 2009, at 4:31 PM, Thomas Treichl wrote:
>
>> Ben Abbott schrieb:
>>> Looks good!
>>
>> Ok, thanks. I attached the changeset to add support for "framework
>> OpenGL" on Macs.
>>
>> Best regards,
>
> It is possible my email client mangled something, but your changeset did
> not apply for me.

Hi Ben,

I've downloaded the attachment from the website archive

http://www-old.cae.wisc.edu/pipermail/octave-maintainers/2009-February/010703.html

and I tried to import it into a fresh copy of the repository on my machine. My
latest entry if I call 'hg log' is from Jaroslav today:

   changeset:   8700:314be237cd5b
   user:        Jaroslav Hajek <[hidden email]>
   date:        Mon Feb 09 13:05:35 2009 +0100
   summary:     sorting optimizations

After this I did

   $hg import ~/Desktop/attachment.ksh

and it seemed to work. Running 'hg log' again I see

   changeset:   8701:8b00629904c8
   tag:         tip
   user:        Thomas Treichl <[hidden email]>
   ...

Can you try this please? Which error message from hg do you get if it still
doesn't work?

Best regards,

   Thomas
Reply | Threaded
Open this post in threaded view
|

Re: gl-render.cc: framework OpenGL on MacOSX

bpabbott
Administrator
In reply to this post by Thomas Treichl
On Monday, February 09, 2009, at 10:47AM, "Thomas Treichl" <[hidden email]> wrote:

>Ben Abbott schrieb:
>>
>> On Feb 8, 2009, at 4:31 PM, Thomas Treichl wrote:
>>
>>> Ben Abbott schrieb:
>>>> Looks good!
>>>
>>> Ok, thanks. I attached the changeset to add support for "framework
>>> OpenGL" on Macs.
>>>
>>> Best regards,
>>
>> It is possible my email client mangled something, but your changeset did
>> not apply for me.
>
>Hi Ben,
>
>I've downloaded the attachment from the website archive
>
>http://www-old.cae.wisc.edu/pipermail/octave-maintainers/2009-February/010703.html
>
>and I tried to import it into a fresh copy of the repository on my machine. My
>latest entry if I call 'hg log' is from Jaroslav today:
>
>   changeset:   8700:314be237cd5b
>   user:        Jaroslav Hajek <[hidden email]>
>   date:        Mon Feb 09 13:05:35 2009 +0100
>   summary:     sorting optimizations
>
>After this I did
>
>   $hg import ~/Desktop/attachment.ksh
>
>and it seemed to work. Running 'hg log' again I see
>
>   changeset:   8701:8b00629904c8
>   tag:         tip
>   user:        Thomas Treichl <[hidden email]>
>   ...
>
>Can you try this please? Which error message from hg do you get if it still
>doesn't work?
>
>Best regards,
>
>   Thomas
>

Thanks Thomas ... one day I'll remember to try www-old.cae.wisc.edu/ when the email attachment doesn't work for me.

The result of configure is below.

---------------------------------
Octave is now configured for i386-apple-darwin9.6.0

  Source directory:     .
  Installation prefix:  /sw
  C compiler:           gcc  -mieee-fp  -Wall -W -Wshadow -g -O2
  C++ compiler:         g++  -mieee-fp  -Wall -W -Wshadow -Wold-style-cast -g -O2
  Fortran compiler:     /sw/bin/gfortran -g -ff2c -mieee-fp
  Fortran libraries:    /sw/lib/gcc4.3/lib/libgfortran.dylib
  BLAS libraries:       -Wl,-framework,Accelerate,-dylib_file,/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib:/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib -Wl,-framework,Accelerate,-dylib_file,/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib:/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
  FFTW libraries:       -lfftw3 -lfftw3f
  GLPK libraries:       -lglpk
  UMFPACK libraries:    -lumfpack
  AMD libraries:        -lamd
  CAMD libraries:       -lcamd
  COLAMD libraries:     -lcolamd
  CCOLAMD libraries:    -lccolamd
  CHOLMOD libraries:    -lcholmod
  CXSPARSE libraries:   -lcxsparse
  ARPACK libraries:    
  QRUPDATE libraries:
  HDF5 libraries:       -lhdf5
  CURL libraries:       -lcurl
  REGEX libraries:      -L/sw/lib -lpcre
  QHULL libraries: -lqhull
  OPENGL libraries:     -Wl,-framework -Wl,OpenGL
  FLTK backend libs:    -L/sw/lib/fltk-aqua/lib -L//sw/lib -L/sw/lib -lfltk_gl -framework AGL -framework OpenGL -lfltk -lpthread -framework Carbon -framework ApplicationServices
  X11 include flags:    /usr/X11/include
  X11 libraries:        
  LIBS:                 -lreadline  -lncurses -Wl,-framework,Accelerate,-dylib_file,/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib:/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib -lhdf5 -lz -lm  -Wl,-framework -Wl,Carbon
  Default pager:        less
  gnuplot:              gnuplot
  Magick config:        

  Do internal array bounds checking:  false
  Build static libraries:             false
  Build shared libraries:             true
  Dynamic Linking:                    true (dyld)
  Include support for GNU readline:   true
  64-bit array dims and indexing:     false

configure: WARNING: qrupdate not found. The QR & Cholesky updating functions will be slow.
configure: WARNING: arpack not found. This will result in a lack of the eigs function.
configure: WARNING: GraphicsMagick++ config script not found.  Assuming GraphicsMagic++ library and header files are missing, so imread will not be fully functional
configure: WARNING: "FTGL library not found. Native renderer will not have on-screen text"
configure: WARNING:
configure: WARNING: I didn't find the necessary libraries to compile native
configure: WARNING: graphics. It isn't necessary to have native graphics
configure: WARNING: but you will have to use gnuplot or you won't be able
configure: WARNING: to use any of Octave's plotting commands
configure: WARNING:
configure:

NOTE: libraries may be skipped if a library is not found OR
      if the library on your system is missing required features.
---------------------------------


123