any one is using two screens?

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

any one is using two screens?

cznlzq
JOGL 2.1.2 + Java 7u51 in Windows 7.

Very simple code.

//======================================================================
package jogl.test;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.media.opengl.GL;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLEventListener;
import javax.media.opengl.GLProfile;
import javax.media.opengl.awt.GLCanvas;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;

import com.jogamp.opengl.util.FPSAnimator;

public class testSimpleSceneJOGL implements GLEventListener {

    private double theta = 0;
    private double s = 1;
    private double c = 1;

    public static void main(String[] args) {

        final GLProfile glp = GLProfile.getDefault();
       
        final JFrame frame = new JFrame("AWT Window Test");
        frame.setSize(300, 300);
        JMenu file = new JMenu("File");
        file.setMnemonic('F');
        JMenuItem newItem = new JMenuItem("New");
        newItem.setMnemonic('N');
        file.add(newItem);
       
        //adding action listener to menu items
        newItem.addActionListener(
            new ActionListener(){
                @Override
                public void actionPerformed(ActionEvent e)
                {
                    System.out.println("New is pressed");
                   
                    final GLCapabilities caps = new GLCapabilities(glp);
                    final GLCanvas canvas = new GLCanvas(caps);
                   
                    frame.add(canvas);
                   
                    canvas.addGLEventListener(new testSimpleSceneJOGL());

                    FPSAnimator animator = new FPSAnimator(canvas, 60);
                    animator.start();
                   
                    frame.revalidate();
                    frame.repaint();
                                       
                }
            });
       

        frame.addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });
       
        JMenuBar bar = new JMenuBar();
        frame.setJMenuBar(bar);
        bar.add(file);
       
        frame.setLocation(2048, 100);        
        frame.setVisible(true);
    }

    @Override
    public void display(GLAutoDrawable drawable) {
        update();
        render(drawable);
    }

    @Override
    public void dispose(GLAutoDrawable drawable) {
    }

    @Override
    public void init(GLAutoDrawable drawable) {
    }

    @Override
    public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) {
    }

    private void update() {
        theta += 0.01;
        s = Math.sin(theta);
        c = Math.cos(theta);
    }

    private void render(GLAutoDrawable drawable) {
        GL2 gl = drawable.getGL().getGL2();

        gl.glClear(GL.GL_COLOR_BUFFER_BIT);

        // draw a triangle filling the window
        gl.glBegin(GL.GL_TRIANGLES);
        gl.glColor3f(1, 0, 0);
        gl.glVertex2d(-c, -c);
        gl.glColor3f(0, 1, 0);
        gl.glVertex2d(0, c);
        gl.glColor3f(0, 0, 1);
        gl.glVertex2d(s, -s);
        gl.glEnd();
    }
}

//=============================================================================

I'm using two screens.
In the code, I use frame.setLocation(2048, 100); to make the frame show up in my second screen.
And it gives me an error.
The frame.setLocation(100,100) to make the frame show up in my first screen works perfectly though.

Any one is using two screens and could you please give me some advices?

Thanks.

And here is the output message:

FPSAnimator P1:Thread[AWT-EventQueue-0-FPSAWTAnimator-Timer0,6,main]: Task[thread Thread[AWT-EventQueue-0-FPSAWTAnimator-Timer0,6,main], stopped false, paused false shouldRun true, shouldStop false -- started true, animating true, paused false, drawable 1, drawablesEmpty false]
Exception in thread "AWT-EventQueue-0-FPSAWTAnimator-Timer0" java.lang.RuntimeException: javax.media.opengl.GLException: Error making context 0x20000 current on Thread AWT-EventQueue-0, drawableWrite 0x7f0131bf, drawableRead 0x7f0131bf, werr: 0, WindowsWGLContext [Version 4.2 (Compat profile, arb, ES2 compat, FBO, hardware) - 4.2.11631 Compatibility Profile Context [GL 4.2.0, vendor 0.0.0 (n/a)], options 0x1403, this 0x11ffed1, handle 0x20000, isShared false, jogamp.opengl.gl4.GL4bcImpl@5a7b7,
         quirks: [NoDoubleBufferedBitmap, NeedCurrCtx4ARBCreateContext],
        Drawable: WindowsOnscreenWGLDrawable[Realized true,
        Factory   jogamp.opengl.windows.wgl.WindowsWGLDrawableFactory@145f6fb,
        Handle    0x7f0131bf,
        Surface   JAWT-Window[JAWT version: 0x10004, CA_LAYER: false, isLayeredSurface false, bounds [ 0 / 0  284 x 237 ], insets [ l 0, r 0 - t 0, b 0 - 0x0], shallUseOffscreenLayer false, isOffscreenLayerSurface false, attachedSurfaceLayer 0x0, windowHandle 0x230ec0, surfaceHandle 0x7f0131bf, bounds [ 0 / 0  284 x 237 ], insets [ l 0, r 0 - t 0, b 0 - 0x0], pos 0/0, size 284x237, visible true, lockedExt false,
        config AWTGraphicsConfiguration[AWTGraphicsScreen[AWTGraphicsDevice[type .awt, connection \Display0, unitID 0, awtDevice D3DGraphicsDevice[screen=0], handle 0x0], idx 0],
        chosen    GLCaps[wgl vid 0x2 arb: rgba 8/8/8/8, opaque, accum-rgba 0/0/0/0, dp/st/ms 24/8/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]],
        requested GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]],
        sun.awt.Win32GraphicsConfig@165c64[dev=D3DGraphicsDevice[screen=0],pixfmt=2],
        encapsulated WindowsWGLGraphicsConfiguration[DefaultGraphicsScreen[WindowsGraphicsDevice[type .windows, connection decon, unitID 0, handle 0x0, owner false, NullToolkitLock[]], idx 0], pfdID 2, ARB-Choosen true,
        requested GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]],
        chosen    GLCaps[wgl vid 0x2 arb: rgba 8/8/8/8, opaque, accum-rgba 0/0/0/0, dp/st/ms 24/8/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]]]],
        awtComponent AWT-GLCanvas[Realized true,
        jogamp.opengl.windows.wgl.WindowsOnscreenWGLDrawable,
        Factory   jogamp.opengl.windows.wgl.WindowsWGLDrawableFactory@145f6fb,
        handle    0x7f0131bf,
        Drawable size 284x237,
        AWT pos 0/0, size 284x237,
        visible true, displayable true,
        AWTGraphicsConfiguration[AWTGraphicsScreen[AWTGraphicsDevice[type .awt, connection \Display0, unitID 0, awtDevice D3DGraphicsDevice[screen=0], handle 0x0], idx 0],
        chosen    GLCaps[wgl vid 0x2 arb: rgba 8/8/8/8, opaque, accum-rgba 0/0/0/0, dp/st/ms 24/8/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]],
        requested GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]],
        sun.awt.Win32GraphicsConfig@165c64[dev=D3DGraphicsDevice[screen=0],pixfmt=2],
        encapsulated WindowsWGLGraphicsConfiguration[DefaultGraphicsScreen[WindowsGraphicsDevice[type .windows, connection decon, unitID 0, handle 0x0, owner false, NullToolkitLock[]], idx 0], pfdID 2, ARB-Choosen true,
        requested GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]],
        chosen    GLCaps[wgl vid 0x2 arb: rgba 8/8/8/8, opaque, accum-rgba 0/0/0/0, dp/st/ms 24/8/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]]]]],
        surfaceLock <5a14e3, 116623>[count 1, qsz 0, owner <AWT-EventQueue-0>]]]]
        at com.jogamp.common.util.awt.AWTEDTExecutor.invoke(AWTEDTExecutor.java:58)
        at jogamp.opengl.awt.AWTThreadingPlugin.invokeOnOpenGLThread(AWTThreadingPlugin.java:103)
        at jogamp.opengl.ThreadingImpl.invokeOnOpenGLThread(ThreadingImpl.java:206)
        at javax.media.opengl.Threading.invokeOnOpenGLThread(Threading.java:172)
        at javax.media.opengl.Threading.invoke(Threading.java:191)
        at javax.media.opengl.awt.GLCanvas.display(GLCanvas.java:528)
        at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:75)
        at com.jogamp.opengl.util.AnimatorBase.display(AnimatorBase.java:443)
        at com.jogamp.opengl.util.FPSAnimator$MainTask.run(FPSAnimator.java:170)
        at java.util.TimerThread.mainLoop(Unknown Source)
        at java.util.TimerThread.run(Unknown Source)
