PixelFormat not accelerated, but nehe demos run

Started by fictiveLaark, June 21, 2010, 23:05:20

Previous topic - Next topic

fictiveLaark

I'm trying to run a demo of my game on the desktops in a computer lab, I haven't had much success.  First, just running the program gives me a PixelFormat not accelerated error, allowing software rendering works but the game really slows down.  I then read about the PixelFormat errors on here and asked about the drivers on the computer.  The IT guy said that the drivers are up to date and I was able to run the executable for lesson5 at the nehe website.  I'm out of ideas but the fact that I can run the nehe demo gives me hope that I can do something, any suggestions?

Rene

How do you create your display? And what kind of hardware are you working with?
When I am king, they shall not have bread and shelter only, but also teachings out of books, for a full belly is little worth where the mind is starved - Mark Twain

fictiveLaark

It's not much but I thought I should be able to do something(I've experimented with pixel formats):

Intel(R) 82915G/GV/910GL Express Chipset Family (Microsoft Corporation -XDDM)

And this following code gives me the error at Display.create().

BufferedReader reader;
        File settings = new File("Settings" + File.separator + "Graphics.set");
        try {
            reader = new BufferedReader(new FileReader(settings));

            String line, rawCode = "";
            while((line = reader.readLine()) != null){
                rawCode += line + "\n";
            }

            Map<String, String> code = Utils.parseCode(rawCode);
            int targetWidth = Integer.parseInt(code.get("ScreenWidth"));
            int targetHeight = Integer.parseInt(code.get("ScreenHeight"));
            int targetBPP = Integer.parseInt(code.get("BPP"));
            fullScreen = Boolean.parseBoolean(code.get("FullScreen"));

            displayMode = findDisplayMode(targetWidth, targetHeight, targetBPP, fullScreen);
            if(displayMode == null){
                displayMode = findLowestDisplayMode();
                if(displayMode == null){
                    return false;
                }
            }
            setDisplayMode(displayMode);

        } catch (FileNotFoundException ex) {
            System.err.println(ex);
            displayMode = findLowestDisplayMode();
            if(displayMode == null){
                return false;
            }
            setDisplayMode(displayMode);
        } catch(IOException ex){
            System.err.println(ex);
            displayMode = findLowestDisplayMode();
            if(displayMode == null){
                return false;
            }
            setDisplayMode(displayMode);
        }
        try {
            Display.create(new PixelFormat(0, 8, 1));
        } catch (LWJGLException ex) {
            System.err.println(ex);
            return false;
        }

Rene

You're creating a PixelFormat with 8 depth bits. Could you try creating one with 16 or 24 bits instead? And do you really need the stencil bit? I'm not sure what kind of stencil buffers are supported by Intel drivers.
When I am king, they shall not have bread and shelter only, but also teachings out of books, for a full belly is little worth where the mind is starved - Mark Twain

fictiveLaark

I've tried the following with no improvement.

new PixelFormat(0, 8, 0)
new PixelFormat(0, 16, 0)
new PixelFormat(0, 24, 0)
new PixelFormat(0, 32, 0)
new PixelFormat(8, 8, 0)
new PixelFormat(8, 16, 0)
new PixelFormat(8, 24, 0)
new PixelFormat(8, 32, 0)

16 alpha bits give a lwjgl exception saying, "Insufficient alpha precision."

Rene

Strange...

Does
Display.setDisplayMode(new DisplayMode(640, 480));
Display.create();

while(!Display.isCloseRequested()){
    Display.update();
}

work?

You could also try the LWJGL demo's at the demo page, but they don't work for me at the moment for some reason
http://lwjgl.org/demos.php
When I am king, they shall not have bread and shelter only, but also teachings out of books, for a full belly is little worth where the mind is starved - Mark Twain

Fool Running

Quote from: fictiveLaark on June 21, 2010, 23:19:52
Intel(R) 82915G/GV/910GL Express Chipset Family (Microsoft Corporation -XDDM)
Looks like you may not have the correct drivers installed (the Microsoft drivers). Have you tried getting updated drivers from Intel?
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D

fictiveLaark

What ever the case may be I can still run the nehe examples, I just tried out the shadow, clipping, stencil, and reflection examples, programs that do much more that what I'm trying to achieve, the the empty LWJGL program suggested doesn't work either.  But I guess it's not worth losing sleep over, come Friday I probably won't see the computers again and so this is more of an exercise in distribution.  The next thing I thought I might try is seeing if I can get visual studio on here and try to actually build an OpenGL program in C.

Edit:

One more thing, I tried running this JOGL program and it worked!

