Re: Help building/running SDL/OpenGL code

2009-12-23 Thread Mel Flynn
On Tuesday 22 December 2009 06:36:19 Richard Mace wrote:

 So, it appears that there is some conflict between the mesa libraries
  (which I need to #include to build the code) and the NVIDIA-supplied
  libraries, or am I on the wrong track?
 
 Can anyone shed some light on this? I've spent quite some time on what
  first appeared to be a fairly trivial task and I am eager to see how this
  runs under FreeBSD.

If you want to run any OpenGL code with nvidia-driver you will need to 
reinstall the driver after every:
- kernel update
- update of x11-servers/xorg-server
- update of graphics/libGL*

There may be exceptions, but they're not worth figuring out or remembering.

In your case you may actually have a problem with math code in libm.so.3 vs 
libm.so.5, but I doubt it's the case as no OpenGL app that I encountered has 
one.
-- 
Mel
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Help building/running SDL/OpenGL code

2009-12-23 Thread Pieter de Goeje
On Wednesday 23 December 2009 04:42:28 Richard Mace wrote:
 Incidentally, if there is anyone out there with newer hardware who is
 interested in building the code I am talking about you can find it at:

 http://physics.ukzn.ac.za/~richm/courses/phys110/lennard-jones-3d.html

 You'll need to change the following lines in the Makefile to get it to
 successfully build under FreeBSD:
 ==
 CFLAGS = -Wall -Wextra -pthread -I/usr/local/include
 -I/usr/local/include/SDL -O3 -march=native

 LFLAGS = -Wall -L/usr/local/lib

 lennardjones : $(OBJS)
         $(CC) $(LFLAGS) -o lennardjones $(OBJS) -lSDL -lSDL_gfx -lGLU
 ==

 It would be interesting to hear feedback. (Basic controls are: up-arrow add
 heat to crystal; down-arrow cool down gas/crystal. There are a bunch of
 others -- look in main.c). You are welcome to do whatever you wish with my
 code.

Arrr. Same problem here at startup: segfault in glXGetFBConfigAttribSGIX. A 
simple test case is the following:

py...@nox:~% cat test.c
int main() {}
py...@nox:~% cc -o test test.c -L/usr/local/lib -lSDL -lGL
py...@nox:~% ./test
zsh: segmentation fault (core dumped)  ./test

Then I attempted to switch the arguments around...

py...@nox:~% cc -o test test.c -L/usr/local/lib -lGL -lSDL
py...@nox:~% ./test
py...@nox:~%

Voila! (Admittedly much to my surprise ;))

So then I changed the Makefile to use these libraries: -lGLU -lSDL -lSDL_gfx. 
Result: a perfectly working ./lennardjones. The only minor issue is that it 
presented me with exactly one option:

py...@nox:~/temp/lennard-jones-gas-3d% ./lennardjones
Current pixel depth: 32
Available Modes
0 =  3840 x 1200
Select your preferred video mode:

So apparently I prefer mode 0 :D. It run fine (and smooth) though.

It is clear something goes wrong during the runtime linking process, which 
this library order works around. The actual problem is still a mystery to me. 
It might be worthwhile to post a bugreport on the nvnews.net FreeBSD forum.

Best regards,

Pieter de Goeje

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Help building/running SDL/OpenGL code

