1 /*******************************************************************************
2 * Copyright (c) 2000, 2012 IBM Corporation and others.
4 * This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License 2.0
6 * which accompanies this distribution, and is available at
7 * https://www.eclipse.org/legal/epl-2.0/
9 * SPDX-License-Identifier: EPL-2.0
12 * IBM Corporation - initial API and implementation
13 *******************************************************************************/
14 package org.eclipse.swt.internal.opengl.win32;
16 import org.eclipse.swt.internal.*;
18 public class WGL extends Platform {
20 Library.loadLibrary("swt-wgl");
23 public static final int WGL_FONT_LINES = 0;
24 public static final int WGL_FONT_POLYGONS = 1;
26 /* LAYERPLANEDESCRIPTOR flags */
27 public static final int LPD_DOUBLEBUFFER = 0x00000001;
28 public static final int LPD_STEREO = 0x00000002;
29 public static final int LPD_SUPPORT_GDI = 0x00000010;
30 public static final int LPD_SUPPORT_OPENGL = 0x00000020;
31 public static final int LPD_SHARE_DEPTH = 0x00000040;
32 public static final int LPD_SHARE_STENCIL = 0x00000080;
33 public static final int LPD_SHARE_ACCUM = 0x00000100;
34 public static final int LPD_SWAP_EXCHANGE = 0x00000200;
35 public static final int LPD_SWAP_COPY = 0x00000400;
36 public static final int LPD_TRANSPARENT = 0x00001000;
38 public static final int LPD_TYPE_RGBA = 0;
39 public static final int LPD_TYPE_COLORINDEX = 1;
41 /* wglSwapLayerBuffers flags */
42 public static final int WGL_SWAP_MAIN_PLANE = 0x00000001;
43 public static final int WGL_SWAP_OVERLAY1 = 0x00000002;
44 public static final int WGL_SWAP_OVERLAY2 = 0x00000004;
45 public static final int WGL_SWAP_OVERLAY3 = 0x00000008;
46 public static final int WGL_SWAP_OVERLAY4 = 0x00000010;
47 public static final int WGL_SWAP_OVERLAY5 = 0x00000020;
48 public static final int WGL_SWAP_OVERLAY6 = 0x00000040;
49 public static final int WGL_SWAP_OVERLAY7 = 0x00000080;
50 public static final int WGL_SWAP_OVERLAY8 = 0x00000100;
51 public static final int WGL_SWAP_OVERLAY9 = 0x00000200;
52 public static final int WGL_SWAP_OVERLAY10 = 0x00000400;
53 public static final int WGL_SWAP_OVERLAY11 = 0x00000800;
54 public static final int WGL_SWAP_OVERLAY12 = 0x00001000;
55 public static final int WGL_SWAP_OVERLAY13 = 0x00002000;
56 public static final int WGL_SWAP_OVERLAY14 = 0x00004000;
57 public static final int WGL_SWAP_OVERLAY15 = 0x00008000;
58 public static final int WGL_SWAP_UNDERLAY1 = 0x00010000;
59 public static final int WGL_SWAP_UNDERLAY2 = 0x00020000;
60 public static final int WGL_SWAP_UNDERLAY3 = 0x00040000;
61 public static final int WGL_SWAP_UNDERLAY4 = 0x00080000;
62 public static final int WGL_SWAP_UNDERLAY5 = 0x00100000;
63 public static final int WGL_SWAP_UNDERLAY6 = 0x00200000;
64 public static final int WGL_SWAP_UNDERLAY7 = 0x00400000;
65 public static final int WGL_SWAP_UNDERLAY8 = 0x00800000;
66 public static final int WGL_SWAP_UNDERLAY9 = 0x01000000;
67 public static final int WGL_SWAP_UNDERLAY10 = 0x02000000;
68 public static final int WGL_SWAP_UNDERLAY11 = 0x04000000;
69 public static final int WGL_SWAP_UNDERLAY12 = 0x08000000;
70 public static final int WGL_SWAP_UNDERLAY13 = 0x10000000;
71 public static final int WGL_SWAP_UNDERLAY14 = 0x20000000;
72 public static final int WGL_SWAP_UNDERLAY15 = 0x40000000;
75 public static final int PFD_TYPE_RGBA = 0;
76 public static final int PFD_TYPE_COLORINDEX = 1;
79 public static final int PFD_MAIN_PLANE = 0;
80 public static final int PFD_OVERLAY_PLANE = 1;
81 public static final int PFD_UNDERLAY_PLANE = (-1);
83 /* PIXELFORMATDESCRIPTOR flags */
84 public static final int PFD_DOUBLEBUFFER = 0x00000001;
85 public static final int PFD_STEREO = 0x00000002;
86 public static final int PFD_DRAW_TO_WINDOW = 0x00000004;
87 public static final int PFD_DRAW_TO_BITMAP = 0x00000008;
88 public static final int PFD_SUPPORT_GDI = 0x00000010;
89 public static final int PFD_SUPPORT_OPENGL = 0x00000020;
90 public static final int PFD_GENERIC_FORMAT = 0x00000040;
91 public static final int PFD_NEED_PALETTE = 0x00000080;
92 public static final int PFD_NEED_SYSTEM_PALETTE = 0x00000100;
93 public static final int PFD_SWAP_EXCHANGE = 0x00000200;
94 public static final int PFD_SWAP_COPY = 0x00000400;
95 public static final int PFD_SWAP_LAYER_BUFFERS = 0x00000800;
96 public static final int PFD_GENERIC_ACCELERATED = 0x00001000;
97 public static final int PFD_SUPPORT_DIRECTDRAW = 0x00002000;
99 /* PIXELFORMATDESCRIPTOR flags for use in ChoosePixelFormat only */
100 public static final int PFD_DEPTH_DONTCARE = 0x20000000;
101 public static final int PFD_DOUBLEBUFFER_DONTCARE = 0x40000000;
102 public static final int PFD_STEREO_DONTCARE = 0x80000000;
104 /** @param hdc cast=(HDC) */
105 public static final native int ChoosePixelFormat(long hdc, PIXELFORMATDESCRIPTOR ppfd);
106 /** @param hdc cast=(HDC) */
107 public static final native int DescribePixelFormat(long hdc, int iPixelFormat, int nBytes, PIXELFORMATDESCRIPTOR ppfd);
108 /** @param hdc cast=(HDC) */
109 public static final native int GetPixelFormat(long hdc);
110 /** @param hdc cast=(HDC) */
111 public static final native boolean SetPixelFormat(long hdc, int iPixelFormat, PIXELFORMATDESCRIPTOR ppfd);
112 /** @param hdc cast=(HDC) */
113 public static final native boolean SwapBuffers(long hdc);
115 * @param hglrcSrc cast=(HGLRC)
116 * @param hglrcDst cast=(HGLRC)
118 public static final native boolean wglCopyContext(long hglrcSrc, long hglrcDst, int mask);
119 /** @param hdc cast=(HDC) */
120 public static final native long wglCreateContext(long hdc);
121 /** @param hdc cast=(HDC) */
122 public static final native long wglCreateLayerContext(long hdc, int iLayerPlane);
123 /** @param hglrc cast=(HGLRC) */
124 public static final native boolean wglDeleteContext(long hglrc);
125 public static final native long wglGetCurrentContext();
126 public static final native long wglGetCurrentDC();
127 public static final native long wglGetProcAddress(byte[] lpszProc);
129 * @param hdc cast=(HDC)
130 * @param hglrc cast=(HGLRC)
132 public static final native boolean wglMakeCurrent(long hdc, long hglrc);
134 * @param hglrc1 cast=(HGLRC)
135 * @param hglrc2 cast=(HGLRC)
137 public static final native boolean wglShareLists(long hglrc1, long hglrc2);
138 /** @param hdc cast=(HDC) */
139 public static final native boolean wglDescribeLayerPlane(long hdc, int iPixelFormat, int iLayerPlane, int nBytes, LAYERPLANEDESCRIPTOR plpd);
141 * @param hdc cast=(HDC)
142 * @param pcr cast=(COLORREF *)
144 public static final native int wglSetLayerPaletteEntries(long hdc, int iLayerPlane, int iStart, int cEntries, int[] pcr);
146 * @param hdc cast=(HDC)
147 * @param pcr cast=(COLORREF *)
149 public static final native int wglGetLayerPaletteEntries(long hdc, int iLayerPlane, int iStart, int cEntries, int[] pcr);
150 /** @param hdc cast=(HDC) */
151 public static final native boolean wglRealizeLayerPalette(long hdc, int iLayerPlane, boolean bRealize);
152 /** @param hdc cast=(HDC) */
153 public static final native boolean wglSwapLayerBuffers(long hdc, int fuPlanes);