2007-07-23 00:15:18 +00:00
#region - - - License - - -
/ * Copyright ( c ) 2006 , 2007 Stefanos Apostolopoulos
* Contributions from Erik Ylvisaker
* See license . txt for license info
* /
#endregion
2007-09-09 15:10:21 +00:00
#region - - - Using Directives - - -
2007-07-23 00:15:18 +00:00
using System ;
using System.Collections.Generic ;
using System.Text ;
using System.Runtime.InteropServices ;
2007-09-09 15:10:21 +00:00
using System.Diagnostics ;
2007-07-23 00:15:18 +00:00
2008-02-02 00:58:26 +00:00
using OpenTK.Graphics.OpenGL ;
2008-01-31 14:22:37 +00:00
using OpenTK.Graphics ;
2007-09-09 15:10:21 +00:00
#endregion
2007-07-23 00:15:18 +00:00
namespace OpenTK.Platform.Windows
{
2007-09-09 11:52:09 +00:00
/// <summary>
/// Provides methods to create and control an opengl context on the Windows platform.
2007-12-09 18:15:51 +00:00
/// This class supports OpenTK, and is not intended for use by OpenTK programs.
2007-09-09 11:52:09 +00:00
/// </summary>
2008-01-31 13:17:42 +00:00
internal sealed class WinGLContext : IGraphicsContext , IGLContextInternal , IGLContextCreationHack
2007-07-23 00:15:18 +00:00
{
2008-02-28 13:57:07 +00:00
IntPtr deviceContext ;
ContextHandle renderContext ;
static IntPtr opengl32Handle ;
const string opengl32Name = "OPENGL32.DLL" ;
WinWindowInfo windowInfo = new WinWindowInfo ( ) ;
2007-07-23 00:15:18 +00:00
2008-02-28 15:26:13 +00:00
GraphicsMode format ;
2008-02-28 13:57:07 +00:00
//DisplayMode mode = null;
bool vsync_supported ;
2007-08-20 12:25:48 +00:00
2008-02-28 13:57:07 +00:00
bool disposed ;
2007-07-23 00:15:18 +00:00
#region - - - Contructors - - -
2008-01-31 13:15:17 +00:00
static WinGLContext ( )
2007-09-09 11:52:09 +00:00
{
2008-01-31 13:15:17 +00:00
// Set the GetCurrentContext implementation.
2008-02-28 13:57:07 +00:00
// TODO: Does this belong here?
2008-01-31 14:39:54 +00:00
if ( GraphicsContext . GetCurrentContext = = null )
GraphicsContext . GetCurrentContext = WinGLContext . GetCurrentContext ;
2008-02-28 13:57:07 +00:00
// Dynamically load the OpenGL32.dll in order to use the extension loading capabilities of Wgl.
if ( opengl32Handle = = IntPtr . Zero )
{
opengl32Handle = Functions . LoadLibrary ( opengl32Name ) ;
if ( opengl32Handle = = IntPtr . Zero )
throw new ApplicationException ( String . Format ( "LoadLibrary(\"{0}\") call failed with code {1}" ,
opengl32Name , Marshal . GetLastWin32Error ( ) ) ) ;
Debug . WriteLine ( String . Format ( "Loaded opengl32.dll: {0}" , opengl32Handle ) ) ;
}
2008-01-31 13:15:17 +00:00
}
2008-02-28 15:26:13 +00:00
GraphicsMode SelectFormat ( GraphicsMode format )
2008-01-31 13:15:17 +00:00
{
2008-02-28 13:57:07 +00:00
using ( WinGLNative native = new WinGLNative ( 16 , 16 ) )
//using (WinGLContext context = new WinGLContext(format, native.WindowInfo, null))
{
// Find the best multisampling mode.
return format ;
}
}
2008-02-28 15:26:13 +00:00
public WinGLContext ( GraphicsMode format , IWindowInfo window , IGraphicsContext sharedContext )
2008-02-28 13:57:07 +00:00
{
//format = this.SelectFormat(format);
this . windowInfo = ( WinWindowInfo ) window ;
Debug . Print ( "OpenGL will be bound to handle: {0}" , this . windowInfo . Handle ) ;
if ( this . windowInfo . Handle = = IntPtr . Zero )
throw new ArgumentException ( "window" , "Must be a valid window." ) ;
Debug . Print ( "Setting pixel format..." ) ;
this . format = this . SetGraphicsFormatPFD ( format ) ;
Debug . Write ( "Creating render context... " ) ;
// Do not rely on OpenTK.Platform.Windows.Wgl - the context is not ready yet,
// and Wgl extensions will fail to load.
renderContext = new ContextHandle ( Wgl . Imports . CreateContext ( deviceContext ) ) ;
if ( renderContext = = IntPtr . Zero )
throw new GraphicsContextException ( String . Format ( "Context creation failed. Wgl.CreateContext() error: {0}." ,
Marshal . GetLastWin32Error ( ) ) ) ;
Debug . WriteLine ( String . Format ( "done! (id: {0})" , renderContext ) ) ;
Wgl . Imports . MakeCurrent ( deviceContext , renderContext ) ;
Wgl . LoadAll ( ) ;
GL . LoadAll ( ) ;
Glu . LoadAll ( ) ;
vsync_supported = Wgl . Arb . SupportsExtension ( this , "WGL_EXT_swap_control" ) & &
Wgl . Load ( "wglGetSwapIntervalEXT" ) & & Wgl . Load ( "wglSwapIntervalEXT" ) ;
if ( sharedContext ! = null )
{
Debug . Print ( "Sharing state with context {0}" , sharedContext . ToString ( ) ) ;
Wgl . Imports . ShareLists ( renderContext , ( sharedContext as IGLContextInternal ) . Context ) ;
}
2007-08-20 12:25:48 +00:00
}
2007-07-23 00:15:18 +00:00
2007-09-09 15:10:21 +00:00
#endregion
2007-12-09 18:15:51 +00:00
2008-01-31 13:17:42 +00:00
#region - - - IGraphicsContext Members - - -
2007-09-09 15:10:21 +00:00
2007-08-20 12:25:48 +00:00
#region public void CreateContext ( )
public void CreateContext ( )
2007-09-09 15:10:21 +00:00
{
2008-02-28 13:57:07 +00:00
throw new NotSupportedException ( ) ;
2007-09-09 15:10:21 +00:00
this . CreateContext ( true , null ) ;
}
#endregion
#region public void CreateContext ( bool direct )
public void CreateContext ( bool direct )
{
2008-02-28 13:57:07 +00:00
throw new NotSupportedException ( ) ;
2007-09-09 15:10:21 +00:00
this . CreateContext ( direct , null ) ;
}
#endregion
2008-01-31 13:17:42 +00:00
#region public void CreateContext ( bool direct , IGraphicsContext source )
2007-09-09 15:10:21 +00:00
2008-01-31 13:17:42 +00:00
public void CreateContext ( bool direct , IGraphicsContext source )
2007-08-20 12:25:48 +00:00
{
2008-02-28 13:57:07 +00:00
throw new NotSupportedException ( ) ;
2007-07-23 00:15:18 +00:00
}
2007-08-20 12:25:48 +00:00
#endregion
2007-07-23 00:15:18 +00:00
#region public void SwapBuffers ( )
public void SwapBuffers ( )
{
2007-09-26 11:55:24 +00:00
Functions . SwapBuffers ( deviceContext ) ;
2007-07-23 00:15:18 +00:00
}
#endregion
#region public void MakeCurrent ( )
public void MakeCurrent ( )
{
2007-09-03 21:47:34 +00:00
if ( ! Wgl . Imports . MakeCurrent ( deviceContext , renderContext ) )
{
Debug . Print ( "WinGLContext.MakeCurrent() call failed. Error: {0}" , Marshal . GetLastWin32Error ( ) ) ;
}
2007-07-23 00:15:18 +00:00
}
#endregion
2007-12-09 18:15:51 +00:00
#region public bool IsCurrent
public bool IsCurrent
{
get { return Wgl . GetCurrentContext ( ) = = this . renderContext ; }
2008-01-31 13:15:17 +00:00
set
{
if ( value )
Wgl . MakeCurrent ( this . deviceContext , this . renderContext ) ;
else
Wgl . MakeCurrent ( IntPtr . Zero , IntPtr . Zero ) ;
}
2007-12-09 18:15:51 +00:00
}
#endregion
2008-01-11 20:24:48 +00:00
#region public bool VSync
/// <summary>
/// Gets or sets a System.Boolean indicating whether SwapBuffer calls are synced to the screen refresh rate.
/// </summary>
public bool VSync
{
get
{
return vsync_supported & & Wgl . Ext . GetSwapInterval ( ) ! = 0 ;
}
set
{
if ( vsync_supported )
Wgl . Ext . SwapInterval ( value ? 1 : 0 ) ;
}
}
#endregion
2008-01-31 13:17:42 +00:00
public event DestroyEvent < IGraphicsContext > Destroy ;
2007-12-09 18:15:51 +00:00
2008-01-11 20:24:48 +00:00
#endregion
#region - - - IGLContextInternal Members - - -
2008-02-28 13:57:07 +00:00
#region ContextHandle IGLContextInternal . Context
2008-01-11 20:24:48 +00:00
ContextHandle IGLContextInternal . Context
2007-12-09 18:15:51 +00:00
{
2008-01-11 20:24:48 +00:00
get { return renderContext ; }
2007-12-09 18:15:51 +00:00
}
2008-01-11 20:24:48 +00:00
#endregion
2008-02-28 13:57:07 +00:00
#region IWindowInfo IGLContextInternal . Info
2008-01-11 20:24:48 +00:00
IWindowInfo IGLContextInternal . Info
2007-12-09 18:15:51 +00:00
{
2008-02-28 13:57:07 +00:00
get { return ( IWindowInfo ) windowInfo ; }
2008-01-11 20:24:48 +00:00
}
#endregion
2008-02-28 13:57:07 +00:00
#region GraphicsFormat IGLContextInternal . GraphicsFormat
2008-01-11 20:24:48 +00:00
2008-02-28 15:26:13 +00:00
GraphicsMode IGLContextInternal . GraphicsFormat
2008-01-11 20:24:48 +00:00
{
2008-02-28 13:57:07 +00:00
get { return format ; }
2008-01-11 20:24:48 +00:00
}
#endregion
#region public IntPtr GetAddress ( string function_string )
public IntPtr GetAddress ( string function_string )
{
return Wgl . Imports . GetProcAddress ( function_string ) ;
2007-12-09 18:15:51 +00:00
}
2008-01-11 20:24:48 +00:00
#endregion
2007-07-23 00:15:18 +00:00
#region public DisplayMode [ ] GetDisplayModes ( )
public IEnumerable < DisplayMode > GetDisplayModes ( )
{
2008-01-24 09:14:24 +00:00
throw new NotSupportedException ( "See OpenTK.Graphics.DisplayDevice.AvailableModes instead." ) ;
2007-07-23 00:15:18 +00:00
}
#endregion
2008-01-20 19:29:42 +00:00
#region void IGLContextInternal . RegisterForDisposal ( IDisposable resource )
2008-01-11 20:24:48 +00:00
void IGLContextInternal . RegisterForDisposal ( IDisposable resource )
2007-09-29 15:24:55 +00:00
{
2008-01-31 14:39:54 +00:00
throw new NotSupportedException ( "Use OpenTK.GraphicsContext instead." ) ;
2008-01-11 20:24:48 +00:00
}
2008-01-20 19:29:42 +00:00
#endregion
#region void IGLContextInternal . DisposeResources ( )
2008-01-11 20:24:48 +00:00
void IGLContextInternal . DisposeResources ( )
{
2008-01-31 14:39:54 +00:00
throw new NotSupportedException ( "Use OpenTK.GraphicsContext instead." ) ;
2008-01-11 20:24:48 +00:00
}
2008-01-20 19:29:42 +00:00
#endregion
2008-01-11 20:24:48 +00:00
2008-02-28 13:57:07 +00:00
#endregion
#region - - - Private Methods - - -
#region GraphicsFormat SetGraphicsFormatPFD ( GraphicsFormat format )
2008-02-28 15:26:13 +00:00
GraphicsMode SetGraphicsFormatPFD ( GraphicsMode format )
2008-02-28 13:57:07 +00:00
{
deviceContext = Functions . GetDC ( this . windowInfo . Handle ) ;
Debug . WriteLine ( String . Format ( "Device context: {0}" , deviceContext ) ) ;
Debug . Write ( "Setting pixel format... " ) ;
PixelFormatDescriptor pixelFormat = new PixelFormatDescriptor ( ) ;
pixelFormat . Size = API . PixelFormatDescriptorSize ;
pixelFormat . Version = API . PixelFormatDescriptorVersion ;
pixelFormat . Flags =
PixelFormatDescriptorFlags . SUPPORT_OPENGL |
PixelFormatDescriptorFlags . DRAW_TO_WINDOW ;
pixelFormat . ColorBits = ( byte ) ( format . ColorFormat . Red + format . ColorFormat . Green + format . ColorFormat . Blue ) ;
pixelFormat . PixelType = format . ColorFormat . IsIndexed ? PixelType . INDEXED : PixelType . RGBA ;
pixelFormat . PixelType = PixelType . RGBA ;
pixelFormat . RedBits = ( byte ) format . ColorFormat . Red ;
pixelFormat . GreenBits = ( byte ) format . ColorFormat . Green ;
pixelFormat . BlueBits = ( byte ) format . ColorFormat . Blue ;
pixelFormat . AlphaBits = ( byte ) format . ColorFormat . Alpha ;
if ( format . AccumulatorFormat ! = null )
{
pixelFormat . AccumBits = ( byte ) ( format . AccumulatorFormat . Red + format . AccumulatorFormat . Green + format . AccumulatorFormat . Blue ) ;
pixelFormat . AccumRedBits = ( byte ) format . AccumulatorFormat . Red ;
pixelFormat . AccumGreenBits = ( byte ) format . AccumulatorFormat . Green ;
pixelFormat . AccumBlueBits = ( byte ) format . AccumulatorFormat . Blue ;
pixelFormat . AccumAlphaBits = ( byte ) format . AccumulatorFormat . Alpha ;
}
pixelFormat . DepthBits = ( byte ) format . Depth ;
pixelFormat . StencilBits = ( byte ) format . Stencil ;
if ( format . Depth < = 0 ) pixelFormat . Flags | = PixelFormatDescriptorFlags . DEPTH_DONTCARE ;
if ( format . Stereo ) pixelFormat . Flags | = PixelFormatDescriptorFlags . STEREO ;
if ( format . Buffers > 1 ) pixelFormat . Flags | = PixelFormatDescriptorFlags . DOUBLEBUFFER ;
int pixel = Functions . ChoosePixelFormat ( deviceContext , ref pixelFormat ) ;
if ( pixel = = 0 )
throw new GraphicsModeException ( String . Format ( "The requested format is not available: {0}." , format ) ) ;
// Find out what we really got as a format:
PixelFormatDescriptor pfd = new PixelFormatDescriptor ( ) ;
pixelFormat . Size = API . PixelFormatDescriptorSize ;
pixelFormat . Version = API . PixelFormatDescriptorVersion ;
Functions . DescribePixelFormat ( deviceContext , pixel , API . PixelFormatDescriptorSize , ref pfd ) ;
2008-02-28 15:26:13 +00:00
GraphicsMode fmt = new GraphicsMode (
2008-02-28 13:57:07 +00:00
new ColorDepth ( pfd . RedBits , pfd . GreenBits , pfd . BlueBits , pfd . AlphaBits ) ,
pfd . DepthBits ,
pfd . StencilBits ,
0 ,
new ColorDepth ( pfd . AccumBits ) ,
( pfd . Flags & PixelFormatDescriptorFlags . DOUBLEBUFFER ) ! = 0 ? 2 : 1 ,
( pfd . Flags & PixelFormatDescriptorFlags . STEREO ) ! = 0 ) ;
if ( ! Functions . SetPixelFormat ( deviceContext , pixel , ref pixelFormat ) )
throw new GraphicsContextException ( String . Format ( "Requested GraphicsFormat not available. SetPixelFormat error: {0}" ,
Marshal . GetLastWin32Error ( ) ) ) ;
Debug . Print ( "done! (format: {0})" , pixel ) ;
return fmt ;
}
#endregion
#region GraphicsFormat SetGraphicsFormatARB ( GraphicsFormat format )
2008-02-28 15:26:13 +00:00
GraphicsMode SetGraphicsFormatARB ( GraphicsMode format )
2008-02-28 13:57:07 +00:00
{
return null ;
}
#endregion
2008-01-11 20:24:48 +00:00
#endregion
#region - - - IGLContextCreationHack Members - - -
#region bool IGLContextCreationHack . SelectDisplayMode ( DisplayMode mode , IWindowInfo info )
/// <summary>
/// HACK! This function will be removed in 0.3.15
/// Checks if the specified OpenTK.Platform.DisplayMode is available, and selects it if it is.
/// </summary>
/// <param name="mode">The OpenTK.Platform.DisplayMode to select.</param>
/// <param name="info">The OpenTK.Platform.IWindowInfo that describes the display to use. Note: a window handle is not necessary for this function!</param>
/// <returns>True if the DisplayMode is available, false otherwise.</returns>
bool IGLContextCreationHack . SelectDisplayMode ( DisplayMode mode , IWindowInfo info )
{
// Dynamically load the OpenGL32.dll in order to use the extension loading capabilities of Wgl.
if ( opengl32Handle = = IntPtr . Zero )
2007-09-29 15:24:55 +00:00
{
2008-01-11 20:24:48 +00:00
opengl32Handle = Functions . LoadLibrary ( opengl32Name ) ;
if ( opengl32Handle = = IntPtr . Zero )
{
//System.Diagnostics.Debug.WriteLine("LoadLibrary({0}) set error code: {1}. Will not load extensions.", _dll_name, error_code);
throw new ApplicationException ( String . Format ( "LoadLibrary(\"{0}\") call failed with code {1}" ,
opengl32Name , Marshal . GetLastWin32Error ( ) ) ) ;
}
Debug . WriteLine ( String . Format ( "Loaded opengl32.dll: {0}" , opengl32Handle ) ) ;
2007-09-29 15:24:55 +00:00
}
2008-01-11 20:24:48 +00:00
deviceContext = Functions . GetDC ( this . windowInfo . Handle ) ;
Debug . WriteLine ( String . Format ( "Device context: {0}" , deviceContext ) ) ;
Debug . Write ( "Setting pixel format... " ) ;
PixelFormatDescriptor pixelFormat = new PixelFormatDescriptor ( ) ;
pixelFormat . Size = API . PixelFormatDescriptorSize ;
pixelFormat . Version = API . PixelFormatDescriptorVersion ;
pixelFormat . Flags =
PixelFormatDescriptorFlags . SUPPORT_OPENGL |
PixelFormatDescriptorFlags . DRAW_TO_WINDOW ;
pixelFormat . ColorBits = ( byte ) ( mode . Color . Red + mode . Color . Green + mode . Color . Blue ) ;
if ( mode . Color . IsIndexed )
2007-09-29 15:24:55 +00:00
{
2008-01-11 20:24:48 +00:00
pixelFormat . PixelType = PixelType . INDEXED ;
}
else
{
pixelFormat . PixelType = PixelType . RGBA ;
pixelFormat . RedBits = ( byte ) mode . Color . Red ;
pixelFormat . GreenBits = ( byte ) mode . Color . Green ;
pixelFormat . BlueBits = ( byte ) mode . Color . Blue ;
pixelFormat . AlphaBits = ( byte ) mode . Color . Alpha ;
}
/ *
if ( accum ! = null )
{
pixelFormat . AccumBits = ( byte ) ( accum . Red + accum . Green + accum . Blue ) ;
pixelFormat . AccumRedBits = ( byte ) accum . Red ;
pixelFormat . AccumGreenBits = ( byte ) accum . Green ;
pixelFormat . AccumBlueBits = ( byte ) accum . Blue ;
pixelFormat . AccumAlphaBits = ( byte ) accum . Alpha ;
}
* /
2008-01-31 13:15:17 +00:00
pixelFormat . DepthBits = ( byte ) mode . DepthBits ;
pixelFormat . StencilBits = ( byte ) mode . StencilBits ;
2008-01-11 20:24:48 +00:00
2008-01-31 13:15:17 +00:00
if ( mode . DepthBits < = 0 )
2008-01-11 20:24:48 +00:00
{
pixelFormat . Flags | = PixelFormatDescriptorFlags . DEPTH_DONTCARE ;
}
if ( mode . Stereo )
{
pixelFormat . Flags | = PixelFormatDescriptorFlags . STEREO ;
2007-09-29 15:24:55 +00:00
}
2008-01-11 20:24:48 +00:00
if ( mode . Buffers > 1 )
{
pixelFormat . Flags | = PixelFormatDescriptorFlags . DOUBLEBUFFER ;
}
// TODO: More elaborate mode setting, using DescribePixelFormat.
/ *
unsafe
{
int pixel = Wgl . Imports . ChoosePixelFormat ( deviceContext , & pixelFormat ) ;
if ( pixel = = 0 )
{
throw new ApplicationException ( "The requested pixel format is not supported by the hardware configuration." ) ;
}
Wgl . Imports . SetPixelFormat ( deviceContext , pixel , & pixelFormat ) ;
Debug . WriteLine ( String . Format ( "done! (format: {0})" , pixel ) ) ;
}
* /
int pixel = Functions . ChoosePixelFormat ( deviceContext , ref pixelFormat ) ;
if ( pixel = = 0 )
{
Debug . Print ( "format not available..." ) ;
return false ;
}
Functions . SetPixelFormat ( deviceContext , pixel , ref pixelFormat ) ;
Debug . Print ( "done! (format: {0})" , pixel ) ;
return true ;
}
#endregion
void IGLContextCreationHack . SetWindowHandle ( IntPtr handle )
{
this . windowInfo . Handle = handle ;
2007-09-29 15:24:55 +00:00
}
2007-07-23 00:15:18 +00:00
#endregion
2008-02-28 13:57:07 +00:00
#region - - - Internal Methods - - -
2008-01-23 00:19:22 +00:00
#region internal IntPtr Device
internal IntPtr Device { get { return deviceContext ; } }
#endregion
2008-01-31 13:15:17 +00:00
#region static ContextHandle GetCurrentContext ( )
static ContextHandle GetCurrentContext ( )
{
return Wgl . GetCurrentContext ( ) ;
}
#endregion
2008-01-23 00:19:22 +00:00
#endregion
2008-02-28 13:57:07 +00:00
#region - - - Overrides - - -
/// <summary>Returns a System.String describing this OpenGL context.</summary>
/// <returns>A System.String describing this OpenGL context.</returns>
public override string ToString ( )
{
return ( this as IGLContextInternal ) . Context . ToString ( ) ;
}
#endregion
2007-07-23 00:15:18 +00:00
#region - - - IDisposable Members - - -
public void Dispose ( )
{
2007-08-10 16:55:24 +00:00
Dispose ( true ) ;
2007-07-23 00:15:18 +00:00
GC . SuppressFinalize ( this ) ;
}
private void Dispose ( bool calledManually )
{
if ( ! disposed )
{
2007-12-09 18:15:51 +00:00
DestroyContext ( ) ;
2007-07-23 00:15:18 +00:00
if ( calledManually )
{
// Safe to clean managed resources
}
disposed = true ;
}
}
~ WinGLContext ( )
{
Dispose ( false ) ;
}
2007-12-09 18:15:51 +00:00
#region private void DestroyContext ( )
2007-07-23 00:15:18 +00:00
2007-12-09 18:15:51 +00:00
private void DestroyContext ( )
2007-07-23 00:15:18 +00:00
{
2007-12-09 18:15:51 +00:00
if ( Destroy ! = null )
Destroy ( this , EventArgs . Empty ) ;
2007-07-23 00:15:18 +00:00
if ( renderContext ! = IntPtr . Zero )
{
2007-08-20 12:25:48 +00:00
Wgl . Imports . MakeCurrent ( IntPtr . Zero , IntPtr . Zero ) ;
if ( ! Wgl . Imports . DeleteContext ( renderContext ) )
2007-07-23 00:15:18 +00:00
{
2007-09-02 00:16:22 +00:00
//throw new ApplicationException("Could not destroy the OpenGL render context. Error: " + Marshal.GetLastWin32Error());
//Debug.Print("Could not destroy the OpenGL render context. Error: {0}", Marshal.GetLastWin32Error());
2007-07-23 00:15:18 +00:00
}
2008-01-11 20:24:48 +00:00
renderContext = null ;
2007-07-23 00:15:18 +00:00
}
2007-08-20 12:25:48 +00:00
if ( deviceContext ! = IntPtr . Zero )
{
2007-09-26 11:55:24 +00:00
if ( ! Functions . ReleaseDC ( this . windowInfo . Handle , deviceContext ) )
2007-08-20 12:25:48 +00:00
{
2007-09-02 00:16:22 +00:00
//throw new ApplicationException("Could not release device context. Error: " + Marshal.GetLastWin32Error());
//Debug.Print("Could not destroy the device context. Error: {0}", Marshal.GetLastWin32Error());
2007-08-20 12:25:48 +00:00
}
}
2007-12-09 18:15:51 +00:00
/ *
2007-07-23 00:15:18 +00:00
if ( opengl32Handle ! = IntPtr . Zero )
{
2007-09-26 11:55:24 +00:00
if ( ! Functions . FreeLibrary ( opengl32Handle ) )
2007-07-23 00:15:18 +00:00
{
2007-09-02 00:16:22 +00:00
//throw new ApplicationException("FreeLibray call failed ('opengl32.dll'), Error: " + Marshal.GetLastWin32Error());
//Debug.Print("Could not release {0}. Error: {1}", opengl32Name, Marshal.GetLastWin32Error());
2007-07-23 00:15:18 +00:00
}
opengl32Handle = IntPtr . Zero ;
}
2007-12-09 18:15:51 +00:00
* /
2007-07-23 00:15:18 +00:00
}
#endregion
#endregion
}
}