aboutsummaryrefslogtreecommitdiffstats
path: root/gl4java/drawable/Win32SunJDK13GLDrawableFactory.java-jau
blob: c10572e678ae9e6b6345e4e5e6bb5f7a6ee0a0ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package gl4java.drawable;

import java.awt.*;
import java.lang.reflect.*;
import java.util.*;
import sun.awt.*;
import gl4java.*;

public class Win32SunJDK13GLDrawableFactory 
	extends SunJDK13GLDrawableFactory 
{
    public Win32SunJDK13GLDrawableFactory() {
        // describeAllGraphicsConfigurations();
    }

    public GraphicsConfiguration
        getGraphicsConfiguration(GLCapabilities capabilities,
                                 GraphicsDevice device) {
        // On Windows, ChoosePixelFormat does not work as desired; it
        // shoehorns the given pixel format descriptor into what a
        // particular window can render. Instead we enumerate all possible
        // pixel formats for a given GraphicsDevice and try to find one
        // matching the given capabilities. To do this we provide
        // accessors which query the OpenGL-related properties of a
        // GraphicsConfiguration. FIXME: should implement better selection
        // algorithm; this one does not choose the most minimal.

        Win32GraphicsDevice w32Device = (Win32GraphicsDevice) device;
	int screen = w32Device.getScreen();

        int nPixelFormat = (int) ChoosePixelFormatNum (screen,
	                                        capabilities,
						GLContext.gljNativeDebug);
    
        return Win32GraphicsConfig.getConfig(w32Device, nPixelFormat);
    }

    //----------------------------------------------------------------------
    // Internals only below this point
    //

  // Needs to return an PixelFormatNumber can be wrapped in an
  // X11GraphicsConfig object
  static native long ChoosePixelFormatNum (int screen,
                                        GLCapabilities capabilities, 
					boolean verbose);
}