-
Notifications
You must be signed in to change notification settings - Fork 308
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- merged removement of OpenGL related functions from utility library and
new animation parameter getter methods from develop branch
- Loading branch information
Showing
16 changed files
with
273 additions
and
208 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace Horde3DNET | ||
{ | ||
public class OpenGL | ||
{ | ||
[DllImport("user32.dll")] | ||
public static extern IntPtr GetDC( IntPtr hWnd); | ||
|
||
[DllImport("opengl32.dll", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)] | ||
public static extern IntPtr wglCreateContext(IntPtr hDC); | ||
|
||
[DllImport("opengl32.dll", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)] | ||
public static extern bool wglMakeCurrent(IntPtr hDC, IntPtr hglrc); | ||
|
||
[DllImport("opengl32.dll", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)] | ||
public static extern bool wglDeleteContext(IntPtr hglrc); | ||
|
||
[StructLayout(LayoutKind.Sequential)] | ||
public struct PIXELFORMATDESCRIPTOR | ||
{ | ||
public void Init() | ||
{ | ||
nSize = (ushort)Marshal.SizeOf(typeof(PIXELFORMATDESCRIPTOR)); | ||
nVersion = 1; | ||
dwFlags = PFD_FLAGS.PFD_DRAW_TO_WINDOW | PFD_FLAGS.PFD_SUPPORT_OPENGL | PFD_FLAGS.PFD_DOUBLEBUFFER; | ||
iPixelType = PFD_PIXEL_TYPE.PFD_TYPE_RGBA; | ||
cColorBits = 32; | ||
cRedBits = cRedShift = cGreenBits = cGreenShift = cBlueBits = cBlueShift = 0; | ||
cAlphaBits = 8; | ||
cAlphaShift = 0; | ||
cAccumBits = cAccumRedBits = cAccumGreenBits = cAccumBlueBits = cAccumAlphaBits = 0; | ||
cDepthBits = 32; | ||
cStencilBits = 8; | ||
cAuxBuffers = 0; | ||
iLayerType = PFD_LAYER_TYPES.PFD_MAIN_PLANE; | ||
bReserved = 0; | ||
dwLayerMask = dwVisibleMask = dwDamageMask = 0; | ||
} | ||
ushort nSize; | ||
ushort nVersion; | ||
PFD_FLAGS dwFlags; | ||
PFD_PIXEL_TYPE iPixelType; | ||
byte cColorBits; | ||
byte cRedBits; | ||
byte cRedShift; | ||
byte cGreenBits; | ||
byte cGreenShift; | ||
byte cBlueBits; | ||
byte cBlueShift; | ||
byte cAlphaBits; | ||
byte cAlphaShift; | ||
byte cAccumBits; | ||
byte cAccumRedBits; | ||
byte cAccumGreenBits; | ||
byte cAccumBlueBits; | ||
byte cAccumAlphaBits; | ||
byte cDepthBits; | ||
byte cStencilBits; | ||
byte cAuxBuffers; | ||
PFD_LAYER_TYPES iLayerType; | ||
byte bReserved; | ||
uint dwLayerMask; | ||
uint dwVisibleMask; | ||
uint dwDamageMask; | ||
} | ||
|
||
[Flags] | ||
public enum PFD_FLAGS : uint | ||
{ | ||
PFD_DOUBLEBUFFER = 0x00000001, | ||
PFD_STEREO = 0x00000002, | ||
PFD_DRAW_TO_WINDOW = 0x00000004, | ||
PFD_DRAW_TO_BITMAP = 0x00000008, | ||
PFD_SUPPORT_GDI = 0x00000010, | ||
PFD_SUPPORT_OPENGL = 0x00000020, | ||
PFD_GENERIC_FORMAT = 0x00000040, | ||
PFD_NEED_PALETTE = 0x00000080, | ||
PFD_NEED_SYSTEM_PALETTE = 0x00000100, | ||
PFD_SWAP_EXCHANGE = 0x00000200, | ||
PFD_SWAP_COPY = 0x00000400, | ||
PFD_SWAP_LAYER_BUFFERS = 0x00000800, | ||
PFD_GENERIC_ACCELERATED = 0x00001000, | ||
PFD_SUPPORT_DIRECTDRAW = 0x00002000, | ||
PFD_DIRECT3D_ACCELERATED = 0x00004000, | ||
PFD_SUPPORT_COMPOSITION = 0x00008000, | ||
PFD_DEPTH_DONTCARE = 0x20000000, | ||
PFD_DOUBLEBUFFER_DONTCARE = 0x40000000, | ||
PFD_STEREO_DONTCARE = 0x80000000 | ||
} | ||
|
||
public enum PFD_LAYER_TYPES : byte | ||
{ | ||
PFD_MAIN_PLANE = 0, | ||
PFD_OVERLAY_PLANE = 1, | ||
PFD_UNDERLAY_PLANE = 255 | ||
} | ||
|
||
public enum PFD_PIXEL_TYPE : byte | ||
{ | ||
PFD_TYPE_RGBA = 0, | ||
PFD_TYPE_COLORINDEX = 1 | ||
} | ||
|
||
[DllImport("gdi32.dll", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)] | ||
public static extern int ChoosePixelFormat(IntPtr hdc, [In] ref PIXELFORMATDESCRIPTOR ppfd); | ||
|
||
[DllImport("gdi32.dll", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)] | ||
public static extern bool SetPixelFormat(IntPtr hdc, int iPixelFormat, ref PIXELFORMATDESCRIPTOR ppfd); | ||
|
||
[DllImport("gdi32.dll", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)] | ||
public static extern bool SwapBuffers(IntPtr hdc); | ||
|
||
public enum StringName : uint | ||
{ | ||
GL_VENDOR = 0x1F00, | ||
GL_RENDERER = 0x1F01, | ||
GL_VERSION = 0x1F02, | ||
GL_EXTENSIONS = 0x1F03 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.