diff options
Diffstat (limited to 'src/classes/com/sun/opengl/impl/windows/wgl')
10 files changed, 69 insertions, 59 deletions
diff --git a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsDummyWGLDrawable.java b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsDummyWGLDrawable.java index 85447f00b..888e70ac1 100644 --- a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsDummyWGLDrawable.java +++ b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsDummyWGLDrawable.java @@ -39,6 +39,7 @@ package com.sun.opengl.impl.windows.wgl; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; @@ -46,7 +47,7 @@ public class WindowsDummyWGLDrawable extends WindowsWGLDrawable { private long hwnd, hdc; public WindowsDummyWGLDrawable(GLDrawableFactory factory) { - super(factory, new NullWindow(), true, new GLCapabilities(), null); + super(factory, new NullWindow(), true, new NWCapabilities(), null); // All entries to CreateDummyWindow must synchronize on one object // to avoid accidentally registering the dummy window class twice synchronized (WindowsDummyWGLDrawable.class) { @@ -56,7 +57,7 @@ public class WindowsDummyWGLDrawable extends WindowsWGLDrawable { NullWindow nw = (NullWindow) getNativeWindow(); nw.setSurfaceHandle(hdc); // Choose a (hopefully hardware-accelerated) OpenGL pixel format for this device context - GLCapabilities caps = new GLCapabilities(); + NWCapabilities caps = new NWCapabilities(); caps.setDepthBits(16); PIXELFORMATDESCRIPTOR pfd = glCapabilities2PFD(caps, true); int pixelFormat = WGL.ChoosePixelFormat(hdc, pfd); diff --git a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java index 826acc613..0514e1aec 100755 --- a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java +++ b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java @@ -39,13 +39,14 @@ package com.sun.opengl.impl.windows.wgl; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; public class WindowsExternalWGLDrawable extends WindowsWGLDrawable { public WindowsExternalWGLDrawable(GLDrawableFactory factory, NativeWindow component) { - super(factory, component, true, new GLCapabilities(), null); + super(factory, component, true, new NWCapabilities(), null); } public static WindowsExternalWGLDrawable create(GLDrawableFactory factory) { diff --git a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java index 03b52be9f..97041ff06 100644 --- a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java +++ b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java @@ -39,6 +39,7 @@ package com.sun.opengl.impl.windows.wgl; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; @@ -47,8 +48,8 @@ public class WindowsOffscreenWGLDrawable extends WindowsWGLDrawable { private long hbitmap; public WindowsOffscreenWGLDrawable(GLDrawableFactory factory, - GLCapabilities requestedCapabilities, - GLCapabilitiesChooser chooser, + NWCapabilities requestedCapabilities, + NWCapabilitiesChooser chooser, int width, int height) { super(factory, new NullWindow(), true, requestedCapabilities, chooser); @@ -62,7 +63,7 @@ public class WindowsOffscreenWGLDrawable extends WindowsWGLDrawable { private void create() { NullWindow nw = (NullWindow) getNativeWindow(); - GLCapabilities capabilities = getRequestedGLCapabilities(); + NWCapabilities capabilities = getRequestedNWCapabilities(); int width = getWidth(); int height = getHeight(); BITMAPINFO info = BITMAPINFO.create(); @@ -120,7 +121,7 @@ public class WindowsOffscreenWGLDrawable extends WindowsWGLDrawable { origbitmap = 0; hbitmap = 0; nw.setSurfaceHandle(0); - setChosenGLCapabilities(null); + setChosenNWCapabilities(null); } } } diff --git a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsOnscreenWGLContext.java b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsOnscreenWGLContext.java index 02459f590..7eb96c7dc 100644 --- a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsOnscreenWGLContext.java +++ b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsOnscreenWGLContext.java @@ -41,6 +41,7 @@ package com.sun.opengl.impl.windows.wgl; import java.util.*; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; diff --git a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsOnscreenWGLDrawable.java b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsOnscreenWGLDrawable.java index 52812f0e9..7c3cea255 100644 --- a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsOnscreenWGLDrawable.java +++ b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsOnscreenWGLDrawable.java @@ -39,6 +39,7 @@ package com.sun.opengl.impl.windows.wgl; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; @@ -53,8 +54,8 @@ public class WindowsOnscreenWGLDrawable extends WindowsWGLDrawable { private long profilingSwapBuffersTime; protected WindowsOnscreenWGLDrawable(GLDrawableFactory factory, NativeWindow component, - GLCapabilities capabilities, - GLCapabilitiesChooser chooser) { + NWCapabilities capabilities, + NWCapabilitiesChooser chooser) { super(factory, component, false, capabilities, chooser); } diff --git a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLContext.java b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLContext.java index ac3a5d5c8..e975670b4 100644 --- a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLContext.java +++ b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLContext.java @@ -39,6 +39,7 @@ package com.sun.opengl.impl.windows.wgl; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; @@ -62,7 +63,7 @@ public class WindowsPbufferWGLContext extends WindowsWGLContext { public void bindPbufferToTexture() { if (!rtt) { throw new GLException("Shouldn't try to bind a pbuffer to a texture if render-to-texture hasn't been " + - "specified in its GLCapabilities"); + "specified in its NWCapabilities"); } GL gl = getGL(); WGLExt wglExt = getWGLExt(); @@ -80,7 +81,7 @@ public class WindowsPbufferWGLContext extends WindowsWGLContext { public void releasePbufferFromTexture() { if (!rtt) { throw new GLException("Shouldn't try to bind a pbuffer to a texture if render-to-texture hasn't been " + - "specified in its GLCapabilities"); + "specified in its NWCapabilities"); } if (rtt && hasRTT) { WGLExt wglExt = getWGLExt(); @@ -96,7 +97,7 @@ public class WindowsPbufferWGLContext extends WindowsWGLContext { System.err.println("WindowsPbufferWGLContext: super.makeCurrentImpl() = " + res); } if (res == CONTEXT_CURRENT_NEW) { - GLCapabilities capabilities = drawable.getRequestedGLCapabilities(); + NWCapabilities capabilities = drawable.getRequestedNWCapabilities(); // Initialize render-to-texture support if requested GL gl = getGL(); diff --git a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java index 076031093..74e7c1a85 100644 --- a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java +++ b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java @@ -39,6 +39,7 @@ package com.sun.opengl.impl.windows.wgl; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; @@ -51,7 +52,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { private int floatMode; public WindowsPbufferWGLDrawable(GLDrawableFactory factory, - GLCapabilities requestedCapabilities, + NWCapabilities requestedCapabilities, int width, int height, WindowsWGLDrawable dummyDrawable, @@ -94,7 +95,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { throw new GLException("Error destroying pbuffer: error code " + WGL.GetLastError()); } buffer = 0; - setChosenGLCapabilities(null); + setChosenNWCapabilities(null); } } @@ -124,8 +125,8 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { } // This is public to allow access from PbufferContext - public GLCapabilities getRequestedGLCapabilities() { - return super.getRequestedGLCapabilities(); + public NWCapabilities getRequestedNWCapabilities() { + return super.getRequestedNWCapabilities(); } private void createPbuffer(long parentHdc, WGLExt wglExt) { @@ -135,7 +136,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { int niattribs = 0; int width, height; - GLCapabilities capabilities = getRequestedGLCapabilities(); + NWCapabilities capabilities = getRequestedNWCapabilities(); if (DEBUG) { System.out.println("Pbuffer parentHdc = " + toHexString(parentHdc)); @@ -307,7 +308,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { int[] ivalues = new int[niattribs]; // FIXME: usually prefer to throw exceptions, but failure here is not critical if (wglExt.wglGetPixelFormatAttribiv(parentHdc, pformats[whichFormat], 0, niattribs, iattributes, 0, ivalues, 0)) { - setChosenGLCapabilities(iattributes2GLCapabilities(iattributes, niattribs, ivalues, false)); + setChosenNWCapabilities(iattributes2NWCapabilities(iattributes, niattribs, ivalues, false)); } } diff --git a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLContext.java b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLContext.java index a02634a26..1ce190da3 100644 --- a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLContext.java +++ b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLContext.java @@ -41,6 +41,7 @@ package com.sun.opengl.impl.windows.wgl; import java.nio.*; import java.util.*; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; import com.sun.gluegen.runtime.ProcAddressTable; diff --git a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawable.java b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawable.java index c8965e0db..430270e37 100644 --- a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawable.java +++ b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawable.java @@ -39,13 +39,14 @@ package com.sun.opengl.impl.windows.wgl; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; public abstract class WindowsWGLDrawable extends GLDrawableImpl { protected static final boolean DEBUG = Debug.debug("WindowsWGLDrawable"); - protected GLCapabilitiesChooser chooser; + protected NWCapabilitiesChooser chooser; protected boolean pixelFormatChosen; // Workaround for problems on Intel 82855 cards @@ -56,8 +57,8 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl { protected static final int MAX_ATTRIBS = 256; public WindowsWGLDrawable(GLDrawableFactory factory, NativeWindow comp, boolean realized, - GLCapabilities requestedCapabilities, - GLCapabilitiesChooser chooser) { + NWCapabilities requestedCapabilities, + NWCapabilitiesChooser chooser) { super(factory, comp, requestedCapabilities, realized); this.chooser = chooser; } @@ -89,7 +90,7 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl { } return NativeWindow.LOCK_SURFACE_NOT_READY; } else { - // Probably a user error in the GLCapabilitiesChooser or similar. + // Probably a user error in the NWCapabilitiesChooser or similar. // Don't propagate non-GLExceptions out because calling code // expects to catch only that exception type throw new GLException(e); @@ -103,8 +104,8 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl { protected void choosePixelFormat(boolean onscreen) { PIXELFORMATDESCRIPTOR pfd = null; int pixelFormat = 0; - GLCapabilities chosenCaps = null; - GLCapabilities capabilities = getRequestedGLCapabilities(); + NWCapabilities chosenCaps = null; + NWCapabilities capabilities = getRequestedNWCapabilities(); long hdc = getNativeWindow().getSurfaceHandle(); if (onscreen) { if ((pixelFormat = WGL.GetPixelFormat(hdc)) != 0) { @@ -120,15 +121,15 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl { throw new GLException("Unable to describe pixel format " + pixelFormat + " of window set by Java2D/OpenGL pipeline"); } - setChosenGLCapabilities(pfd2GLCapabilities(pfd)); + setChosenNWCapabilities(pfd2NWCapabilities(pfd)); pixelFormatChosen = true; return; } - GLCapabilities[] availableCaps = null; + NWCapabilities[] availableCaps = null; int numFormats = 0; pfd = newPixelFormatDescriptor(); - // Produce a recommended pixel format selection for the GLCapabilitiesChooser. + // Produce a recommended pixel format selection for the NWCapabilitiesChooser. // Use wglChoosePixelFormatARB if user requested multisampling and if we have it available WindowsWGLDrawable dummyDrawable = null; GLContextImpl dummyContext = null; @@ -186,17 +187,17 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl { if (recommendedPixelFormat < 0) { System.err.print(getThreadName() + ": wglChoosePixelFormatARB didn't recommend a pixel format"); if (capabilities.getSampleBuffers()) { - System.err.print(" for multisampled GLCapabilities"); + System.err.print(" for multisampled NWCapabilities"); } System.err.println(); } } - // Produce a list of GLCapabilities to give to the - // GLCapabilitiesChooser. + // Produce a list of NWCapabilities to give to the + // NWCapabilitiesChooser. // Use wglGetPixelFormatAttribivARB instead of // DescribePixelFormat to get higher-precision information - // about the pixel format (should make the GLCapabilities + // about the pixel format (should make the NWCapabilities // more precise as well...i.e., remove the // "HardwareAccelerated" bit, which is basically // meaningless, and put in whether it can render to a @@ -212,7 +213,7 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl { // Should we be filtering out the pixel formats which aren't // applicable, as we are doing here? - // We don't have enough information in the GLCapabilities to + // We don't have enough information in the NWCapabilities to // represent those that aren't... iattributes[niattribs++] = WGLExt.WGL_DRAW_TO_WINDOW; iattributes[niattribs++] = WGLExt.WGL_ACCELERATION; @@ -235,12 +236,12 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl { iattributes[niattribs++] = WGLExt.WGL_SAMPLES; } - availableCaps = new GLCapabilities[numFormats]; + availableCaps = new NWCapabilities[numFormats]; for (int i = 0; i < numFormats; i++) { if (!dummyWGLExt.wglGetPixelFormatAttribiv(hdc, i+1, 0, niattribs, iattributes, 0, iresults, 0)) { throw new GLException("Error getting pixel format attributes for pixel format " + (i + 1) + " of device context"); } - availableCaps[i] = iattributes2GLCapabilities(iattributes, niattribs, iresults, true); + availableCaps[i] = iattributes2NWCapabilities(iattributes, niattribs, iresults, true); } gotAvailableCaps = true; } else { @@ -278,19 +279,19 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl { numFormats = WGL.DescribePixelFormat(hdc, 1, 0, null); if (numFormats == 0) { throw new GLException("Unable to enumerate pixel formats of window " + - toHexString(hdc) + " for GLCapabilitiesChooser"); + toHexString(hdc) + " for NWCapabilitiesChooser"); } - availableCaps = new GLCapabilities[numFormats]; + availableCaps = new NWCapabilities[numFormats]; for (int i = 0; i < numFormats; i++) { if (WGL.DescribePixelFormat(hdc, 1 + i, pfd.size(), pfd) == 0) { throw new GLException("Error describing pixel format " + (1 + i) + " of device context"); } - availableCaps[i] = pfd2GLCapabilities(pfd); + availableCaps[i] = pfd2NWCapabilities(pfd); } } // NOTE: officially, should make a copy of all of these - // GLCapabilities to avoid mutation by the end user during the + // NWCapabilities to avoid mutation by the end user during the // chooseCapabilities call, but for the time being, assume they // won't be changed @@ -298,7 +299,7 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl { pixelFormat = chooser.chooseCapabilities(capabilities, availableCaps, recommendedPixelFormat); if ((pixelFormat < 0) || (pixelFormat >= numFormats)) { throw new GLException("Invalid result " + pixelFormat + - " from GLCapabilitiesChooser (should be between 0 and " + + " from NWCapabilitiesChooser (should be between 0 and " + (numFormats - 1) + ")"); } if (DEBUG) { @@ -326,19 +327,19 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl { } throw new GLException("Unable to set pixel format " + pixelFormat + " for device context " + toHexString(hdc) + ": error code " + lastError); } - // Reuse the previously-constructed GLCapabilities because it + // Reuse the previously-constructed NWCapabilities because it // turns out that using DescribePixelFormat on some pixel formats // (which, for example, support full-scene antialiasing) for some // reason return that they are not OpenGL-capable if (chosenCaps != null) { - setChosenGLCapabilities(chosenCaps); + setChosenNWCapabilities(chosenCaps); } else { - setChosenGLCapabilities(pfd2GLCapabilities(pfd)); + setChosenNWCapabilities(pfd2NWCapabilities(pfd)); } pixelFormatChosen = true; } - protected static PIXELFORMATDESCRIPTOR glCapabilities2PFD(GLCapabilities caps, boolean onscreen) { + protected static PIXELFORMATDESCRIPTOR glCapabilities2PFD(NWCapabilities caps, boolean onscreen) { int colorDepth = (caps.getRedBits() + caps.getGreenBits() + caps.getBlueBits()); @@ -387,11 +388,11 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl { return pfd; } - protected static GLCapabilities pfd2GLCapabilities(PIXELFORMATDESCRIPTOR pfd) { + protected static NWCapabilities pfd2NWCapabilities(PIXELFORMATDESCRIPTOR pfd) { if ((pfd.dwFlags() & WGL.PFD_SUPPORT_OPENGL) == 0) { return null; } - GLCapabilities res = new GLCapabilities(); + NWCapabilities res = new NWCapabilities(); res.setRedBits (pfd.cRedBits()); res.setGreenBits (pfd.cGreenBits()); res.setBlueBits (pfd.cBlueBits()); @@ -409,7 +410,7 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl { return res; } - protected static boolean glCapabilities2iattributes(GLCapabilities capabilities, + protected static boolean glCapabilities2iattributes(NWCapabilities capabilities, int[] iattributes, WGLExt wglExt, boolean pbuffer, @@ -531,7 +532,7 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl { } else { if (!rtt) { // Currently we don't support non-truecolor visuals in the - // GLCapabilities, so we don't offer the option of making + // NWCapabilities, so we don't offer the option of making // color-index pbuffers. iattributes[niattribs++] = WGLExt.WGL_PIXEL_TYPE; iattributes[niattribs++] = WGLExt.WGL_TYPE_RGBA; @@ -564,11 +565,11 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl { return true; } - protected static GLCapabilities iattributes2GLCapabilities(int[] iattribs, + protected static NWCapabilities iattributes2NWCapabilities(int[] iattribs, int niattribs, int[] iresults, boolean requireRenderToWindow) { - GLCapabilities res = new GLCapabilities(); + NWCapabilities res = new NWCapabilities(); for (int i = 0; i < niattribs; i++) { int attr = iattribs[i]; switch (attr) { diff --git a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java index 4fe0900a6..0911a2988 100644 --- a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java +++ b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java @@ -41,6 +41,7 @@ package com.sun.opengl.impl.windows.wgl; import java.nio.*; import java.util.*; +import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; import javax.media.opengl.util.BufferUtil; @@ -57,30 +58,30 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { super(); } - public AbstractGraphicsConfiguration chooseGraphicsConfiguration(GLCapabilities capabilities, - GLCapabilitiesChooser chooser, + public AbstractGraphicsConfiguration chooseGraphicsConfiguration(NWCapabilities capabilities, + NWCapabilitiesChooser chooser, AbstractGraphicsDevice device) { return null; } public GLDrawable createGLDrawable(NativeWindow target, - GLCapabilities capabilities, - GLCapabilitiesChooser chooser) { + NWCapabilities capabilities, + NWCapabilitiesChooser chooser) { if (target == null) { throw new IllegalArgumentException("Null target"); } target = NativeWindowFactory.getNativeWindow(target); if (capabilities == null) { - capabilities = new GLCapabilities(); + capabilities = new NWCapabilities(); } if (chooser == null) { - chooser = new DefaultGLCapabilitiesChooser(); + chooser = new DefaultNWCapabilitiesChooser(); } return new WindowsOnscreenWGLDrawable(this, target, capabilities, chooser); } - public GLDrawableImpl createOffscreenDrawable(GLCapabilities capabilities, - GLCapabilitiesChooser chooser, + public GLDrawableImpl createOffscreenDrawable(NWCapabilities capabilities, + NWCapabilitiesChooser chooser, int width, int height) { return new WindowsOffscreenWGLDrawable(this, capabilities, chooser, width, height); @@ -121,8 +122,8 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { return canCreateGLPbuffer; } - public GLPbuffer createGLPbuffer(final GLCapabilities capabilities, - final GLCapabilitiesChooser chooser, + public GLPbuffer createGLPbuffer(final NWCapabilities capabilities, + final NWCapabilitiesChooser chooser, final int initialWidth, final int initialHeight, final GLContext shareWith) { |