#region --- License ---
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
* See license.txt for license info
*/
#endregion
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK.Platform
{
///
/// Provides methods for creating and interacting with an OpenGL context.
///
public interface IGLContext : IDisposable
{
///
/// Gets a handle to the OpenGL rendering context.
///
IntPtr Context { get; }
///
/// Gets the IWindowInfo describing the window associated with this context.
///
IWindowInfo Info { get; }
///
/// Gets the DisplayMode of the context.
///
DisplayMode Mode { get; }
///
/// Creates an OpenGL context with the specified direct/indirect rendering mode and sharing state with the
/// specified IGLContext.
///
/// Set to true for direct rendering or false otherwise.
/// The source IGLContext to share state from..
///
void CreateContext(bool direct, IGLContext source);
///
/// Swaps buffers, presenting the rendered scene to the user.
///
void SwapBuffers();
///
/// Makes the Context current in the calling thread, i.e. future OpenGL commands will affect this Context.
///
void MakeCurrent();
///
/// Gets a System.Boolean indicating whether this Context is current in the calling thread.
///
bool IsCurrent { get; }
///
/// Gets a System.IntPtr containing the handle to the OpenGL context which is current in the
/// calling thread, or IntPtr.Zero if no OpenGL context is current.
///
/// A System.IntPtr that holds the handle to the current OpenGL context.
IntPtr GetCurrentContext();
///
/// Raised when a Context is destroyed.
///
event DestroyEvent Destroy;
///
/// Gets the address of an OpenGL extension function.
///
/// The name of the OpenGL function (e.g. "glGetString")
///
/// A pointer to the specified function or IntPtr.Zero if the function isn't
/// available in the current opengl context.
///
///
IntPtr GetAddress(string function);
///
/// Returns the display modes supported by the current opengl context.
///
/// An IEnumerable containing all supported display modes.
IEnumerable GetDisplayModes();
///
/// Gets or sets a value indicating whether VSyncing is enabled.
///
bool VSync { get; set; }
///
/// Registers an OpenGL resource for disposal.
///
/// The OpenGL resource to dispose.
///
/// You may not destroy OpenGL resources in finalizers, since they run in
/// a different thread. To avoid this problem, use this method to register
/// a resource for disposal during the finalizer call, and call DisposeResources()
/// from the main thread to dispose it.
///
void RegisterForDisposal(IDisposable resource);
///
/// Disposes all registered OpenGL resources.
///
void DisposeResources();
}
public delegate void DestroyEvent(T sender, EventArgs e);
}