2009-12-23 Thread Richard Mace
On Wednesday 23 December 2009 22:54:07 Pieter de Goeje wrote:
 On Wednesday 23 December 2009 04:42:28 Richard Mace wrote:
  Incidentally, if there is anyone out there with newer hardware who is
  interested in building the code I am talking about you can find it at:
 
  http://physics.ukzn.ac.za/~richm/courses/phys110/lennard-jones-3d.html
 
  You'll need to change the following lines in the Makefile to get it to
  successfully build under FreeBSD:
  ==
  CFLAGS = -Wall -Wextra -pthread -I/usr/local/include
  -I/usr/local/include/SDL -O3 -march=native
 
  LFLAGS = -Wall -L/usr/local/lib
 
  lennardjones : $(OBJS)
  $(CC) $(LFLAGS) -o lennardjones $(OBJS) -lSDL -lSDL_gfx -lGLU
  ==
 
  It would be interesting to hear feedback. (Basic controls are: up-arrow
  add heat to crystal; down-arrow cool down gas/crystal. There are a bunch
  of others -- look in main.c). You are welcome to do whatever you wish
  with my code.
 
 Arrr. Same problem here at startup: segfault in glXGetFBConfigAttribSGIX. A
 simple test case is the following:
 
 py...@nox:~% cat test.c
 int main() {}
 py...@nox:~% cc -o test test.c -L/usr/local/lib -lSDL -lGL
 py...@nox:~% ./test
 zsh: segmentation fault (core dumped)  ./test
 
 Then I attempted to switch the arguments around...
 
 py...@nox:~% cc -o test test.c -L/usr/local/lib -lGL -lSDL
 py...@nox:~% ./test
 py...@nox:~%
 
 Voila! (Admittedly much to my surprise ;))
 
 So then I changed the Makefile to use these libraries: -lGLU -lSDL
  -lSDL_gfx. Result: a perfectly working ./lennardjones. The only minor
  issue is that it presented me with exactly one option:
 
 py...@nox:~/temp/lennard-jones-gas-3d% ./lennardjones
 Current pixel depth: 32
 Available Modes
 0 =  3840 x 1200
 Select your preferred video mode:
 
 So apparently I prefer mode 0 :D. It run fine (and smooth) though.
 
 It is clear something goes wrong during the runtime linking process, which
 this library order works around. The actual problem is still a mystery to
  me. It might be worthwhile to post a bugreport on the nvnews.net FreeBSD
  forum.
 
 Best regards,
 
 Pieter de Goeje
 

Pieter, many, many thanks for taking the time to test and diagnose this. Your 
solution works perfectly: ensure that libGLU PRECEDES all the SDL libraries in 
the link line of the Makefile. Wow! I never would have thought

About your allowable modes being only 3840 x 1200:  I had the same issue at 
work (Linux) where I run dual monitors (2 x 1680 x 1050). Just create an 
NVIDIA metamode in your xorg.conf that blanks one monitor (I do not recall the 
exact syntax here, but I think you need to use NULL for the one monitor). It 
is also useful for some games ;-) Then you can use one screen and avoid 
staring at the crack between your monitors during simulations.

Again, many thanks. This for me is proof that I can continue to do some 
scientific programming (with rendering in 3D) under FreeBSD .

-Richard
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Help building/running SDL/OpenGL code

2009-12-22 Thread Roland Smith
On Tue, Dec 22, 2009 at 05:36:19PM +0200, Richard Mace wrote:
 I developed a small molecular dynamics simulation under Linux some time ago. 
 Since recently moving to FreeBSD I thought that I'd try to get it running 
 here, too.
 
 However, although I am able to get the code to build, it dumps core -- 
 apparently before getting to any user code! During the build (linking phase) 
 I 
 get one error which seems to be a pointer to the source of the problem:
 
 =
 gcc -Wall -L/usr/local/lib -o lennardjones main.o anim-thread.o ode.o 
 gasdynamics.o eyedynamics.o -lSDL -lSDL_gfx -lm -lGLU
 /usr/bin/ld: warning: libm.so.3, needed by /usr/local/lib/libGL.so.1, may 
 conflict with libm.so.5
 =
 Note the last two lines. (I have included the two previous lines to show the 
 dependent libraries, if that helps.)
 
Looks like the libGL supplied by nvidia was built for FreeBSD 5. Try
installing the /usr/ports/misc/compat5x port. That includes libm.so.3, and
might help.

If you are not running the GENERIC kernel, make sure your kernel contains the
right COMPAT_FREEBSD5, COMPAT_FREEBSD6 and COMPAT_FREEBSD7 options.

Roland
-- 
R.F.Smith   http://www.xs4all.nl/~rsmith/
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914  B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)


pgpGFpqFBYHin.pgp
Description: PGP signature


Re: Help building/running SDL/OpenGL code

2009-12-22 Thread Richard Mace
On Tuesday 22 December 2009 18:28:07 you wrote:
 On Tue, Dec 22, 2009 at 05:36:19PM +0200, Richard Mace wrote:
  I developed a small molecular dynamics simulation under Linux some time
  ago. Since recently moving to FreeBSD I thought that I'd try to get it
  running here, too.
 
  However, although I am able to get the code to build, it dumps core --
  apparently before getting to any user code! During the build (linking
  phase) I get one error which seems to be a pointer to the source of the
  problem:
 
  =
  gcc -Wall -L/usr/local/lib -o lennardjones main.o anim-thread.o ode.o
  gasdynamics.o eyedynamics.o -lSDL -lSDL_gfx -lm -lGLU
  /usr/bin/ld: warning: libm.so.3, needed by /usr/local/lib/libGL.so.1, may
  conflict with libm.so.5
  =
  Note the last two lines. (I have included the two previous lines to show
  the dependent libraries, if that helps.)
 
 Looks like the libGL supplied by nvidia was built for FreeBSD 5. Try
 installing the /usr/ports/misc/compat5x port. That includes libm.so.3, and
 might help.
 
 If you are not running the GENERIC kernel, make sure your kernel contains
  the right COMPAT_FREEBSD5, COMPAT_FREEBSD6 and COMPAT_FREEBSD7 options.
 
 Roland
 

Thanks, Roland. Apparently /usr/ports/misc/compat5x is installed:

toutatis# make install clean
===  Installing for compat5x-i386-5.4.0.8_11
===   compat5x-i386-5.4.0.8_11 depends on file: 
/usr/local/share/compat/locale/UTF-8/LC_CTYPE - found
===   Generating temporary packing list
===  Checking if misc/compat5x already installed
===   compat5x-i386-5.4.0.8_11 is already installed
=

And...

ls -al /usr/local/lib/compat/libm.*
-r--r--r--  1 root  wheel  120004 Dec 13 06:18 /usr/local/lib/compat/libm.so.

I am using the stock 8.0-RELEASE kernel on a 3-week old install.

Any other ideas on where the conflict/problem may lie?

-Richard
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Help building/running SDL/OpenGL code

2009-12-22 Thread Roland Smith
On Tue, Dec 22, 2009 at 07:06:47PM +0200, Richard Mace wrote:
 On Tuesday 22 December 2009 18:28:07 you wrote:
  On Tue, Dec 22, 2009 at 05:36:19PM +0200, Richard Mace wrote:
   I developed a small molecular dynamics simulation under Linux some time
   ago. Since recently moving to FreeBSD I thought that I'd try to get it
   running here, too.
  
   However, although I am able to get the code to build, it dumps core --
   apparently before getting to any user code! During the build (linking
   phase) I get one error which seems to be a pointer to the source of the
   problem:
  
   =
   gcc -Wall -L/usr/local/lib -o lennardjones main.o anim-thread.o ode.o
   gasdynamics.o eyedynamics.o -lSDL -lSDL_gfx -lm -lGLU
   /usr/bin/ld: warning: libm.so.3, needed by /usr/local/lib/libGL.so.1, may
   conflict with libm.so.5
   =
   Note the last two lines. (I have included the two previous lines to show
   the dependent libraries, if that helps.)
  
  Looks like the libGL supplied by nvidia was built for FreeBSD 5. Try
  installing the /usr/ports/misc/compat5x port. That includes libm.so.3, and
  might help.
  
  If you are not running the GENERIC kernel, make sure your kernel contains
   the right COMPAT_FREEBSD5, COMPAT_FREEBSD6 and COMPAT_FREEBSD7 options.
  
  Roland
  
 
 Thanks, Roland. Apparently /usr/ports/misc/compat5x is installed:
 
 toutatis# make install clean
 ===  Installing for compat5x-i386-5.4.0.8_11
 ===   compat5x-i386-5.4.0.8_11 depends on file: 
 /usr/local/share/compat/locale/UTF-8/LC_CTYPE - found
 ===   Generating temporary packing list
 ===  Checking if misc/compat5x already installed
 ===   compat5x-i386-5.4.0.8_11 is already installed
 =
 
 And...
 
 ls -al /usr/local/lib/compat/libm.*
 -r--r--r--  1 root  wheel  120004 Dec 13 06:18 /usr/local/lib/compat/libm.so.
 
 I am using the stock 8.0-RELEASE kernel on a 3-week old install.
 
 Any other ideas on where the conflict/problem may lie?

What version of the nvidia driver are you using?

Have a look at the x11-drivers/xf86-video-nouveau port. Maybe that works for 
you?

(BTW, problems like these are why I avoid proprietary drivers like the plague)

Roland
-- 
R.F.Smith   http://www.xs4all.nl/~rsmith/
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914  B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)


pgp28nCNeUz1e.pgp
Description: PGP signature


Re: Help building/running SDL/OpenGL code

2009-12-22 Thread Richard Mace
On Tuesday 22 December 2009 19:31:31 you wrote:

 
 What version of the nvidia driver are you using?
 

The one in /usr/ports/x11/nvidia-driver-173. I have to use this for the aging 
FX 5200.

 Have a look at the x11-drivers/xf86-video-nouveau port. Maybe that works
  for you?
 
 (BTW, problems like these are why I avoid proprietary drivers like the
  plague)

I'm rendering a whole bunch of molecules (spheres), moving a camera and at the 
same time doing quite a bit of CPU intensive numerical integration of a whole 
slew of coupled ordinary differential equations -- I need the speed of the GPU 
(read proprietary driver) to relieve the CPU and avoid a slide show. (This 
works very nicely with dual core CPUs: I use one thread for the rendering and 
another for the numerics.)

I'll keep digging (and getting educated, I guess). Incidentally, in Debian 
GNU/Linux they have a system of clever diverts which avoid these kinds of 
library clashes. 

Thanks
-Richard
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Help building/running SDL/OpenGL code

2009-12-22 Thread Roland Smith
On Tue, Dec 22, 2009 at 07:50:19PM +0200, Richard Mace wrote:
 On Tuesday 22 December 2009 19:31:31 you wrote:
 
  
  What version of the nvidia driver are you using?
  
 
 The one in /usr/ports/x11/nvidia-driver-173. I have to use this for the aging 
 FX 5200.
 
  Have a look at the x11-drivers/xf86-video-nouveau port. Maybe that works
   for you?
  
  (BTW, problems like these are why I avoid proprietary drivers like the
   plague)
 
 I'm rendering a whole bunch of molecules (spheres), moving a camera and at 
 the 
 same time doing quite a bit of CPU intensive numerical integration of a whole 
 slew of coupled ordinary differential equations -- I need the speed of the 
 GPU 
 (read proprietary driver) to relieve the CPU and avoid a slide show. (This 
 works very nicely with dual core CPUs: I use one thread for the rendering and 
 another for the numerics.)

In this case it might be better to invest in a more recent graphics
card. Currently Radeons (up to and including R6xx/R7xx) are better supported
by open source drivers than nvidia. 

 I'll keep digging (and getting educated, I guess). Incidentally, in Debian 
 GNU/Linux they have a system of clever diverts which avoid these kinds of 
 library clashes. 

As far as I know, the compat libraries are meant to be able to keep using old
binaries on newer systems. I do not think they were ever meant to be used in a
mixed (as in linking with both libm.so.3 and libm.so.5) environment.

From experience (botched ports upgrade going from 6.x to 7) I know that having
a program linked to different versions of the same library can result in
interesting experiences (i.e. crashes).

There are several things you could try, from building your app and the
libraries it needs on a 5.x machine to trying to get the libGL to link with
the current libm. Whatever you do, it will probably end up being a kludge.

Roland
-- 
R.F.Smith   http://www.xs4all.nl/~rsmith/
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914  B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)


