jogl portability

Hy folks,
we are trying to port a java-jogl application from linux to macosx and windows. A few questions regarding both systems:

  1. does anybody know why putting the *.dll (or *.jnilib) of jogl intothe java.library.path does not work. It only works if I put them into the …/j2sdk1.4.2/bin/.

  2. on windows I nevertheless have an error,which is:
    net.java.games.jogl.GLException: Method “wglChoosePixelFormatARB” not available
    at net.java.games.jogl.impl.windows.WindowsGLImpl.wglChoosePixelFormatARB(WindowsGLImpl.java:22201)
    at net.java.games.jogl.impl.windows.WindowsPbufferGLContext.createPbuffer(WindowsPbufferGLContext.java:207)
    at net.java.games.jogl.impl.windows.WindowsOnscreenGLContext.makeCurrent(WindowsOnscreenGLContext.java:116)
    at net.java.games.jogl.impl.GLContext.invokeGL(GLContext.java:162)
    at net.java.games.jogl.GLCanvas.reshape(GLCanvas.java:105)
    at java.awt.Component.setBounds(Unknown Source)
    at java.awt.BorderLayout.layoutContainer(Unknown Source)
    at java.awt.Container.layout(Unknown Source)
    at java.awt.Container.doLayout(Unknown Source)
    at java.awt.Container.validateTree(Unknown Source)
    at java.awt.Container.validateTree(Unknown Source)
    at java.awt.Container.validateTree(Unknown Source)
    at java.awt.Container.validateTree(Unknown Source)
    at java.awt.Container.validateTree(Unknown Source)
    at java.awt.Container.validateTree(Unknown Source)
    at java.awt.Container.validateTree(Unknown Source)
    at java.awt.Container.validateTree(Unknown Source)
    at java.awt.Container.validate(Unknown Source)
    at java.awt.Window.show(Unknown Source)
    at java.awt.Component.show(Unknown Source)
    at java.awt.Component.setVisible(Unknown Source)
    at jgrass.client.gui.swing.MainFrame.(MainFrame.java:255)
    at jgrass.client.Main.(Main.java:195)
    at jgrass.client.Main.main(Main.java:288 )

This should not depend on me, I guess. But I don’t know exactly how to act. First time I develop in windows.

Thanks for any hint.
Andrea

Please post your code related to GLCapabilities, GLCanvas, etc. Also what videocard are you using?

I haven’t researched the reason, but on Windows Java looks in the PATH, not the LD_LIBRARY_PATH as on Linux, locations for .dlls.

Sean

Thanks for the reply, I post the class that gives the problems on the last line visible(true).