Caused by: javax.media.opengl.GLException: Error making context 0x20000 current on Thread AWT-EventQueue-0, drawableWrite 0x7f0131bf, drawableRead 0x7f0131bf, werr: 0, WindowsWGLContext [Version 4.2 (Compat profile, arb, ES2 compat, FBO, hardware) - 4.2.11631 Compatibility Profile Context [GL 4.2.0, vendor 0.0.0 (n/a)], options 0x1403, this 0x11ffed1, handle 0x20000, isShared false, jogamp.opengl.gl4.GL4bcImpl@5a7b7,
         quirks: [NoDoubleBufferedBitmap, NeedCurrCtx4ARBCreateContext],
        Drawable: WindowsOnscreenWGLDrawable[Realized true,
        Factory   jogamp.opengl.windows.wgl.WindowsWGLDrawableFactory@145f6fb,
        Handle    0x7f0131bf,
        Surface   JAWT-Window[JAWT version: 0x10004, CA_LAYER: false, isLayeredSurface false, bounds [ 0 / 0  284 x 237 ], insets [ l 0, r 0 - t 0, b 0 - 0x0], shallUseOffscreenLayer false, isOffscreenLayerSurface false, attachedSurfaceLayer 0x0, windowHandle 0x230ec0, surfaceHandle 0x7f0131bf, bounds [ 0 / 0  284 x 237 ], insets [ l 0, r 0 - t 0, b 0 - 0x0], pos 0/0, size 284x237, visible true, lockedExt false,
        config AWTGraphicsConfiguration[AWTGraphicsScreen[AWTGraphicsDevice[type .awt, connection \Display0, unitID 0, awtDevice D3DGraphicsDevice[screen=0], handle 0x0], idx 0],
        chosen    GLCaps[wgl vid 0x2 arb: rgba 8/8/8/8, opaque, accum-rgba 0/0/0/0, dp/st/ms 24/8/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]],
        requested GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]],
        sun.awt.Win32GraphicsConfig@165c64[dev=D3DGraphicsDevice[screen=0],pixfmt=2],
        encapsulated WindowsWGLGraphicsConfiguration[DefaultGraphicsScreen[WindowsGraphicsDevice[type .windows, connection decon, unitID 0, handle 0x0, owner false, NullToolkitLock[]], idx 0], pfdID 2, ARB-Choosen true,
        requested GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]],
        chosen    GLCaps[wgl vid 0x2 arb: rgba 8/8/8/8, opaque, accum-rgba 0/0/0/0, dp/st/ms 24/8/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]]]],
        awtComponent AWT-GLCanvas[Realized true,
        jogamp.opengl.windows.wgl.WindowsOnscreenWGLDrawable,
        Factory   jogamp.opengl.windows.wgl.WindowsWGLDrawableFactory@145f6fb,
        handle    0x7f0131bf,
        Drawable size 284x237,
        AWT pos 0/0, size 284x237,
        visible true, displayable true,
        AWTGraphicsConfiguration[AWTGraphicsScreen[AWTGraphicsDevice[type .awt, connection \Display0, unitID 0, awtDevice D3DGraphicsDevice[screen=0], handle 0x0], idx 0],
        chosen    GLCaps[wgl vid 0x2 arb: rgba 8/8/8/8, opaque, accum-rgba 0/0/0/0, dp/st/ms 24/8/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]],
        requested GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]],
        sun.awt.Win32GraphicsConfig@165c64[dev=D3DGraphicsDevice[screen=0],pixfmt=2],
        encapsulated WindowsWGLGraphicsConfiguration[DefaultGraphicsScreen[WindowsGraphicsDevice[type .windows, connection decon, unitID 0, handle 0x0, owner false, NullToolkitLock[]], idx 0], pfdID 2, ARB-Choosen true,
        requested GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]],
        chosen    GLCaps[wgl vid 0x2 arb: rgba 8/8/8/8, opaque, accum-rgba 0/0/0/0, dp/st/ms 24/8/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]]]]],
        surfaceLock <5a14e3, 116623>[count 1, qsz 0, owner <AWT-EventQueue-0>]]]]
        at jogamp.opengl.windows.wgl.WindowsWGLContext.makeCurrentImpl(WindowsWGLContext.java:410)
        at jogamp.opengl.GLContextImpl.makeCurrentWithinLock(GLContextImpl.java:718)
        at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:562)
        at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:519)
        at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1089)
        at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:978)
        at javax.media.opengl.awt.GLCanvas$10.run(GLCanvas.java:1282)
        at java.awt.event.InvocationEvent.dispatch(Unknown Source)
        at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
        at java.awt.EventQueue.access$200(Unknown Source)
        at java.awt.EventQueue$3.run(Unknown Source)
        at java.awt.EventQueue$3.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)