pgpwZhyj1kY0A.pgp
Description: PGP signature


Re: Help building/running SDL/OpenGL code

2009-12-22 Thread Richard Mace
On Tuesday 22 December 2009 20:35:19 you wrote:
 On Tue, Dec 22, 2009 at 07:50:19PM +0200, Richard Mace wrote:
  On Tuesday 22 December 2009 19:31:31 you wrote:
   What version of the nvidia driver are you using?
 
  The one in /usr/ports/x11/nvidia-driver-173. I have to use this for the
  aging FX 5200.
 
   Have a look at the x11-drivers/xf86-video-nouveau port. Maybe that
   works for you?
  
   (BTW, problems like these are why I avoid proprietary drivers like the
plague)
 
  I'm rendering a whole bunch of molecules (spheres), moving a camera and
  at the same time doing quite a bit of CPU intensive numerical integration
  of a whole slew of coupled ordinary differential equations -- I need the
  speed of the GPU (read proprietary driver) to relieve the CPU and avoid a
  slide show. (This works very nicely with dual core CPUs: I use one thread
  for the rendering and another for the numerics.)
 
 In this case it might be better to invest in a more recent graphics
 card. Currently Radeons (up to and including R6xx/R7xx) are better
  supported by open source drivers than nvidia.
 
  I'll keep digging (and getting educated, I guess). Incidentally, in
  Debian GNU/Linux they have a system of clever diverts which avoid these
  kinds of library clashes.
 
 As far as I know, the compat libraries are meant to be able to keep using
  old binaries on newer systems. I do not think they were ever meant to be
  used in a mixed (as in linking with both libm.so.3 and libm.so.5)
  environment.
 
 From experience (botched ports upgrade going from 6.x to 7) I know that
  having a program linked to different versions of the same library can
  result in interesting experiences (i.e. crashes).
 
 There are several things you could try, from building your app and the
 libraries it needs on a 5.x machine to trying to get the libGL to link with
 the current libm. Whatever you do, it will probably end up being a kludge.
 
 Roland
 

Thanks again for the suggestions, Roland. 

In the end, as a last resort, I de-installed the nvidia driver and started X 
with an empty /etc/X11/xorg.conf (which presumably loads the nv driver). I 
re-built my code and it runs, albeit without the smoothest of graphics. 

I guess that that proves that the problem lies with the NVIDIA driver and its 
inter-relationship with the Mesa libraries, which one has to use if one builds 
one's own OpenGL programs.  It is a pity that FreeBSD has not sorted that 
out, but I hasten to add that I'm new to FBSD and it could be my error. 

It does beg the question, though, how one would develop OpenGL apps on FBSD? 
I'll revisit this soon, after some careful googling.

Thanks again for the help.

-Richard
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Help building/running SDL/OpenGL code

2009-12-22 Thread Roland Smith
On Tue, Dec 22, 2009 at 09:57:57PM +0200, Richard Mace wrote:
 In the end, as a last resort, I de-installed the nvidia driver and started X 
 with an empty /etc/X11/xorg.conf (which presumably loads the nv driver). I 
 re-built my code and it runs, albeit without the smoothest of graphics. 

On a recent core2 duo or quad, even software rendering isn't that bad.
 
 I guess that that proves that the problem lies with the NVIDIA driver and its 
 inter-relationship with the Mesa libraries, which one has to use if one 
 builds 
 one's own OpenGL programs.

Yes.

 It is a pity that FreeBSD has not sorted that out, but I hasten to add that
 I'm new to FBSD and it could be my error.

It was nvidia's decision to drop support for older cards from their recent
drivers. Nothing that the FreeBSD project can do about that.

 It does beg the question, though, how one would develop OpenGL apps on FBSD? 
 I'll revisit this soon, after some careful googling.

Get a card that is well-supported by the drivers in the FreeBSD kernel and
Xorg/Mesa. Currently that means Intel's on-board graphics or boards with
ATI/AMD radeon chips, except for the latest chips. AMD released docs for those
chips some months ago, and the drivers for accellerated 3D are still evolving.