public class MainFrame extends JFrame
  implements ParentFrame, ActionListener, ChangeListener, KeyListener,
             ToolBarListener
{
  /* Toolbar item constants */
  public static final String CONFIG_WINDOWFRAME_TAG = "windowframe";
  public static final String CONFIG_MAPDRAWING_TAG = "mapdrawing";
  public static final String CONFIG_APPLICATION_TAG = "application";
  public static final String CONFIG_CONSOLE_TAG = "consolewindow";
  public static final String CONFIG_LEGEND_TAG = "legendwindow";
  public static final String CONFIG_NORTHARROW_TAG = "north_arrow";
  public static final String CONFIG_MAPSCALE_TAG = "map_scale";
  public static final String CONFIG_TOOLBARITEM_TAG = "toolbaritem";

  private static final String TOOLBARITEM_LEGEND_ACTION = "togglelegend";
  private static final String TOOLBARITEM_VIEW_PARAMS = "viewparams";
  private static final String TOOLBARITEM_QUERY_MAP = "querymap";

  private static final String TOOLBARITEM_DEFAULT = "$default";
  private static final String TOOLBARITEM_ZOOMIN = "$zoomin";
  private static final String TOOLBARITEM_ZOOMOUT = "$zoomout";
  private static final String TOOLBARITEM_PAN = "$pan";
  private static final String TOOLBARITEM_MAPLEGEND = "$maplegend";

  /** */
  private static final String
    CONFIG_ERROR_DIALOG_TITLE = "Configuration Parameters Error";

  /* Main java application object */
  private jgrass.client.Main main;

  /* Splash screen object. */
  public SplashWindow splash = null;

  /* Main frame toolbar object */
  private JPanel toolbarPanel;

  /* Vector storage for module objects that must be
   * installed after a user has logded in. */
//  private Vector loginModules = null;

  /* Active module component */
  private DisplayModule activeModule = null;

  /* Class logger instance. */
  private Logger logger = LogManager.getLogger(this.getClass().getName());

  /* Status panel */
  private JPanel statusBar;

  /* Taskbar panel */
  private JToolBar taskBar;

  /* */
  private Hashtable visibletoolbars = new Hashtable();

  /* */
  private JLabel statusMessage = new JLabel("", JLabel.LEFT);

  private AnimatedLabel busy = null;

  /* Configration class */
  public Configuration config;

  /* Legend Frame */
  private LegendPane legend = null;

  /* 3D View Frame */
  private View3DPane view3d = null;

  /* */
  private QueryPane querywindow = null;

  /* */
  private Console console = null;
  private CloseButtonTabbedPane consoleTab = null;
  private Color consoleTabActiveColor = null;
  private Color consoleTabInactiveColor = null;
//  private TitledBorder glCanvasBorder = null;
//  private GLRenderer glRenderer = null;
  private JToolBar mapToolbar = null;

  /**
   * Keys pressed
   */

  
  /**
   * Constructor for the main application frame which holds the GLCanvas
   * and the Console.
   * @param jgrass.client.Main Application object.
   * @param Configuration confoguration object that holds the config.xml data.
   */
  public MainFrame(jgrass.client.Main _main, Configuration _config)
  {
    super();

    GrassEnvironmentManager.getInstance().setParentFrame(this);

    main = _main;
    config = _config;
    splash = main.splash;

    /* Set look and feel specified in configuration file */
    LookAndFeel lf = config.getLookAndFeel();

    /* Set windowframe settings taken from configuration parameters */
    setTitle(config.getWindowTitle() + ResourceLoader.getBuild());
    setIconImage(ResourceLoader.LoadImage(_config.getWindowIcon()));
    UIManager.put("ToolTip.font", new FontUIResource(config.getTipFont()));
    UIManager.put("ToolTip.background", new ColorUIResource(
                  config.getTipBackgroundColor()));

    splash.setStatus("Loading configuration. Please wait...");
    splash.incProgress();
    applyConfiguration();
    splash.setStatus("Starting up main window. Please wait...");
    splash.incProgress();

    /* Set windowframe settings taken from configuration parameters */
    Dimension sz = config.getWindowDimension();
    Point pos = new Point(0,0);
    if (sz.width == -1)
    {
      sz.width = (int)((float)Toolkit.getDefaultToolkit().getScreenSize().width *.8);
    }
    pos.x = (Toolkit.getDefaultToolkit().getScreenSize().width - sz.width) / 2;
    if (sz.height == -1)
    {
      sz.height = (int)((float)Toolkit.getDefaultToolkit().getScreenSize().height *.8);
    }
    pos.y = (Toolkit.getDefaultToolkit().getScreenSize().height - sz.height) / 2;
    setLocation(pos);
    setSize(sz);
//    pack();
    setVisible(true);
  }

I put the file MapCanvas.java (which contains GLCapabilities, GLCanvas, etc) at the url:
http://bedu.ing.unitn.it/~moovida

Thanks in advance.
Andrea

Videocard I use on the windows PC:
NVIDIA RIVA TNT2 Model 64

Does this program work on a linux machine? The “not available” exception is generated because either because the TNT2 doesn’t support it, I am pretty sure it does though, or because your context was created on a different thread. You must make all of your opengl calls from the same thread. You can verify that your card supports pbuffers by downloading GLEW from sourceforge and checking that wglChoosePixelFormat is supported.

Hy,
it works both on linux and Mac, just the windows machine complains…
But my linux laptop has a rather new NVidia and the windows machine an older graphicscards.
I will try all your suggested steps and let you know how what happens.

Thanks
Andrea

I realized one thing that could probably help.
On windows I use Eclipse to build the application. I already supplied the error I got.
Trying from commandline on another pc (because of the different graphic card) it complains about the fact that it can’t the application because it can’t find the library jawt.dll. The same happens on the first pc if started from command line.
The lib is in the same path as the jogl one, therefore I can’t understand what happens.

Has anyone a guess on why it cant load (or find) the needed lib?

Thanks
Andrea

GKW, you were right!
I solved the minor problem of the jawt.dll not loading. The folder was already in the path. I added to the PATHEXT variable the .DLL extension and it worked. Hope this is not too dirty. ???

After that the application works on the newer computer. Ergo the graphics card of the old one was a problem.

Lots of thanks to everyone who replied and helped to solve ;D
Andrea