import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import javax.media.opengl.GL;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLEventListener;
import javax.media.opengl.awt.GLCanvas;
import javax.media.opengl.glu.GLU;

import com.jogamp.opengl.util.Animator;



/**
 * SimpleJOGL.java <BR>
 * author: Brian Paul (converted to Java by Ron Cemer and Sven Goethel) <P>
 *
 * This version is equal to Brian Paul's version 1.2 1999/10/21
 */
public class SimpleJOGL implements GLEventListener {
    private final int FRAME = 0, TEXTURE = 1;
    private IntBuffer buffer;

    public static void main(String[] args) {
        Frame frame = new Frame("Simple JOGL Application");
        GLCanvas canvas = new GLCanvas();

        canvas.addGLEventListener(new SimpleJOGL());
        frame.add(canvas);
        frame.setSize(640, 480);
        final Animator animator = new Animator(canvas);
        frame.addWindowListener(new WindowAdapter() {

            @Override
            public void windowClosing(WindowEvent e) {
                // Run this on another thread than the AWT event queue to
                // make sure the call to Animator.stop() completes before
                // exiting
                new Thread(new Runnable() {

                    public void run() {
                        animator.stop();
                        System.exit(0);
                    }
                }).start();
            }
        });
        // Center frame
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
        animator.setRunAsFastAsPossible(true);
        animator.start();
    }

    public void init(GLAutoDrawable drawable) {
        // Use debug pipeline
        // drawable.setGL(new DebugGL(drawable.getGL()));

        GL2 gl = (GL2)drawable.getGL();
        GLU glu = new GLU();
        System.err.println("INIT GL IS: " + gl.getClass().getName());

        // Enable VSync
        gl.setSwapInterval(1);

        // Setup the drawing area and shading mode
        gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
        gl.glShadeModel(GL2.GL_SMOOTH); // try setting this to GL_FLAT and see what happens.

        gl.glEnable(GL.GL_BLEND);
        gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
    }

    public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
    	GL2 gl = (GL2)drawable.getGL();
        GLU glu = new GLU();

        if (height <= 0) { // avoid a divide by zero error!
        
            height = 1;
        }
        final float h = (float) width / (float) height;
        gl.glViewport(0, 0, width, height);
        gl.glMatrixMode(GL2.GL_PROJECTION);
        gl.glLoadIdentity();
        glu.gluPerspective(45.0f, h, 1.0, 20.0);
        gl.glMatrixMode(GL2.GL_MODELVIEW);
        gl.glLoadIdentity();
    }

    long lastTime = -1;
    public void display(GLAutoDrawable drawable) {
    	GL2 gl = (GL2)drawable.getGL();

        // Clear the drawing area
        gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
        // Reset the current matrix to the "identity"
        gl.glLoadIdentity();

        // Move the "drawing cursor" around
        gl.glTranslatef(-1.5f, 0.0f, -6.0f);

        // Drawing Using Triangles
        gl.glBegin(GL.GL_TRIANGLES);
            gl.glColor3f(1.0f, 0.0f, 0.0f);    // Set the current drawing color to red
            gl.glVertex3f(0.0f, 1.0f, 0.0f);   // Top
            gl.glColor3f(0.0f, 1.0f, 0.0f);    // Set the current drawing color to green
            gl.glVertex3f(-1.0f, -1.0f, 0.0f); // Bottom Left
            gl.glColor3f(0.0f, 0.0f, 1.0f);    // Set the current drawing color to blue
            gl.glVertex3f(1.0f, -1.0f, 0.0f);  // Bottom Right
        // Finished Drawing The Triangle
        gl.glEnd();

        // Move the "drawing cursor" to another position
        gl.glTranslatef(3.0f, 0.0f, 0.0f);
        // Draw A Quad
        gl.glBegin(GL2.GL_QUADS);
            gl.glColor3f(0.5f, 0.5f, 1.0f);    // Set the current drawing color to light blue
            gl.glVertex3f(-1.0f, 1.0f, 0.0f);  // Top Left
            gl.glVertex3f(1.0f, 1.0f, 0.0f);   // Top Right
            gl.glVertex3f(1.0f, -1.0f, 0.0f);  // Bottom Right
            gl.glVertex3f(-1.0f, -1.0f, 0.0f); // Bottom Left
        // Done Drawing The Quad
        gl.glEnd();

        // Flush all drawing operations to the graphics card
        gl.glFlush();
    }

    public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {
    }

	@Override
	public void dispose(GLAutoDrawable arg0) {
		// TODO Auto-generated method stub
		
	}
}