In article <
c81a5a4e-bf94-40ae...@googlegroups.com>,
town...@astro.wisc.edu says...
>
> On Sunday, February 21, 2016 at 10:11:24 AM UTC-6,
town...@astro.wisc.edu wrote:
> > On Friday, February 5, 2016 at 9:34:48 PM UTC-6, James Van Buskirk wrote:
> > > "Dick Holmes" wrote in message
> > > news:MPG.311ec29a2...@news.supernews.com...
> > >
> > > > I am attempting to use OpenGL in Fortran. I am using the F03GL package
> > > > with gfortran (4.9 and 5.3) and FreeGLUT on Windows 10. A simple program
> > > > compiles with no problems (after cleaning up the Makefile), but it
> > > > segfaults during execution. The segfault trace is the same for both
> > > > compiler versions once the program gets into the innards of OpenGL.
> > >
[snip]
> > >
> > > I used to have OpenGL interface modules for gfortran on my
> > > website before it was destroyed by vandals and thieves. opengl32.dll
> > > definitely wants you to declare everything as STDCALL. One way to
> > > finesse that issue is to try to make everything work in 64-bit mode.
> > > If you use FreeGLUT you will have to get a 64-bit FreeGLUT package.
> > > Looks like Nvidia has a 64-bit GLUT you can install.
> > >
> > > GLUT is kind of crappy anyhow because you can't render to the
> > > printer or to a file with it. But opening up an OpenGL window
> > > from scratch is a daunting task if you can't find example code to
> > > copy. There is some at NeHe's web site.
> >
> > I created a Fortran interface to SDL, that I'd be happy to share.
> > I also have a partial set of interfaces for OpenGL >= 3, but that
would require bit more work for me to make available.
> >
> > Let me know if you are interested.
> >
> > cheers,
> >
Actually, I gave up on the GLUT family since I couldn't seem to get
around the interface problem (interfacing between Fortran, GLUT and
OpenGL). I discovered GLFW and have been attempting to work with that
model for the last few days, but I'm having the same kinds of problems.
With GLFW3, I instrumented the source and discovered that I am passing
the same value for a window handle to several different GLFW routines,
but when I attempt to swap buffers, the window parameter value is
different once it gets into the GLFW code even though I'm calling with
the same handle variable. The defined interfaces are the same for all
the functions that pass a window handle. The result of the bad (?)
handle value is a seg fault.
The other problem I encountered is some kind of chaos with regard to the
stack. When I call a subroutine to render my image, the GL calls seem to
work fine until I try to exit the subroutine. At that point the stack is
corrupted and I end up in a graphics driver (Intel 5500 latest driver).
I don't understand what got me to that driver, but that may be a side
effect of the corrupted stack.
I'm on Windows 10 using gfortran 5.3 and have been forcing the stdcall
procedure calling sequence using the command line option (-mrtd) and the
!GCC$ attributes.
I'd be delighted to have a look at your GLFW code!
____________
Dick