On Thu, 2009-04-30 at 06:06 -0700, Sukender wrote:
> Hi all,
> 
> First of all: hello to everyone!
> 
> I'm new here, and I won't be involved much in Mesa development, but I'd like 
> to post a tiny improvement. Sorry if it has been discussed before... (I had a 
> quick look into the archive and it seems not).
> 
> Actually, I noticed a problem when compiling the OpenSceneGraph toolkit 
> against Mesa 7.4.1, under Win32/MSVC8:
> In mesa_wgl.h, it reads (line 47):
> 
> #if defined(__MINGW32__)
> #  ifndef WIN32_LEAN_AND_MEAN
> #    define WIN32_LEAN_AND_MEAN 1
> #  endif
> #  include <windows.h>
> #endif
> 
> And I think there should be three little changes:
> 1. Include windows.h for all Windows builds (not only MinGW).
> 2. Define NOMINMAX, since we don't need these two stupid macros.
> 3. _WIN32_WINNT is sometimes not defined, and that can be a source of problem.

Sukender, 

These are actually application shortcomings. We should not define these
in GL.h. Truth is that:

1. Windows applications should include windows.h before GL/gl.h (because
Microsoft's GL/gl.h does not include it automatically)
2. Some windows applications out there which use GL might rely on the
min/max macros, and they would break if we defined NOMINMAX in Gl/gl.h
3. _WIN32_WINNT has nothing to do with GL.

To be honest, mesa_wgl.h should be removed. It seems to have been made
in a time where MinGW wingdi.h headers didn't define the WGL API, but
that is long gone. My experience is that it gets in the way more than it
helps.

> So my proposition is to write:
> 
> #if defined(__MINGW32__) || defined(WIN32)
> #  ifndef WIN32_LEAN_AND_MEAN
> #    define WIN32_LEAN_AND_MEAN 1
> #  endif
> #  ifndef NOMINMAX
> #    define NOMINMAX 1
> #  endif
> #  ifndef _WIN32_WINNT
> #    define _WIN32_WINNT    0x0400
> #  endif
> #  include <windows.h>
> #endif
> 
> What do you think about it?
> I tried it and successfully compiled OpenSceneGraph 2.9 (partially : osg, 
> osgDB, osgUtil, osgViewer), and tested an example.

Doesn't OpenSceneGraph include windows.h?

> I'm not 100% sure, but maybe the lines:
> 
> #if defined(__MINGW32__)
> #  define __W32API_USE_DLLIMPORT__
> #endif
> 
> Also have to be changed to:
> 
> #if defined(__MINGW32__) || defined(WIN32)
> #  define __W32API_USE_DLLIMPORT__
> #endif
> 
> Hope it helps!
> 
> 
> And finally, I know this is not the good mailing list for that, but is there 
> a way to do:
> 1. Pure software OpenGL with Mesa-Win32?

Yes, there is. Install download mesa master, install scons, 
  
  scons -j %NUMBER_OF_PROCESSORS% platform=windows debug=yes statetrackers=mesa 
drivers=softpipe,trace winsys=gdi

It will generate a
mesa/build/windows-x86-debug/gallium/winsys/gdi/opengl32.dll which is a
drop-in replacement for Microsoft's opengl32.dll. Copy it to the
directory where your application is and run it.

> 2. Hardware/Software mixed OpenGL (= Hardware when supported, Software when 
> not)?

I don't know what you mean here. This is already what you get when you
use an Opengl driver from a hardware vendor.

Jose


------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to