Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

11991 Posts in 1587 Topics- by 3509 Members - Latest Member: lioneltenel

26. May 2012, 11:54:07 pm
Xith3D CommunityGeneral CategoryNews (Moderators: Marvin Fröhlich, 'n ddrylliog)OpenGLLayer is new a concrete class
Pages: [1]
Print
Author Topic: OpenGLLayer is new a concrete class  (Read 1295 times)
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« on: 05. August 2007, 04:22:38 pm »

I have converted OpenGLLayer from an enum to a rich concrete class. This way it is extendable to support additional render engines not directly integrated into Xith3D's core.

Except for the fact, that you cannot switch over it's elements you can use it exactly the same way as before, since I have imitated an enum with this class.

Marvin
Logged
Ludovic Marcé
Enjoying the stay
*
Offline Offline

Posts: 60


ludo123456@jabber.fr
View Profile
« Reply #1 on: 06. August 2007, 11:50:18 am »

Thanks for this. Cool
But how to use it ?
I have tried to extend OpenGLLayer in my project like this:

Code:
package fr.ign.cogit.appli.risques.ihm;

import org.xith3d.render.config.OpenGLLayer;

public class MyOpenGLLayer extends OpenGLLayer {

    public static final OpenGLLayer JOGL_QT = new MyOpenGLLayer("JOGL_QT", "org.xith3d.render.jsr231.DisplayModeSelectorAWTImpl", "fr.ign.cogit.appli.risques.ihm.CanvasPeerImplQtJambi");
   
/**
* @param name
* @param displayModeSelectorClassName
* @param canvasPeerImplClassName
*/
protected MyOpenGLLayer(String name, String displayModeSelectorClassName,
String canvasPeerImplClassName) {
super(name, displayModeSelectorClassName, canvasPeerImplClassName);
}
}

Then in my app, i instance the canvas like this :
Code:
        canvas = Canvas3DFactory.create(MyOpenGLLayer.JOGL_QT, 800, 600, 16, false, this);

But i have got an error :
Code:
Caused by: java.lang.ArrayIndexOutOfBoundsException: 5
at org.xith3d.render.config.OpenGLLayer.<init>(OpenGLLayer.java:299)
this line:
Code:
        array[ this.ordinal ] = this;

Have i missed something, or should you increase this array ? Huh
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #2 on: 06. August 2007, 01:23:34 pm »

Oops. Indeed. I have fixed this.

btw. If you don't want/need to overwrite any of OpenGLLayer's methods, you don't even need to extend the class. All you would have to is this:
Code:
public static final OpenGLLayer JOGL_QT = new OpenGLLayer("JOGL_QT", "org.xith3d.render.jsr231.DisplayModeSelectorAWTImpl", "fr.ign.cogit.appli.risques.ihm.CanvasPeerImplQtJambi");

Marvin
Logged
Ludovic Marcé
Enjoying the stay
*
Offline Offline

Posts: 60


ludo123456@jabber.fr
View Profile
« Reply #3 on: 06. August 2007, 02:32:59 pm »

Oops. Indeed. I have fixed this.

btw. If you don't want/need to overwrite any of OpenGLLayer's methods, you don't even need to extend the class. All you would have to is this:
Code:
public static final OpenGLLayer JOGL_QT = new OpenGLLayer("JOGL_QT", "org.xith3d.render.jsr231.DisplayModeSelectorAWTImpl", "fr.ign.cogit.appli.risques.ihm.CanvasPeerImplQtJambi");

Marvin
Thanks, but OpenGLLayer contructor has to be public and not protected. Wink


SVN updated.  Cool
« Last Edit: 06. August 2007, 02:43:44 pm by Ludo » Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #4 on: 06. August 2007, 03:29:48 pm »

Thanks, but OpenGLLayer contructor has to be public and not protected. Wink

Oops again Smiley.

SVN updated.  Cool

Thanks.

Marvin
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic