LWJGL Forum

Programming => LWJGL Documentation => Topic started by: Kikketer on November 15, 2006, 15:02:11

Title: Unable to create display
Post by: Kikketer on November 15, 2006, 15:02:11
I followed the wiki tutorial:
http://lwjgl.org/wiki/doku.php/lwjgl/tutorials/display/basicdisplay

My code is the same so I won't bore you with example code, but I'm getting an error:
"Unable to create display"

This is after failing the following code:

//Create the display
try {
 Display.setDisplayMode(chosenMode);
 Display.setTitle("An Example Title");
 Display.create();
} catch (LWJGLException e) {
 Sys.alert("Error", "Unable to create display");
 System.exit(0);
}


Before getting here I System.out.println the chosenMode.toString(), and it prints 640 x 480 x 16 @70Hz so I know it's available.
Do I need to install OpenGL or some such thing to get this to work??
Title: Unable to create display
Post by: Matzon on November 15, 2006, 18:00:33
what is the exception?
do you have an OpenGL capable graphics card ?
Title: Unable to create display
Post by: Kikketer on November 16, 2006, 14:11:42
Ok with:

Sys.alert("Error", e.getMessage());

It says "Could  not find a valid pixel format"

I checked with the desktop properties and found that I can only refresh at 60 or 75Hz, not 70.
How can I change this?
Title: Unable to create display
Post by: ndhb on November 16, 2006, 14:48:40
Most of us use something like:
for (int i = 0; i < d.length; i++) {
System.err.println("Width " + d[i].getWidth() + " Height " + d[i].getHeight() + " Bits " + d[i].getBitsPerPixel() + " Freq " + d[i].getFrequency()); // DEBUG: display modes
if ((d[i].getWidth() == WIDTH && d[i].getHeight() == HEIGHT && d[i].getBitsPerPixel() == BPP && d[i].getFrequency() == REFRESH)) {
displayMode = d[i];
break;
} // if reasonable display mode detected
} // for all display modes


For something thats not "production code". Maybe you can find a valid pixel format that way.
Title: Re: Unable to create display
Post by: fredrikbridell on December 15, 2006, 15:02:22
I just wanted to add that I had exactly this problem. I had previously managed to install LWJGL and run some simple stuff, when it suddenly stopped working, giving me the error "Could  not find a valid pixel format" even though I was clearly using a pixel format that should be ok. I should add that my graphics card and other OpenGL apps seemed to working fine.

Solution: I downloaded and installed new drivers for the graphics card anyway. Now it works.

I don't know if this is relevant, but the problem occurred after I used the TV-out thing on my graphics card for the first time.
Title: Re: Unable to create display
Post by: krasse on April 03, 2009, 07:35:38
Many of my users have this problem and I keep telling them to update their drivers but that seems to be a tricky thing to do sometimes. I just wonder if there is any good reference page for this problem. I found one page for the Tribal Trouble support page http://www.tribaltrouble.com/supportdriver?os=w (http://www.tribaltrouble.com/supportdriver?os=w) that seems very good but I don't want to simply steal this information.

If this kind of resource doesn't exist, I would like to create one myself (or with your help) that every LWJGL developer can link to. Is the wiki a good place for this perhaps?