Reply | Threaded
Open this post in threaded view
|

Re: any one is using two screens?

gouessej
Administrator
Hi

At first, use the latest version of JOGL (currently 2.1.5-01). Secondly, you still use AWT, it's not a problem of JOGL. I sometimes use several screens with NEWT and it works very well. I can choose the primary monitor or use a "virtual" monitor representing 2 physical monitors.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: any one is using two screens?

cznlzq
Hi gouessej,

JOGL is updated so fast, I didn't notice that it's already 2.1.5.

Anyway, following your instructions,
I downloaded the 2.1.5 from http://jogamp.org/deployment/v2.1.5/archive/
and I found some online NEWT codes in which I setPosition to my second monitor.

Codes:

JOGL2NewtDemo.java

//===============================================================
package jogl.test;

import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLProfile;

import com.jogamp.newt.event.WindowListener;
import com.jogamp.newt.event.WindowUpdateEvent;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.util.FPSAnimator;

public class JOGL2NewtDemo
{
    private static String TITLE = "JOGL 2 with NEWT";  // window's title
    private static final int WINDOW_WIDTH = 640;  // width of the drawable
    private static final int WINDOW_HEIGHT = 480; // height of the drawable
    private static final int FPS = 60; // animator's target frames per second

    static {
        GLProfile.initSingleton();  // The method allows JOGL to prepare some Linux-specific locking optimizations
    }

    /**
     * The entry main() method.
     */
    public static void main(String[] args) {
        // Get the default OpenGL profile, reflecting the best for your running platform
        GLProfile glp = GLProfile.getDefault();
        // Specifies a set of OpenGL capabilities, based on your profile.
        GLCapabilities caps = new GLCapabilities(glp);
        // Create the OpenGL rendering canvas
        GLWindow window = GLWindow.create(caps);

        // Create a animator that drives canvas' display() at the specified FPS.
        final FPSAnimator animator = new FPSAnimator(window, FPS, true);

        window.addWindowListener(new WindowListener()
        {

            @Override
            public void windowDestroyNotify(
                com.jogamp.newt.event.WindowEvent arg0)
            {
                // Use a dedicate thread to run the stop() to ensure that the
                // animator stops before program exits.
                new Thread() {
                    @Override
                    public void run() {
                        if (animator.isStarted())
                            animator.stop();    // stop the animator loop
                        System.exit(0);
                    }
                }.start();
            }

            @Override
            public void windowDestroyed(com.jogamp.newt.event.WindowEvent arg0)
            {
                // TODO Auto-generated method stub
               
            }

            @Override
            public void windowGainedFocus(com.jogamp.newt.event.WindowEvent arg0)
            {
                // TODO Auto-generated method stub
               
            }

            @Override
            public void windowLostFocus(com.jogamp.newt.event.WindowEvent arg0)
            {
                // TODO Auto-generated method stub
               
            }

            @Override
            public void windowMoved(com.jogamp.newt.event.WindowEvent arg0)
            {
                // TODO Auto-generated method stub
               
            }

            @Override
            public void windowRepaint(WindowUpdateEvent arg0)
            {
                // TODO Auto-generated method stub
               
            }

            @Override
            public void windowResized(com.jogamp.newt.event.WindowEvent arg0)
            {
                // TODO Auto-generated method stub
               
            }
           
        });

        window.addGLEventListener(new JOGL2Renderer());
        window.setPosition(2048, 100);
        window.setSize(WINDOW_WIDTH, WINDOW_HEIGHT);
        window.setTitle(TITLE);
        window.setVisible(true);
        animator.start();  // start the animator loop
    }
}
//===============================================================


JOGL2Renderer.java

//===============================================================
package jogl.test;

import javax.media.opengl.GL;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLEventListener;

public class JOGL2Renderer implements GLEventListener {
    private double theta = 0.0f;  // rotational angle

    /**
     * Called back by the drawable to render OpenGL graphics
     */
    @Override
    public void display(GLAutoDrawable drawable) {
        GL2 gl = drawable.getGL().getGL2();   // get the OpenGL graphics context

        gl.glClear(GL.GL_COLOR_BUFFER_BIT);    // clear background
        gl.glLoadIdentity();                   // reset the model-view matrix    

          // Rendering code - draw a triangle
        float sine = (float)Math.sin(theta);
        float cosine = (float)Math.cos(theta);
        gl.glBegin(GL.GL_TRIANGLES);
        gl.glColor3f(1, 0, 0);
        gl.glVertex2d(-cosine, -cosine);
        gl.glColor3f(0, 1, 0);
        gl.glVertex2d(0, cosine);
        gl.glColor3f(0, 0, 1);
        gl.glVertex2d(sine, -sine);
        gl.glEnd();

        update();
    }

    /**
     * Update the rotation angle after each frame refresh
     */
    private void update() {
        theta += 0.01;
    }

    @Override
    public void dispose(GLAutoDrawable arg0)
    {
        // TODO Auto-generated method stub
       
    }

    @Override
    public void init(GLAutoDrawable arg0)
    {
        // TODO Auto-generated method stub
       
    }

    @Override
    public void reshape(
        GLAutoDrawable arg0, int arg1, int arg2, int arg3, int arg4)
    {
        // TODO Auto-generated method stub
       
    }

    /*... Other methods leave blank ...*/
}
//=====================================================================

result:

When I window.setPosition(100, 100) to first monitor, everything works perfectly.
However, when I window.setPosition(2048, 100) to second monitor, error message:

FPSAnimator P1:Thread[main-FPSAWTAnimator-Timer0,5,main]: Task[thread Thread[main-FPSAWTAnimator-Timer0,5,main], stopped false, paused false shouldRun true, shouldStop false -- started true, animating true, paused false, drawable 1, drawablesEmpty false]
Exception in thread "main-FPSAWTAnimator-Timer0" javax.media.opengl.GLException: Error making context 0x20000 current on Thread main-FPSAWTAnimator-Timer0, drawableWrite 0xffffffffe8011842, drawableRead 0xffffffffe8011842, werr: 0, WindowsWGLContext [Version 4.2 (Compat profile, arb, ES2 compat, FBO, hardware) - 4.2.11631 Compatibility Profile Context [GL 4.2.0, vendor 0.0.0 (n/a)], options 0x1403, this 0x3bf486, handle 0x20000, isShared false, jogamp.opengl.gl4.GL4bcImpl@afd218,
         quirks: [NoDoubleBufferedBitmap, NeedCurrCtx4ARBCreateContext],
        Drawable: WindowsOnscreenWGLDrawable[Realized true,
        Factory   jogamp.opengl.windows.wgl.WindowsWGLDrawableFactory@10a280f,
        Handle    0xffffffffe8011842,
        Surface   jogamp.newt.driver.windows.WindowDriver[Config WindowsWGLGraphicsConfiguration[DefaultGraphicsScreen[WindowsGraphicsDevice[type .windows, connection decon, unitID 0, handle 0x0, owner false, NullToolkitLock[]], idx 0], pfdID 2, ARB-Choosen true,
        requested GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]],
        chosen    GLCaps[wgl vid 0x2 arb: rgba 8/8/8/8, opaque, accum-rgba 0/0/0/0, dp/st/ms 24/8/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]]]
, NEWT-Screen[.windows_nil-1-s0, idx 0, refCount 1, vsize [ 0 / 0  3200 x 1080 ], DefaultGraphicsScreen[WindowsGraphicsDevice[type .windows, connection decon, unitID 0, handle 0x0, owner false, NullToolkitLock[]], idx 0], NEWT-Display[.windows_nil-1, excl false, refCount 1, hasEDT true, edtRunning true, WindowsGraphicsDevice[type .windows, connection decon, unitID 0, handle 0x0, owner false, NullToolkitLock[]]], monitors: [Monitor[Id 0x0, 677 x 381 mm, viewport [ 0 / 0  1920 x 1080 ], orig [Id 0x0, [ 1920 x 1080 x 32 bpp ] @ 60.0 Hz, flags [], 0 degr], curr [Id 0x0, [ 1920 x 1080 x 32 bpp ] @ 60.0 Hz, flags [], 0 degr], modeChanged false, modeCount 368], Monitor[Id 0x1, 452 x 361 mm, viewport [ 1920 / 0  1280 x 1024 ], orig [Id 0x0, [ 1280 x 1024 x 32 bpp ] @ 60.0 Hz, flags [], 0 degr], curr [Id 0x0, [ 1280 x 1024 x 32 bpp ] @ 60.0 Hz, flags [], 0 degr], modeChanged false, modeCount 248]]]
, ParentWindow null
, ParentWindowHandle 0x0 (false)
, WindowHandle 0xc1836
, SurfaceHandle 0xffffffffe8011842 (lockedExt window false, surface false)
, Pos 2048/100 (auto false), size 640x480
, Visible true, focus false
, Undecorated false (false)
, AlwaysOnTop false, Fullscreen false
, WrappedSurface null
, ChildWindows 0, SurfaceUpdatedListeners num 0 [], WindowListeners num 2 [com.jogamp.newt.opengl.GLWindow$2@1cc0af6, jogl.test.JOGL2NewtDemo$1@e3cd9c, ], MouseListeners num 0 [], PointerGestures default true, custom 0 [], KeyListeners num 0 [], windowLock <1cfe433, 18f11d3>[count 2, qsz 0, owner <main-FPSAWTAnimator-Timer0>], surfaceLockCount 1]]]
        at jogamp.opengl.windows.wgl.WindowsWGLContext.makeCurrentImpl(WindowsWGLContext.java:410)
        at jogamp.opengl.GLContextImpl.makeCurrentWithinLock(GLContextImpl.java:718)
        at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:562)
        at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:519)
        at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1089)
        at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:978)
        at com.jogamp.newt.opengl.GLWindow.display(GLWindow.java:600)
        at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:75)
        at com.jogamp.opengl.util.AnimatorBase.display(AnimatorBase.java:443)
        at com.jogamp.opengl.util.FPSAnimator$MainTask.run(FPSAnimator.java:170)
        at java.util.TimerThread.mainLoop(Unknown Source)
        at java.util.TimerThread.run(Unknown Source)
============================================================================


Reply | Threaded
Open this post in threaded view
|

Re: any one is using two screens?

Sven Gothel
Administrator
On 03/12/2014 11:13 PM, cznlzq [via jogamp] wrote:
..

        window.addGLEventListener(new JOGL2Renderer());
        window.setPosition(2048, 100);
        window.setSize(WINDOW_WIDTH, WINDOW_HEIGHT);
        window.setTitle(TITLE);
        window.setVisible(true);

..

> result:
>
> When I window.setPosition(100, 100) to first monitor, everything works perfectly.
> However, when I window.setPosition(2048, 100) to second monitor, error message:
>
...

This is odd .. maybe your driver does not provide OpenGL
on that big-desktop screen, which would be something new I guess ..

I have tested these configuration on Windows-7 w/ NV driver,
I assume you have a similar setup ?

Please file a bug report .. just to be sure,
however .. I guess it's a driver bug.

You even do not move a pre-existing window to the other screen,
just create a new one. This case is quite simple.

