Java 类org.lwjgl.opengles.EGL 实例源码

项目:PhET    文件:LinuxDisplay.java   
public void createWindow(final DrawableLWJGL drawable, DisplayMode mode, Canvas parent, int x, int y) throws LWJGLException {
    lockAWT();
    try {
        incDisplay();
        try {
            if ( drawable instanceof DrawableGLES )
                peer_info = new LinuxDisplayPeerInfo();

            ByteBuffer handle = peer_info.lockAndGetHandle();
            try {
                current_window_mode = getWindowMode(Display.isFullscreen());
                // Try to enable Lecagy FullScreen Support in Compiz, else
                // we may have trouble with stuff overlapping our fullscreen window.
                if ( current_window_mode != WINDOWED )
                    Compiz.setLegacyFullscreenSupport(true);
                // Setting _MOTIF_WM_HINTS in fullscreen mode is problematic for certain window
                // managers. We do not set MWM_HINTS_DECORATIONS in fullscreen mode anymore,
                // unless org.lwjgl.opengl.Window.undecorated_fs has been specified.
                // See native/linux/org_lwjgl_opengl_Display.c, createWindow function.
                boolean undecorated = Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated") || (current_window_mode != WINDOWED && Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated_fs"));
                this.parent = parent;
                parent_window = parent != null ? getHandle(parent) : getRootWindow(getDisplay(), getDefaultScreen());
                resizable = Display.isResizable();
                resized = false;
                window_x = x;
                window_y = y;
                window_width = mode.getWidth();
                window_height = mode.getHeight();
                current_window = nCreateWindow(getDisplay(), getDefaultScreen(), handle, mode, current_window_mode, x, y, undecorated, parent_window, resizable);
                mapRaised(getDisplay(), current_window);
                xembedded = parent != null && isAncestorXEmbedded(parent_window);
                blank_cursor = createBlankCursor();
                current_cursor = None;
                focused = false;
                input_released = false;
                pointer_grabbed = false;
                keyboard_grabbed = false;
                close_requested = false;
                grab = false;
                minimized = false;
                dirty = true;

                if ( drawable instanceof DrawableGLES )
                    ((DrawableGLES)drawable).initialize(current_window, getDisplay(), EGL.EGL_WINDOW_BIT, (org.lwjgl.opengles.PixelFormat)drawable.getPixelFormat());

                if (parent != null) {
                    parent.addFocusListener(focus_listener);
                    parent_focused = parent.isFocusOwner();
                    parent_focus_changed = true;
                }
            } finally {
                peer_info.unlock();
            }
        } catch (LWJGLException e) {
            decDisplay();
            throw e;
        }
    } finally {
        unlockAWT();
    }
}
项目:PhET    文件:WindowsDisplay.java   
public void createWindow(DrawableLWJGL drawable, DisplayMode mode, Canvas parent, int x, int y) throws LWJGLException {
    close_requested = false;
    is_dirty = false;
    isMinimized = false;
    isFocused = false;
    redoMakeContextCurrent = false;
    maximized = false;
    this.parent = parent;
    hasParent = parent != null;
    long parent_hwnd = parent != null ? getHwnd(parent) : 0;
    this.hwnd = nCreateWindow(x, y, mode.getWidth(), mode.getHeight(), Display.isFullscreen() || isUndecorated(), parent != null, parent_hwnd);
    this.resizable=false;
    if (hwnd == 0) {
        throw new LWJGLException("Failed to create window");
    }
    this.hdc = getDC(hwnd);
    if (hdc == 0) {
        nDestroyWindow(hwnd);
        throw new LWJGLException("Failed to get dc");
    }

    try {
        if ( drawable instanceof DrawableGL ) {
            int format = WindowsPeerInfo.choosePixelFormat(getHdc(), 0, 0, (PixelFormat)drawable.getPixelFormat(), null, true, true, false, true);
            WindowsPeerInfo.setPixelFormat(getHdc(), format);
        } else {
            peer_info = new WindowsDisplayPeerInfo(true);
            ((DrawableGLES)drawable).initialize(hwnd, hdc, EGL.EGL_WINDOW_BIT, (org.lwjgl.opengles.PixelFormat)drawable.getPixelFormat());
        }
        peer_info.initDC(getHwnd(), getHdc());
        showWindow(getHwnd(), SW_SHOWDEFAULT);

        updateWidthAndHeight();

        if ( parent == null ) {
            if(Display.isResizable()) {
                setResizable(true);
            }
            setForegroundWindow(getHwnd());
        }
        grabFocus();
    } catch (LWJGLException e) {
        nReleaseDC(hwnd, hdc);
        nDestroyWindow(hwnd);
        throw e;
    }
}
项目:Wolf_game    文件:LinuxDisplay.java   
public void createWindow(final DrawableLWJGL drawable, DisplayMode mode, Canvas parent, int x, int y) throws LWJGLException {
    lockAWT();
    try {
        incDisplay();
        try {
            if ( drawable instanceof DrawableGLES )
                peer_info = new LinuxDisplayPeerInfo();

            ByteBuffer handle = peer_info.lockAndGetHandle();
            try {
                current_window_mode = getWindowMode(Display.isFullscreen());

                // Try to enable Lecagy FullScreen Support in Compiz, else
                // we may have trouble with stuff overlapping our fullscreen window.
                if ( current_window_mode != WINDOWED )
                    Compiz.setLegacyFullscreenSupport(true);

                // Setting _MOTIF_WM_HINTS in fullscreen mode is problematic for certain window
                // managers. We do not set MWM_HINTS_DECORATIONS in fullscreen mode anymore,
                // unless org.lwjgl.opengl.Window.undecorated_fs has been specified.
                // See native/linux/org_lwjgl_opengl_Display.c, createWindow function.
                boolean undecorated = Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated") || (current_window_mode != WINDOWED && Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated_fs"));

                this.parent = parent;
                parent_window = parent != null ? getHandle(parent) : getRootWindow(getDisplay(), getDefaultScreen());
                resizable = Display.isResizable();
                resized = false;
                window_x = x;
                window_y = y;
                window_width = mode.getWidth();
                window_height = mode.getHeight();

                current_window = nCreateWindow(getDisplay(), getDefaultScreen(), handle, mode, current_window_mode, x, y, undecorated, parent_window, resizable);

                // Set the WM_CLASS hint which is needed by some WM's e.g. Gnome Shell
                wm_class = Display.getPrivilegedString("LWJGL_WM_CLASS");
                if (wm_class == null) wm_class = Display.getTitle();
                setClassHint(Display.getTitle(), wm_class);

                mapRaised(getDisplay(), current_window);
                xembedded = parent != null && isAncestorXEmbedded(parent_window);
                blank_cursor = createBlankCursor();
                current_cursor = None;
                focused = false;
                input_released = false;
                pointer_grabbed = false;
                keyboard_grabbed = false;
                close_requested = false;
                grab = false;
                minimized = false;
                dirty = true;

                if ( drawable instanceof DrawableGLES )
                    ((DrawableGLES)drawable).initialize(current_window, getDisplay(), EGL.EGL_WINDOW_BIT, (org.lwjgl.opengles.PixelFormat)drawable.getPixelFormat());

                if (parent != null) {
                    parent.addFocusListener(focus_listener);
                    parent_focused = parent.isFocusOwner();
                    parent_focus_changed = true;
                }
            } finally {
                peer_info.unlock();
            }
        } catch (LWJGLException e) {
            decDisplay();
            throw e;
        }
    } finally {
        unlockAWT();
    }
}
项目:GPVM    文件:LinuxDisplay.java   
public void createWindow(final DrawableLWJGL drawable, DisplayMode mode, Canvas parent, int x, int y) throws LWJGLException {
    lockAWT();
    try {
        incDisplay();
        try {
            if ( drawable instanceof DrawableGLES )
                peer_info = new LinuxDisplayPeerInfo();

            ByteBuffer handle = peer_info.lockAndGetHandle();
            try {
                current_window_mode = getWindowMode(Display.isFullscreen());

                // Try to enable Lecagy FullScreen Support in Compiz, else
                // we may have trouble with stuff overlapping our fullscreen window.
                if ( current_window_mode != WINDOWED )
                    Compiz.setLegacyFullscreenSupport(true);

                // Setting _MOTIF_WM_HINTS in fullscreen mode is problematic for certain window
                // managers. We do not set MWM_HINTS_DECORATIONS in fullscreen mode anymore,
                // unless org.lwjgl.opengl.Window.undecorated_fs has been specified.
                // See native/linux/org_lwjgl_opengl_Display.c, createWindow function.
                boolean undecorated = Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated") || (current_window_mode != WINDOWED && Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated_fs"));

                this.parent = parent;
                parent_window = parent != null ? getHandle(parent) : getRootWindow(getDisplay(), getDefaultScreen());
                resizable = Display.isResizable();
                resized = false;
                window_x = x;
                window_y = y;
                window_width = mode.getWidth();
                window_height = mode.getHeight();

                current_window = nCreateWindow(getDisplay(), getDefaultScreen(), handle, mode, current_window_mode, x, y, undecorated, parent_window, resizable);

                // Set the WM_CLASS hint which is needed by some WM's e.g. Gnome Shell
                wm_class = Display.getPrivilegedString("LWJGL_WM_CLASS");
                if (wm_class == null) wm_class = Display.getTitle();
                setClassHint(Display.getTitle(), wm_class);

                mapRaised(getDisplay(), current_window);
                xembedded = parent != null && isAncestorXEmbedded(parent_window);
                blank_cursor = createBlankCursor();
                current_cursor = None;
                focused = false;
                input_released = false;
                pointer_grabbed = false;
                keyboard_grabbed = false;
                close_requested = false;
                grab = false;
                minimized = false;
                dirty = true;

                if ( drawable instanceof DrawableGLES )
                    ((DrawableGLES)drawable).initialize(current_window, getDisplay(), EGL.EGL_WINDOW_BIT, (org.lwjgl.opengles.PixelFormat)drawable.getPixelFormat());

                if (parent != null) {
                    parent.addFocusListener(focus_listener);
                    parent_focused = parent.isFocusOwner();
                    parent_focus_changed = true;
                }
            } finally {
                peer_info.unlock();
            }
        } catch (LWJGLException e) {
            decDisplay();
            throw e;
        }
    } finally {
        unlockAWT();
    }
}
项目:GPVM    文件:LinuxDisplay.java   
public void createWindow(final DrawableLWJGL drawable, DisplayMode mode, Canvas parent, int x, int y) throws LWJGLException {
    lockAWT();
    try {
        incDisplay();
        try {
            if ( drawable instanceof DrawableGLES )
                peer_info = new LinuxDisplayPeerInfo();

            ByteBuffer handle = peer_info.lockAndGetHandle();
            try {
                current_window_mode = getWindowMode(Display.isFullscreen());

                // Try to enable Lecagy FullScreen Support in Compiz, else
                // we may have trouble with stuff overlapping our fullscreen window.
                if ( current_window_mode != WINDOWED )
                    Compiz.setLegacyFullscreenSupport(true);

                // Setting _MOTIF_WM_HINTS in fullscreen mode is problematic for certain window
                // managers. We do not set MWM_HINTS_DECORATIONS in fullscreen mode anymore,
                // unless org.lwjgl.opengl.Window.undecorated_fs has been specified.
                // See native/linux/org_lwjgl_opengl_Display.c, createWindow function.
                boolean undecorated = Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated") || (current_window_mode != WINDOWED && Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated_fs"));

                this.parent = parent;
                parent_window = parent != null ? getHandle(parent) : getRootWindow(getDisplay(), getDefaultScreen());
                resizable = Display.isResizable();
                resized = false;
                window_x = x;
                window_y = y;
                window_width = mode.getWidth();
                window_height = mode.getHeight();

                current_window = nCreateWindow(getDisplay(), getDefaultScreen(), handle, mode, current_window_mode, x, y, undecorated, parent_window, resizable);

                // Set the WM_CLASS hint which is needed by some WM's e.g. Gnome Shell
                wm_class = Display.getPrivilegedString("LWJGL_WM_CLASS");
                if (wm_class == null) wm_class = Display.getTitle();
                setClassHint(Display.getTitle(), wm_class);

                mapRaised(getDisplay(), current_window);
                xembedded = parent != null && isAncestorXEmbedded(parent_window);
                blank_cursor = createBlankCursor();
                current_cursor = None;
                focused = false;
                input_released = false;
                pointer_grabbed = false;
                keyboard_grabbed = false;
                close_requested = false;
                grab = false;
                minimized = false;
                dirty = true;

                if ( drawable instanceof DrawableGLES )
                    ((DrawableGLES)drawable).initialize(current_window, getDisplay(), EGL.EGL_WINDOW_BIT, (org.lwjgl.opengles.PixelFormat)drawable.getPixelFormat());

                if (parent != null) {
                    parent.addFocusListener(focus_listener);
                    parent_focused = parent.isFocusOwner();
                    parent_focus_changed = true;
                }
            } finally {
                peer_info.unlock();
            }
        } catch (LWJGLException e) {
            decDisplay();
            throw e;
        }
    } finally {
        unlockAWT();
    }
}
项目:SpaceStationAlpha    文件:LinuxDisplay.java   
public void createWindow(final DrawableLWJGL drawable, DisplayMode mode, Canvas parent, int x, int y) throws LWJGLException {
    lockAWT();
    try {
        incDisplay();
        try {
            if ( drawable instanceof DrawableGLES )
                peer_info = new LinuxDisplayPeerInfo();

            ByteBuffer handle = peer_info.lockAndGetHandle();
            try {
                current_window_mode = getWindowMode(Display.isFullscreen());

                // Try to enable Lecagy FullScreen Support in Compiz, else
                // we may have trouble with stuff overlapping our fullscreen window.
                if ( current_window_mode != WINDOWED )
                    Compiz.setLegacyFullscreenSupport(true);

                // Setting _MOTIF_WM_HINTS in fullscreen mode is problematic for certain window
                // managers. We do not set MWM_HINTS_DECORATIONS in fullscreen mode anymore,
                // unless org.lwjgl.opengl.Window.undecorated_fs has been specified.
                // See native/linux/org_lwjgl_opengl_Display.c, createWindow function.
                boolean undecorated = Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated") || (current_window_mode != WINDOWED && Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated_fs"));

                this.parent = parent;
                parent_window = parent != null ? getHandle(parent) : getRootWindow(getDisplay(), getDefaultScreen());
                resizable = Display.isResizable();
                resized = false;
                window_x = x;
                window_y = y;
                window_width = mode.getWidth();
                window_height = mode.getHeight();

                current_window = nCreateWindow(getDisplay(), getDefaultScreen(), handle, mode, current_window_mode, x, y, undecorated, parent_window, resizable);

                // Set the WM_CLASS hint which is needed by some WM's e.g. Gnome Shell
                wm_class = Display.getPrivilegedString("LWJGL_WM_CLASS");
                if (wm_class == null) wm_class = Display.getTitle();
                setClassHint(Display.getTitle(), wm_class);

                mapRaised(getDisplay(), current_window);
                xembedded = parent != null && isAncestorXEmbedded(parent_window);
                blank_cursor = createBlankCursor();
                current_cursor = None;
                focused = false;
                input_released = false;
                pointer_grabbed = false;
                keyboard_grabbed = false;
                close_requested = false;
                grab = false;
                minimized = false;
                dirty = true;

                if ( drawable instanceof DrawableGLES )
                    ((DrawableGLES)drawable).initialize(current_window, getDisplay(), EGL.EGL_WINDOW_BIT, (org.lwjgl.opengles.PixelFormat)drawable.getPixelFormat());

                if (parent != null) {
                    parent.addFocusListener(focus_listener);
                    parent_focused = parent.isFocusOwner();
                    parent_focus_changed = true;
                }
            } finally {
                peer_info.unlock();
            }
        } catch (LWJGLException e) {
            decDisplay();
            throw e;
        }
    } finally {
        unlockAWT();
    }
}
项目:TeacherSmash    文件:LinuxDisplay.java   
public void createWindow(final DrawableLWJGL drawable, DisplayMode mode, Canvas parent, int x, int y) throws LWJGLException {
    lockAWT();
    try {
        incDisplay();
        try {
            if ( drawable instanceof DrawableGLES )
                peer_info = new LinuxDisplayPeerInfo();

            ByteBuffer handle = peer_info.lockAndGetHandle();
            try {
                current_window_mode = getWindowMode(Display.isFullscreen());

                // Try to enable Lecagy FullScreen Support in Compiz, else
                // we may have trouble with stuff overlapping our fullscreen window.
                if ( current_window_mode != WINDOWED )
                    Compiz.setLegacyFullscreenSupport(true);

                // Setting _MOTIF_WM_HINTS in fullscreen mode is problematic for certain window
                // managers. We do not set MWM_HINTS_DECORATIONS in fullscreen mode anymore,
                // unless org.lwjgl.opengl.Window.undecorated_fs has been specified.
                // See native/linux/org_lwjgl_opengl_Display.c, createWindow function.
                boolean undecorated = Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated") || (current_window_mode != WINDOWED && Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated_fs"));

                this.parent = parent;
                parent_window = parent != null ? getHandle(parent) : getRootWindow(getDisplay(), getDefaultScreen());
                resizable = Display.isResizable();
                resized = false;
                window_x = x;
                window_y = y;
                window_width = mode.getWidth();
                window_height = mode.getHeight();

                current_window = nCreateWindow(getDisplay(), getDefaultScreen(), handle, mode, current_window_mode, x, y, undecorated, parent_window, resizable);

                // Set the WM_CLASS hint which is needed by some WM's e.g. Gnome Shell
                wm_class = Display.getPrivilegedString("LWJGL_WM_CLASS");
                if (wm_class == null) wm_class = Display.getTitle();
                setClassHint(Display.getTitle(), wm_class);

                mapRaised(getDisplay(), current_window);
                xembedded = parent != null && isAncestorXEmbedded(parent_window);
                blank_cursor = createBlankCursor();
                current_cursor = None;
                focused = false;
                input_released = false;
                pointer_grabbed = false;
                keyboard_grabbed = false;
                close_requested = false;
                grab = false;
                minimized = false;
                dirty = true;

                if ( drawable instanceof DrawableGLES )
                    ((DrawableGLES)drawable).initialize(current_window, getDisplay(), EGL.EGL_WINDOW_BIT, (org.lwjgl.opengles.PixelFormat)drawable.getPixelFormat());

                if (parent != null) {
                    parent.addFocusListener(focus_listener);
                    parent_focused = parent.isFocusOwner();
                    parent_focus_changed = true;
                }
            } finally {
                peer_info.unlock();
            }
        } catch (LWJGLException e) {
            decDisplay();
            throw e;
        }
    } finally {
        unlockAWT();
    }
}
项目:3d-Demo    文件:LinuxDisplay.java   
public void createWindow(final DrawableLWJGL drawable, DisplayMode mode, Canvas parent, int x, int y) throws LWJGLException {
    lockAWT();
    try {
        incDisplay();
        try {
            if ( drawable instanceof DrawableGLES )
                peer_info = new LinuxDisplayPeerInfo();

            ByteBuffer handle = peer_info.lockAndGetHandle();
            try {
                current_window_mode = getWindowMode(Display.isFullscreen());
                // Try to enable Lecagy FullScreen Support in Compiz, else
                // we may have trouble with stuff overlapping our fullscreen window.
                if ( current_window_mode != WINDOWED )
                    Compiz.setLegacyFullscreenSupport(true);
                // Setting _MOTIF_WM_HINTS in fullscreen mode is problematic for certain window
                // managers. We do not set MWM_HINTS_DECORATIONS in fullscreen mode anymore,
                // unless org.lwjgl.opengl.Window.undecorated_fs has been specified.
                // See native/linux/org_lwjgl_opengl_Display.c, createWindow function.
                boolean undecorated = Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated") || (current_window_mode != WINDOWED && Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated_fs"));
                this.parent = parent;
                parent_window = parent != null ? getHandle(parent) : getRootWindow(getDisplay(), getDefaultScreen());
                resizable = Display.isResizable();
                resized = false;
                window_x = x;
                window_y = y;
                window_width = mode.getWidth();
                window_height = mode.getHeight();
                current_window = nCreateWindow(getDisplay(), getDefaultScreen(), handle, mode, current_window_mode, x, y, undecorated, parent_window, resizable);
                mapRaised(getDisplay(), current_window);
                xembedded = parent != null && isAncestorXEmbedded(parent_window);
                blank_cursor = createBlankCursor();
                current_cursor = None;
                focused = false;
                input_released = false;
                pointer_grabbed = false;
                keyboard_grabbed = false;
                close_requested = false;
                grab = false;
                minimized = false;
                dirty = true;

                if ( drawable instanceof DrawableGLES )
                    ((DrawableGLES)drawable).initialize(current_window, getDisplay(), EGL.EGL_WINDOW_BIT, (org.lwjgl.opengles.PixelFormat)drawable.getPixelFormat());

                if (parent != null) {
                    parent.addFocusListener(focus_listener);
                    parent_focused = parent.isFocusOwner();
                    parent_focus_changed = true;
                }
            } finally {
                peer_info.unlock();
            }
        } catch (LWJGLException e) {
            decDisplay();
            throw e;
        }
    } finally {
        unlockAWT();
    }
}
项目:3d-Demo    文件:WindowsDisplay.java   
public void createWindow(DrawableLWJGL drawable, DisplayMode mode, Canvas parent, int x, int y) throws LWJGLException {
    close_requested = false;
    is_dirty = false;
    isMinimized = false;
    isFocused = false;
    redoMakeContextCurrent = false;
    maximized = false;
    this.parent = parent;
    hasParent = parent != null;
    long parent_hwnd = parent != null ? getHwnd(parent) : 0;
    this.hwnd = nCreateWindow(x, y, mode.getWidth(), mode.getHeight(), Display.isFullscreen() || isUndecorated(), parent != null, parent_hwnd);
    this.resizable=false;
    if (hwnd == 0) {
        throw new LWJGLException("Failed to create window");
    }
    this.hdc = getDC(hwnd);
    if (hdc == 0) {
        nDestroyWindow(hwnd);
        throw new LWJGLException("Failed to get dc");
    }

    try {
        if ( drawable instanceof DrawableGL ) {
            int format = WindowsPeerInfo.choosePixelFormat(getHdc(), 0, 0, (PixelFormat)drawable.getPixelFormat(), null, true, true, false, true);
            WindowsPeerInfo.setPixelFormat(getHdc(), format);
        } else {
            peer_info = new WindowsDisplayPeerInfo(true);
            ((DrawableGLES)drawable).initialize(hwnd, hdc, EGL.EGL_WINDOW_BIT, (org.lwjgl.opengles.PixelFormat)drawable.getPixelFormat());
        }
        peer_info.initDC(getHwnd(), getHdc());
        showWindow(getHwnd(), SW_SHOWDEFAULT);

        updateWidthAndHeight();

        if ( parent == null ) {
            if(Display.isResizable()) {
                setResizable(true);
            }
            setForegroundWindow(getHwnd());
        }
        grabFocus();
    } catch (LWJGLException e) {
        nReleaseDC(hwnd, hdc);
        nDestroyWindow(hwnd);
        throw e;
    }
}