Bug 1158 - WindowsGLContecxt.createimpl returns wrong Profile (1.1) after several iteration
Summary: WindowsGLContecxt.createimpl returns wrong Profile (1.1) after several iteration
Status: RESOLVED DUPLICATE of bug 1146
Alias: None
Product: Jogl
Classification: JogAmp
Component: core (show other bugs)
Version: 2.3.2
Hardware: pc_x86_64 windows
: --- enhancement
Assignee: Sven Gothel
URL:
Depends on:
Blocks:
 
Reported: 2015-05-25 16:07 CEST by Robin Provost
Modified: 2015-09-27 01:11 CEST (History)
1 user (show)

See Also:
Type: ---
SCM Refs:
Workaround: ---


Attachments
debug output (367.36 KB, text/plain)
2015-05-25 16:07 CEST, Robin Provost
Details
test case (3.43 KB, text/plain)
2015-05-25 16:41 CEST, Robin Provost
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robin Provost 2015-05-25 16:07:48 CEST
Created attachment 694 [details]
debug output

Impossible to create GLContext 

AWT-EventQueue-0: createImpl ctx !ARB but ARB is used, profile > GL2 requested (OpenGL >= 3.1). Requested: GLProfile[GL4bc/GL4bc.hw], current: 1.1 (Compat profile, compat[], hardware)

How to reproduce:
Set the property sun.java2d.noddraw=true
Execute this test
Shows a filechooser with a GLCanvas as accessory and cancel it using a robot, usually at the 3rd iteration the exception arise.

<code>
package com.yourpackage;

import java.awt.*;
import java.awt.event.InputEvent;

import javax.swing.*;

import com.jogamp.opengl.*;
import com.jogamp.opengl.awt.GLCanvas;

public class cTestGLContextException
    static final Point CANCEL_POSITION = new Point(697, 471);

    static public void AutoCancelChooser(int delay)
    {
        new Thread()
        {
            public void run()
            {
                try
                {
                    Robot robot = new Robot();
                    // wait 
                    robot.delay(delay);
                    // move
                    Point origin = MouseInfo.getPointerInfo().getLocation();
                    Point destination = CANCEL_POSITION;
                    int nbIterations = 100;
                    for (int i = 1; i <= nbIterations; i++)
                    {
                        float alpha = i / (float) nbIterations;
                        robot.mouseMove((int) (origin.x * (1 - alpha) + destination.x * alpha), (int) (origin.y * (1 - alpha) + destination.y * alpha));
                        robot.delay(5);
                    }
                    // click
                    robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
                    robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
                }
                catch (AWTException e)
                {
                    e.printStackTrace();
                }
            }
        }.start();
    }

    static public void Test()
    {
        final int NB_TEST = 5;
        final int DELAY = 2500;
        final GLCapabilities CAPS = new GLCapabilities(GLProfile.getDefault());

        for (int i = 0; i < NB_TEST; i++)
        {
            System.out.println(" -> iteration  " + i + " on " + NB_TEST);

            try
            {
                SwingUtilities.invokeAndWait(new Runnable()
                {
                    public void run()
                    {
                        // base dialog
                        JDialog dialog = new JDialog((Window) null);
                        dialog.setMinimumSize(new Dimension(500, 300));
                        dialog.setPreferredSize(new Dimension(500, 300));

                        dialog.setModal(false);
                        dialog.setVisible(true);

                        // build accessory
                        JPanel panel = new JPanel(new BorderLayout());
                        GLCanvas canvas = new GLCanvas(CAPS);
                        canvas.display();
                        panel.add(canvas);
                        panel.setPreferredSize(new Dimension(300, 300));

                        // create file chooser with accessory
                        JFileChooser fileChooser = new JFileChooser();
                        fileChooser.setAccessory(panel);

                        // launch robot closer
                        AutoCancelChooser(DELAY);

                        fileChooser.showOpenDialog(dialog);

                        // dispose of resources
                        dialog.setVisible(false);
                        dialog.dispose();
                        canvas.destroy();
                    }
                });
            }
            catch (Throwable e)
            {
                e.printStackTrace();
            }
        }
    }

    static public void main(String[] pArgs)
    {
        Test();
    }
}
</code>
Comment 1 Robin Provost 2015-05-25 16:41:06 CEST
Created attachment 695 [details]
test case
Comment 2 Robin Provost 2015-05-25 19:01:54 CEST
Seems to be a duplicate of #1146

*** This bug has been marked as a duplicate of bug 1146 ***