Accellerated 3D works fine on my Radeon X1650 equipped card with the
xf86-video-ati driver and the drm.ko and radeon.ko kernel modules.

Roland
-- 
R.F.Smith   http://www.xs4all.nl/~rsmith/
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914  B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)


pgpkPmKyr4Qnd.pgp
Description: PGP signature


Re: Help building/running SDL/OpenGL code

2009-12-22 Thread Pieter de Goeje
On Tuesday 22 December 2009 22:00:51 Roland Smith wrote:
 On Tue, Dec 22, 2009 at 09:57:57PM +0200, Richard Mace wrote:
  In the end, as a last resort, I de-installed the nvidia driver and
  started X with an empty /etc/X11/xorg.conf (which presumably loads the
  nv driver). I re-built my code and it runs, albeit without the
  smoothest of graphics.

 On a recent core2 duo or quad, even software rendering isn't that bad.
True, until you press the full screen(s) button of your program running on 
your dual 1920x1200 monitor setup like I do ;-) Suddenly you're watching a 
slideshow...

  I guess that that proves that the problem lies with the NVIDIA driver and
  its inter-relationship with the Mesa libraries, which one has to use if
  one builds one's own OpenGL programs.

 Yes.
Agreed. It's quite annoying that the nvidia drivers replace the existing mesa 
GL libs, which breaks OpenGL when you switch back to mesa rendering. However, 
because the library is implemented by nvidia for their hardware, it is also 
blazingly fast.

  It is a pity that FreeBSD has not sorted that out, but I hasten to add
  that I'm new to FBSD and it could be my error.

 It was nvidia's decision to drop support for older cards from their recent
 drivers. Nothing that the FreeBSD project can do about that.
The oldest cards that the new drivers support are the GeForce 6xxx series, 
which are over 5 years old. I'm not saying that I approve dropping support 
but frankly I don't really care for 3D acceleration on graphics cards that 
old. 

The latest nvidia drivers are actually built using a more recent version of 
FreeBSD so you won't have that linking problem. Which is indeed the most 
likely cause of the problem. I don't understand why glxgears does run and 
your simulation does not though... I would've expected both too fail or work.

  It does beg the question, though, how one would develop OpenGL apps on
  FBSD? I'll revisit this soon, after some careful googling.

Personally I use a recent nvidia card with the latest nvidia drivers. This has 
worked well for me, but I don't use SDL. My programs tend to use the simple 
GLUT/GLU/GL combo or wxGTK/GLU/GL if I need more controls. Loading textures 
is done using DevIL. Unfortunately my old GeForce 4 is broken so I can't test 
the legacy drivers any more.


 Get a card that is well-supported by the drivers in the FreeBSD kernel and
 Xorg/Mesa. Currently that means Intel's on-board graphics or boards with
If you're going with intel you might as well use software rendering :-)

 ATI/AMD radeon chips, except for the latest chips. AMD released docs for
 those chips some months ago, and the drivers for accellerated 3D are still
 evolving.

Yes, AMD's efforts are very commendable.

 Accellerated 3D works fine on my Radeon X1650 equipped card with the
 xf86-video-ati driver and the drm.ko and radeon.ko kernel modules.

 Roland

-- 
Pieter de Goeje
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Help building/running SDL/OpenGL code

2009-12-22 Thread Richard Mace
On Wednesday 23 December 2009 04:20:28 Pieter de Goeje wrote:
 On Tuesday 22 December 2009 22:00:51 Roland Smith wrote:
  On Tue, Dec 22, 2009 at 09:57:57PM +0200, Richard Mace wrote:
   In the end, as a last resort, I de-installed the nvidia driver and
   started X with an empty /etc/X11/xorg.conf (which presumably loads the
   nv driver). I re-built my code and it runs, albeit without the
   smoothest of graphics.
 
  On a recent core2 duo or quad, even software rendering isn't that bad.
 
 True, until you press the full screen(s) button of your program running on
 your dual 1920x1200 monitor setup like I do ;-) Suddenly you're watching a
 slideshow...
 
   I guess that that proves that the problem lies with the NVIDIA driver
   and its inter-relationship with the Mesa libraries, which one has to
   use if one builds one's own OpenGL programs.
 
  Yes.
 
 Agreed. It's quite annoying that the nvidia drivers replace the existing
  mesa GL libs, which breaks OpenGL when you switch back to mesa rendering.
  However, because the library is implemented by nvidia for their hardware,
  it is also blazingly fast.
 
   It is a pity that FreeBSD has not sorted that out, but I hasten to add
   that I'm new to FBSD and it could be my error.

