Invalid memory access

I know, you guys are probably getting tired of all my questions already… but I'm really interested in using jME2 for my next project (so long as I can get all the kinks worked out).

I'm developing on a Mac Pro, and I get this error about once in every 10 to 15 runs:

Invalid memory access of location 1e97d003 eip=928b5fc5

The code is simple - load a texture, and stick it on a quad:

package mainGame;

import java.util.concurrent.Callable;

import com.jme.image.Texture;
import com.jme.math.Vector3f;
import com.jme.scene.Spatial.LightCombineMode;
import com.jme.scene.shape.Quad;
import com.jme.scene.state.TextureState;
import com.jme.system.DisplaySystem;
import com.jme.util.GameTaskQueueManager;
import com.jme.util.TextureManager;
import com.jmex.editors.swing.settings.GameSettingsPanel;

public class MainGame {
   StandardGame game;

     * Main entry point of the application
    public static void main(String[] args) {
       System.setProperty("jme.stats", "set");
        MainGame app = new MainGame();
    public MainGame() {
    public void begin() {
      // Instantiate StandardGame
      game = new StandardGame("A Simple Test");
      // Show settings screen
      try {
      } catch (InterruptedException e) {
         // TODO Auto-generated catch block
      // Start StandardGame, it will block until it has initialized successfully, then return
        GameTaskQueueManager.getManager().update(new Callable<Void>(){

         public Void call() throws Exception {
            PlayState gameState = new PlayState("Play");
                TextureState ts = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
                Texture t = TextureManager.loadTexture(MainGame.class.getClassLoader()
                           Texture.MinificationFilter.Trilinear, Texture.MagnificationFilter.Bilinear);
                 t.setTranslation(new Vector3f());
               Quad q = new Quad("image",t.getImage().getWidth(),t.getImage().getHeight());

            return null;



I'm experimenting with big texture support, so the texture is pretty large. I've also tried standardizing the texture size to powers of 2, but it didn't help.

Download latest drivers? How big is the texture and what is your video card?

Download latest drivers?

???.... I'm on a Mac.  :wink:

The image I'm currently using is 1200x822. I tried resizing it to a power-of-2, but I still get the error every 10 to 15 runs.

Oh, and I'm on a Mac Pro, with an ATI 1900XL video card with 512mb of memory. My system has 4gb of memory as well.

I've also tried it with an image at 1024x701, and the problem still occurs. Just FYI (I thought it may have just been because the texture was so big, but apparently not).

I can't help with the problem you're seeing, but if it helps to narrow it down I can say that the size of the texture should not be any problem at all - I am throwing larger textures around on lesser hardware with no problems or special tricks (they are power of 2 sized though).

I am starting to wonder if this is a power-of-2 issue. I checked my power-of-2 image that I tried earlier, and I was off by one pixel.  :roll:

I just set it to 1024x1024, and no problems as of yet. In my own engine, I handle non power-of-2 textures by adding empty space to the image (to make it a power-of-2) and then storing some texture offset coordinates for it (to remember the original size and to align it correctly onto surfaces). Does jME2 not do something like this?

jME resizes your texture to power-of-two if the video card doesn't support it. Apparently your video card claims it supports non-power-of-2 so jME doesn't bother.

You can override it with TextureState.overrideNonPowerOfTwoTextureSupport so that it does resize the textures.

I don't really understand the comment about you having a Mac… I went onto the ATI driver site and there were driver downloads for mac there. Then again I have neither an ATI nor a MAC so maybe I am completely off…

The mac drivers on the ATI site are older drivers. Mac is kind of a one-stop shop for software. You don't install drivers, you just install the OS, which handles the rest for you (since Apple already knows what hardware you have). This simplifies system management, but adds other problems (like out-of-date or occasionally buggy drivers). Still, VERY happy with my Mac.  :smiley:

And thank you for the override command. I'll try it out and let you know how it goes.

I was having the same issue.

The TextureState.overrideNonPowerOfTwoTextureSupport fix worked for me.

I'm using a MacBook Pro with ATI Radeon X1600


– Dathan

Yeah, I noticed really bad texture issues with non-power of 2 images on mac also, figured it was just a mac glitch that they are too lazy to fix.  Besides for distro don't you want all the images to be power of 2 anyway?