Hi, Thanks for your responses.
David, I tried your code which resulted in no action. Here is my test codeâŚ
package test;
import com.jme3.system.AppSettings;
import com.jme3.system.JmeContext;
import com.jme3.system.JmeSystem;
import com.jme3.app.SimpleApplication;
import com.jme3.app.StatsAppState;
import com.jme3.app.FlyCamAppState;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
import com.jme3.input.InputManager;
import com.jme3.input.RawInputListener;
import com.jme3.input.event.JoyAxisEvent;
import com.jme3.input.event.JoyButtonEvent;
import com.jme3.input.event.KeyInputEvent;
import com.jme3.input.event.MouseButtonEvent;
import com.jme3.input.event.MouseMotionEvent;
import com.jme3.input.event.TouchEvent;
import java.awt.Canvas;
import java.awt.Frame;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import com.jme3.system.JmeCanvasContext;
import com.jme3.system.NullContext;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class Test extends SimpleApplication implements RawInputListener
{
private AppSettings appSettings;
private boolean fullscreen=false;
private TestFrame tf;
public static void main(String[] args)
{
DB.install();
DB.print(âSTARTâ);
Test t=new Test();
t.show();
DB.print(âENDâ);
}
private Test()
{
super(new StatsAppState());
tf=new TestFrame();
appSettings=new AppSettings(true);
appSettings.setFullscreen(fullscreen);
setSettings(appSettings);
setShowSettings(false);
}
public void finish()
{
stop();
}
public void show()
{
createCanvas();
tf.setCanvas(((JmeCanvasContext)getContext()).getCanvas());
startCanvas();
}
public void simpleInitApp()
{
Box b=new Box(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);
rootNode.attachChild(geom);
InputManager inputManager=getInputManager();
inputManager.clearMappings();
inputManager.clearRawInputListeners();
inputManager.addRawInputListener(this);
inputManager.setCursorVisible(true);
stateManager.detach(stateManager.getState(FlyCamAppState.class));
}
public void screenSwap()
{
fullscreen=!fullscreen;
DB.print(âscreenSwap fs=â+fullscreen);
AppSettings settingsEdit=new AppSettings(false);
settingsEdit.copyFrom(getContext().getSettings());
settingsEdit.setFullscreen(fullscreen);
setSettings(settingsEdit);
restart();
// GraphicsDevice gd=GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
// if(fullscreen)
// {
// gd.setFullScreenWindow(tf);
// }else{
// gd.setFullScreenWindow(null);
// }
// restart();
}
//################################################################################
// RawInputListener
//################################################################################
public void beginInput()
{}
public void endInput()
{}
public void onJoyAxisEvent(JoyAxisEvent _e)
{
DB.print("RawInputListener.onJoyAxisEvent "+_e);
}
public void onJoyButtonEvent(JoyButtonEvent _e)
{
DB.print("RawInputListener.onJoyButtonEvent "+_e);
}
public void onKeyEvent(KeyInputEvent _e)
{
DB.print("RawInputListener.onKeyEvent "+_e);
}
public void onMouseButtonEvent(MouseButtonEvent _e)
{
DB.print("RawInputListener.onMouseButtonEvent "+_e);
if(_e.getButtonIndex()==0&&_e.isReleased())screenSwap();
}
public void onMouseMotionEvent(MouseMotionEvent _e)
{
DB.print("RawInputListener.onMouseMotionEvent "+_e);
}
public void onTouchEvent(TouchEvent _e)
{
DB.print("RawInputListener.onTouchEvent "+_e);
}
//################################################################################
// TestFrame
//################################################################################
private static class TestFrame extends Frame
{
private static final long serialVersionUID=1;
private Canvas canvas=null;
private TestFrame()
{
super(âTestFrameâ);
setBounds(10,10,600,500);
setVisible(true);
addWindowListener(new WindowAdapter(){public void windowClosing(WindowEvent _e){setVisible(false);}});
}
private void setCanvas(Canvas _canvas)
{
if(canvas!=null)remove(canvas);
canvas=_canvas;
if(canvas!=null)add(canvas);
DB.print(ânew Canvas=â+_canvas);
}
}
//################################################################################
// end
//################################################################################
}
To answer your questions, I have included a screen shot of my project running in a web served page. The structure is simply an AWT Canvas childed to the Applet.
There is no other AWT or Swing functions or objects whatsoever. My GUI runs completely within the JOGL Newt Canvas. Unfortunately I havent written the handler to pull the image from the graphics card in full screen mode so you will just have to believe me it works and very reliably too.
The reason why your suggestion didnt work, so I believe, is that the âcontextâ is of lwjgl canvas, ie should sit within a frame, or applet in my case, which does not have the ability to go to full screen. In my existing project I create a Jogl2 GLWindow and just redirect the renderer and input events achordingly and works very well.
Momoko, I downloaded the lwjgl3-mater.zip from www.lwjgl.org but couldnt find any class called âDisplayâ and I couldnt find any class called âDisplayâ within the jme3 libs either so I am not sure how to implement your suggestion.
Many thanks for your suggestions. I am begining to come to the conclusion that to acheive my, what I would have considered a simple and obvious, requriement it looks like I am going to have to bastadise JMonkey with a very large sledgehammer.
Unless someone has a solution lol
Maybe I need to seriously consider other 3D engines.
Regards
Penny