> javax.media.opengl.GLException: Error making context 0x20000 current on Thread
> main-FPSAWTAnimator-Timer0, drawableWrite 0xffffffffe8011842, drawableRead
> 0xffffffffe8011842, werr: 0, WindowsWGLContext [Version 4.2 (Compat profile,
> arb, ES2 compat, FBO, hardware) - 4.2.11631 Compatibility Profile Context [GL
> 4.2.0, vendor 0.0.0 (n/a)], options 0x1403, this 0x3bf486, handle 0x20000,
> isShared false, jogamp.opengl.gl4.GL4bcImpl@afd218,
>          quirks: [NoDoubleBufferedBitmap, NeedCurrCtx4ARBCreateContext],
>         Drawable: WindowsOnscreenWGLDrawable[Realized true,
>         Factory   jogamp.opengl.windows.wgl.WindowsWGLDrawableFactory@10a280f,
>         Handle    0xffffffffe8011842,
>         Surface   jogamp.newt.driver.windows.WindowDriver[Config
> WindowsWGLGraphicsConfiguration[DefaultGraphicsScreen[WindowsGraphicsDevice[type
> .windows, connection decon, unitID 0, handle 0x0, owner false,
> NullToolkitLock[]], idx 0], pfdID 2, ARB-Choosen true,
>         requested GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms
> 16/0/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]],
>         chosen    GLCaps[wgl vid 0x2 arb: rgba 8/8/8/8, opaque, accum-rgba
> 0/0/0/0, dp/st/ms 24/8/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]]]
> , NEWT-Screen[.windows_nil-1-s0, idx 0, refCount 1, vsize [ 0 / 0  3200 x 1080
> ], DefaultGraphicsScreen[WindowsGraphicsDevice[type .windows, connection
> decon, unitID 0, handle 0x0, owner false, NullToolkitLock[]], idx 0],
> NEWT-Display[.windows_nil-1, excl false, refCount 1, hasEDT true, edtRunning
> true, WindowsGraphicsDevice[type .windows, connection decon, unitID 0, handle
> 0x0, owner false, NullToolkitLock[]]], monitors: [Monitor[Id 0x0, 677 x 381
> mm, viewport [ 0 / 0  1920 x 1080 ], orig [Id 0x0, [ 1920 x 1080 x 32 bpp ] @
> 60.0 Hz, flags [], 0 degr], curr [Id 0x0, [ 1920 x 1080 x 32 bpp ] @ 60.0 Hz,
> flags [], 0 degr], modeChanged false, modeCount 368], Monitor[Id 0x1, 452 x
> 361 mm, viewport [ 1920 / 0  1280 x 1024 ], orig [Id 0x0, [ 1280 x 1024 x 32
> bpp ] @ 60.0 Hz, flags [], 0 degr], curr [Id 0x0, [ 1280 x 1024 x 32 bpp ] @
> 60.0 Hz, flags [], 0 degr], modeChanged false, modeCount 248]]]
> , ParentWindow null
> , ParentWindowHandle 0x0 (false)
> , WindowHandle 0xc1836
> , SurfaceHandle 0xffffffffe8011842 (lockedExt window false, surface false)
> , Pos 2048/100 (auto false), size 640x480
> , Visible true, focus false
> , Undecorated false (false)
> , AlwaysOnTop false, Fullscreen false
> , WrappedSurface null
> , ChildWindows 0, SurfaceUpdatedListeners num 0 [], WindowListeners num 2
> [com.jogamp.newt.opengl.GLWindow$2@1cc0af6, jogl.test.JOGL2NewtDemo$1@e3cd9c,
> ], MouseListeners num 0 [], PointerGestures default true, custom 0 [],
> KeyListeners num 0 [], windowLock <1cfe433, 18f11d3>[count 2, qsz 0, owner
> <main-FPSAWTAnimator-Timer0>], surfaceLockCount 1]]]
>         at
> jogamp.opengl.windows.wgl.WindowsWGLContext.makeCurrentImpl(WindowsWGLContext.java:410)
>
>         at
> jogamp.opengl.GLContextImpl.makeCurrentWithinLock(GLContextImpl.java:718)
>         at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:562)
>         at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:519)
>         at
> jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1089)
>         at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:978)
>         at com.jogamp.newt.opengl.GLWindow.display(GLWindow.java:600)


signature.asc (894 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: any one is using two screens?

cznlzq
Hi Sven

I'm using ATI cards, drivers are updated.

Hope others in this forum can give it a try to see if it's card-dependent issue......

Thanks.


Reply | Threaded
Open this post in threaded view
|

Re: any one is using two screens?

jmaasing
I'm using Mac OSX so this is probably irrelevant but I have no problem with setPosition on my NEWT window, it works fine. Although I have to set position to -1024,100 since my secondary screen is to the left :-)
Reply | Threaded
Open this post in threaded view
|

Re: any one is using two screens?

gouessej
Administrator
In reply to this post by cznlzq
cznlzq, please be more accurate, give us the exact version number of the driver and the name of your graphics card.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: any one is using two screens?

cznlzq
Hi gouessej,

I just confirmed that my driver indeed was not the latest one.

I got the latest one from the card web site and with several testings
I found that everything is working perfectly now.

Thanks a lot.