Hi every one, i’m searching for a while and thinking that solution is so simple that i can not find it… need hollidays ?
So i’m currently writing a modeler based on JMonkey3 engine and Netbeans RCP. I’m ussing a ribbon, action to opening the editor, i’m started from SceneViewerTopComponent available in the JMonkey platform (need to tell that @normen made a fantastic job in the JMonkey platform) , this i what is looking like :
So, i’ve got a SceneApplication class which inherits from Application which create and start the canvas (which would be starting rendering automatically when canvas is displayed regarding Application class source code) :
[java]
protected Node rootNode = new Node(“RootNode”);
public static SceneApplication getApplication() {
if (application == null) {
application = new SceneApplication();
}
return application;
}
protected SceneApplication() {
try {
AppSettings newSetting = new AppSettings(true);
newSetting.setFrameRate(30);
newSetting.setRenderer(AppSettings.LWJGL_OPENGL_ANY);
setSettings(newSetting);
setPauseOnLostFocus(false);
createCanvas();
startCanvas(true);
} catch (Exception | Error e) {
Exceptions.printStackTrace(e);
}
}
[/java]
in this class i’ve got an OpenScene method which is called by an action :
[java]
public void openScene() {
closeScene();
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
enqueue(new Callable() {
public Object call() throws Exception {
// hardcoded scene for test
AmbientLight al = new AmbientLight();
al.setColor(ColorRGBA.White.mult(1.3f));
rootNode.addLight(al);
Material grayMat = new Material(assetManager, “Common/MatDefs/Misc/Unshaded.j3md”);
grayMat.getAdditionalRenderState().setWireframe(true);
grayMat.setColor(“Color”, ColorRGBA.Gray);
Geometry grid = new Geometry(“grid”, new Grid(20, 20, 1.0f));
grid.setMaterial(grayMat);
grid.setLocalTranslation(-10, 0, -10);
rootNode.attachChild(grid);
Box b = new Box(Vector3f.ZERO, 1, 1, 1);
Geometry geom = new Geometry(“Box”, b);
Material mat = new Material(assetManager, “Common/MatDefs/Misc/Unshaded.j3md”);
mat.setColor(“Color”, ColorRGBA.Blue);
geom.setMaterial(mat);
//end hardcoded region
rootNode.attachChild(geom);
cam.setLocation(new Vector3f(0, 0, 10));
System.out.println("Framerate: " + String.valueOf(getContext().getTimer().getFrameRate()));
return null;
}
});
}
});
}
[/java]
action do this stuff :
[java]
MyViewerTopComponent viewer = new MyViewerTopComponent();
viewer.open();
viewer.requestActive();
viewer.OpenScene();
[/java]
In my TopComponent (Netbeans RCP window), i’ve got a jPanel and the Canvas is added to JPanel, i’ve forced panel and canvas size to 640x480 to
be sure display zone will be fine (and this is the case because i can see a black rectangle at execution time in the TopComponent.
here, you can find to Jmonkey output + a framerate information (seems to be 0 but maybe i dont read value in the right place :
INFO [com.jme3.system.JmeSystem]: Running on jMonkeyEngine 3.0.0 Beta
INFO [com.jme3.system.Natives]: Extraction Directory: "my project directory"
INFO [com.jme3.system.lwjgl.LwjglDisplay]: MAIN: Creating OGL thread.
INFO [com.jme3.system.lwjgl.LwjglAbstractDisplay]: Using LWJGL 2.8.3
INFO [com.jme3.system.lwjgl.LwjglDisplay]: OGL: Pbuffer has been created
INFO [com.jme3.renderer.lwjgl.LwjglRenderer]: Caps: [FrameBuffer, FrameBufferMRT, FrameBufferMultisample, TextureMultisample, OpenGL20, OpenGL21, OpenGL30, OpenGL31, OpenGL32, ARBprogram, GLSL100, GLSL110, GLSL120, GLSL130, GLSL140, GLSL150, VertexTextureFetch, TextureArray, TextureBuffer, FloatTexture, FloatColorBuffer, FloatDepthBuffer, PackedFloatTexture, SharedExponentTexture, PackedFloatColorBuffer, TextureCompressionLATC, NonPowerOfTwoTextures, MeshInstancing, VertexBufferArray]
INFO [com.jme3.system.lwjgl.LwjglContext]: Adapter: aticfx64
INFO [com.jme3.system.lwjgl.LwjglContext]: Driver Version: null
INFO [com.jme3.system.lwjgl.LwjglContext]: Vendor: ATI Technologies Inc.
INFO [com.jme3.system.lwjgl.LwjglContext]: OpenGL Version: 4.2.11399 Compatibility Profile Context
INFO [com.jme3.system.lwjgl.LwjglContext]: Renderer: ATI Radeon HD 5700 Series
INFO [com.jme3.system.lwjgl.LwjglContext]: GLSL Ver: 4.20
INFO [com.jme3.system.lwjgl.LwjglTimer]: Timer resolution: 1 000 ticks per second
INFO [com.jme3.system.lwjgl.LwjglDisplay]: EDT: Telling OGL to create display ..
INFO [com.jme3.asset.AssetManager]: DesktopAssetManager created.
INFO [com.jme3.renderer.Camera]: Camera created (W: 640, H: 480)
INFO [com.jme3.renderer.Camera]: Camera created (W: 640, H: 480)
Panel dimensions=width:640, height:480
Canvas dimensions=width:640, height:480
INFO [com.jme3.audio.lwjgl.LwjglAudioRenderer]: AudioRenderer supports 64 channels
INFO [com.jme3.audio.lwjgl.LwjglAudioRenderer]: Audio effect extension version: 1.0
INFO [com.jme3.audio.lwjgl.LwjglAudioRenderer]: Audio max auxilary sends: 4
INFO [com.jme3.system.lwjgl.LwjglDisplay]: OGL: Creating display ..
INFO [com.jme3.system.lwjgl.LwjglDisplay]: OGL: Waiting for canvas to become displayable..
INFO [com.jme3.system.lwjgl.LwjglDisplay]: OGL: Creating display context ..
INFO [com.jme3.renderer.lwjgl.LwjglRenderer]: Deleting objects and invalidating state
INFO [com.jme3.system.lwjgl.LwjglDisplay]: OGL: Display is active!
INFO [com.jme3.scene.Node]: RootNode (Node): All children removed.
INFO [com.jme3.material.MaterialDef]: Loaded material definition: Unshaded
INFO [com.jme3.scene.Node]: Child (grid) attached to this node (RootNode)
INFO [com.jme3.scene.Node]: Child (Box) attached to this node (RootNode)
Framerate: 0.0
So it's seems that open gl display is ready, but nothing appears, if someone could help me to burn the tree in center of my eye i will appreciate !
see you ! ++