Character Control

Ok, I’ll just break down and do a little code dump. After scouring it for the past week, I don’t see much wrong. Hopefully, someone will notice something.


/**
   * <code>initDisplay</code> initializes the <code>Display</code> object
     * using a valid display mode. 
     * 
     * @throws MonkeyRuntimeException if no valid display mode is found for
     *      the display's request resolutions.
     */
    private void initDisplay() {

        try {
            //create the Display. 
            DisplayMode mode = getValidDisplayMode(width, height, bpp, freq);
            if (null == mode) {
                throw new MonkeyRuntimeException("Bad display mode");
            }

            if (fullscreen) {
                Display.setDisplayMode(mode);
                gl = new GL(title, bpp, 0, 1, 0);
            } else {
                int x, y;
                x =
                    (Toolkit.getDefaultToolkit().getScreenSize().width - width)
                        / 2;
                y =
                    (Toolkit.getDefaultToolkit().getScreenSize().height
                        - height)
                        / 2;
                gl = new GL(title, x, y, width, height, bpp, 0, 1, 0);
            }

            gl.create();
            gl.determineAvailableExtensions();

            LoggingSystem.getLoggingSystem().getLogger().log(
                Level.INFO,
                "Created display.");
        } catch (Exception e) {
            LoggingSystem.getLoggingSystem().getLogger().log(
                Level.SEVERE,
                "Failed to create display due to " + e);
            System.exit(1);
        }

        glu = new GLU(gl);
    }

That creates the GL and GLU objects.

EDIT: I just realized I change the fullscreen last three params from 1,1,1 to 0,1,0 and windowed from 0,0,0 to 0,1,0 on advice from Elias in a different thread. Could it be the 1,1,1 is failing for some computers in fullscreen? If that’s it, it’s change in updated, so feel free to test.

[quote]gl = new GL(title, bpp, 0, 1, 0);
[/quote]
Depth buffer = 1? ??? (I don’t understand, I thought that should be a number of bits or 0 if you don’t know?)
Anyway that seems the difference with what I do (I set it to 0).

This is where my confusion set in as well. Elias and I discussed it this morning in LWJGL forum about depth buffers in linux vs. windows. 1 is what I was told to set it to to fix a HORRIBLE depth issue in Linux. Apparently in Windows 0 sets a valid depth size, where in Linux it sets it to 0. So, in Linux my depth was totally jacked, water showing through terrain, etc.

Ah, I see. Thanks for pointing that out :slight_smile:
Anyway, so what we have now is that it seems as if on the GF4, any 16 bit mode doesn’t support a depth buffer. Which I think is not true, so maybe it is a problem in LWJGL after all where it wrongly detects a 16bit to not have a depth buffer (I think when I run CT in 16 bit I still have a depth buffer) or otherwise maybe a fault in the driver?
:-/

Perhaps you can play with a local copy of Cosmic Trip and set depth to 1 and see if that causes the same issue. If so, if there is any LWJGL devs watching this thread, I’d love your opinion on it.

I am runing linux. I wasn’t able to get your stuff started.
I have tried the command below but still am not succesful with starting it.

java -cp .:lib/jme.jar:lib/lwjgl.jar -Djava.library.path=lib/ test.general.TestMain

The error I get.
Exception in thread “main” java.lang.NoClassDefFoundError: test/general/TestMain

Well, this is all I do in when running in linux:

export CLASSPATH=lib/jme.jar:lib/lwjgl.jar
java -Djava.library.path=lib test.general.TestMain

looks similar. Just seperation of CLASSPATH from the java command.

also have to download the linux version of lwjgl and add the .so files into the lib directory. I’ll get a linux version up with the windows version so you don’t have to do this in the future.

[quote]Perhaps you can play with a local copy of Cosmic Trip and set depth to 1 and see if that causes the same issue.
[/quote]
I just did, but… for me it works with depth to 1 in 16bit bpp (which BTW boosted fps in CT with more than 50 compared to 32bit!). However, setting alpha to 1 results in the same error when selecting a 16bit mode but I suppose that makes sense or doesn’t it?
You did set depth to 1 didn’t you, and not alpha?

Yeah, only set depth… :frowning:

Display.setDisplayMode(mode);
                gl = new GL(title, bpp, 0, 1, 0);

I’m at the end of my rope… I just don’t know what the problem is.

:frowning:

At least it works now on my work PC which has crappy intel video. It even works pretty well :slight_smile: