[FIXED] Unknow problem. Works on Debug mode but crashes on Run mode

Hi,



my applications crashes when I run it at Run mode. But works in debug mode stablishing a breakpoint on the System.err.println.



I initialize the game with this method


 protected void initialize(int resWidth, int resHeight, int resbpp, int resRate, int angle, boolean isWidowed, boolean vsync) {

      
      gameSettings = new PreferencesGameSettings(Preferences.userRoot(),true);
      
      gameSettings.setWidth(resWidth);
      gameSettings.setHeight(resHeight);
      gameSettings.setDepth(resbpp);
      gameSettings.setFrequency(resRate);
      //angulo

sounds like a Race Condition to me.



If you Debug, the opengl thread is suspended and the main thread doesn’t interfere. In run mode, they both run and interfere somehow.



search for the list of calls that have to be done inside the opnegl thread.



or check this out if you are familiar with AspectJ: http://www.jmonkeyengine.com/jmeforum/index.php?topic=9872.0



so long

I'm still having problems. I create a TexLoader with this code:



public class JMETexLoader implements Callable<Node>{

   private ByteBuffer bytes;
   private Format format;
   private int width;
   private int height;
   private int idTextura;
   private DebugGameState state;

   
   public JMETexLoader(DebugGameState state, Format formatoImagen, int width, int height, ByteBuffer bufferDatos,int idTextura){
      this.format=formatoImagen;
      this.width=width;
      this.height=height;
      this.bytes = bufferDatos;
      this.idTextura=idTextura;
      this.state=state;
   }
   
   public Node call() throws Exception {
      //Creo la imagen con los datos binarios
      Image img = new Image(format,width,height,bytes);
      
      //Creo un Texture State
      TextureState ts = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
      
      //Me creo una textura 2D
      Texture tex = new Texture2D();
      
      //Indico que filtros voy a utilizar
      tex.setMinificationFilter(MinificationFilter.NearestNeighborNoMipMaps);
      tex.setMagnificationFilter(MagnificationFilter.NearestNeighbor);
      
      //Digo que imagen tiene que utilizar la textura
      tex.setImage(img);
      
      //A

Ok.



I found the problem.



I call a native method to load the ByteBuffer, and it seems that this method does something with OpenGL.



When I changed the native method to a Java method that not use OpenGL everything works fine.



Thanks dhdd