What I meant here by sort out was that FreeBSD provide some way for Mesa 
libs and NVIDIA drivers to co-exist. It seems that you (as new user) have to 
learn, through error, that you need to install Mesa first, then NVIDIA (and 
whenever Mesa-related apps get an upgrade you need to re-install NVIDIA). 
Would be nice if these two ports could check for each other's existence before 
install and do the necessary to the libGL* symbolic links. 

  It was nvidia's decision to drop support for older cards from their
  recent drivers. Nothing that the FreeBSD project can do about that.
 
 The oldest cards that the new drivers support are the GeForce 6xxx series,
 which are over 5 years old. I'm not saying that I approve dropping support
 but frankly I don't really care for 3D acceleration on graphics cards that
 old.
 
 The latest nvidia drivers are actually built using a more recent version of
 FreeBSD so you won't have that linking problem. Which is indeed the most
 likely cause of the problem. I don't understand why glxgears does run and
 your simulation does not though... I would've expected both too fail or
  work.

This is confusing to me, too, which led to the question immediately below.

   It does beg the question, though, how one would develop OpenGL apps on
   FBSD? I'll revisit this soon, after some careful googling.
 
 Personally I use a recent nvidia card with the latest nvidia drivers. This
  has worked well for me, but I don't use SDL. My programs tend to use the
  simple GLUT/GLU/GL combo or wxGTK/GLU/GL if I need more controls. Loading
  textures is done using DevIL. Unfortunately my old GeForce 4 is broken so
  I can't test the legacy drivers any more.
 
  Get a card that is well-supported by the drivers in the FreeBSD kernel
  and Xorg/Mesa. Currently that means Intel's on-board graphics or boards
  with

Well, right now I am evaluating FreeBSD on an old machine (Pentium IV, 
NVIDIA FX5200) to see whether I would make the switch from Debian GNU/Linux. I 
don't really want to purchase a new card for this purpose. Perhaps I will try 
to install FBSD on my laptop, which is dual-core and has an NVIDIA Quadro FX 
570M on board.

 
 If you're going with intel you might as well use software rendering :-)

I'd agree there ;-).

  ATI/AMD radeon chips, except for the latest chips. AMD released docs for
  those chips some months ago, and the drivers for accellerated 3D are
  still evolving.
 
 Yes, AMD's efforts are very commendable.
 
  Accellerated 3D works fine on my Radeon X1650 equipped card with the
  xf86-video-ati driver and the drm.ko and radeon.ko kernel modules.
 
  Roland
 

Thanks to all for your help and suggestions. 

Incidentally, if there is anyone out there with newer hardware who is 
interested in building the code I am talking about you can find it at:

http://physics.ukzn.ac.za/~richm/courses/phys110/lennard-jones-3d.html

You'll need to change the following lines in the Makefile to get it to 
successfully build under FreeBSD:
==
CFLAGS = -Wall -Wextra -pthread -I/usr/local/include -I/usr/local/include/SDL 
-O3 -march=native

LFLAGS = -Wall -L/usr/local/lib

lennardjones : $(OBJS)
$(CC) $(LFLAGS) -o lennardjones $(OBJS) -lSDL -lSDL_gfx -lGLU
==

It would be interesting to hear feedback. (Basic controls are: up-arrow add 
heat to crystal; down-arrow cool down gas/crystal. There are a bunch of others 
-- look in main.c). You are welcome to do whatever you wish with my code.

-Richard

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send