LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: Swackhammer1 on December 12, 2006, 05:21:49

Title: Could not make context current (beta 4)
Post by: Swackhammer1 on December 12, 2006, 05:21:49
Hi,
I just installed the latest version of lwjgl and tried to run the command given in the installation instructions and got the following on my screen (along with a box that kept fading in and out)


C:\lwjgl-1.0beta4>java -cp .;res;jar\lwjgl.jar;jar\lwjgl_test.jar;jar\lwjgl_util
.jar;jar\lwjgl_fmod3.jar;jar\lwjgl_devil.jar;jar\jinput.jar; -Djava.library.path
=native\win32 org.lwjgl.test.WindowCreationTest
The following keys are available:
ESCAPE:         Exit test
ARROW Keys:     Move window when in non-fullscreen mode
L:              List selectable display modes
0-8:            Selection of display modes
F:              Toggle fullscreen
SHIFT-F:        Toggle fullscreen with Display.destroy()/create() cycle
Found 32 display modes
Problem retrieving mode with 640x480x24@75
Problem retrieving mode with 640x480x32@75
Problem retrieving mode with 800x600x24@75
Problem retrieving mode with 800x600x32@75
Problem retrieving mode with 1024x768x24@75
Problem retrieving mode with 1024x768x32@75
[0]: 640 x 480 x 16 @60Hz
[1]: null
[2]: null
[3]: 800 x 600 x 16 @60Hz
[4]: null
[5]: null
[6]: 1024 x 768 x 16 @60Hz
[7]: null
[8]: null
[9]: null






Then I pressed 'F' to get into Fullscreen mode and got the following error:





org.lwjgl.LWJGLException: Could not make context current
        at org.lwjgl.opengl.WindowsContextImplementation.nMakeCurrent(Native Met
hod)
        at org.lwjgl.opengl.WindowsContextImplementation.makeCurrent(WindowsCont
extImplementation.java:85)
        at org.lwjgl.opengl.Context.makeCurrent(Context.java:193)
        at org.lwjgl.opengl.Display.makeCurrent(Display.java:626)
        at org.lwjgl.opengl.Display.setFullscreen(Display.java:466)
        at org.lwjgl.test.WindowCreationTest.handleInput(WindowCreationTest.java
:228)
        at org.lwjgl.test.WindowCreationTest.execute(WindowCreationTest.java:128
)
        at org.lwjgl.test.WindowCreationTest.main(WindowCreationTest.java:285)
Exception in thread "main" java.lang.NullPointerException
        at org.lwjgl.opengl.GL11.glClearColor(GL11.java:562)
        at org.lwjgl.test.WindowCreationTest.render(WindowCreationTest.java:254)

        at org.lwjgl.test.WindowCreationTest.execute(WindowCreationTest.java:131
)
        at org.lwjgl.test.WindowCreationTest.main(WindowCreationTest.java:285)




I'm using a Dell Inspiron 9400 with Windows XP SP2 and a Nvidia 7800 graphics card. My resolution is set to 1920 x 1200. (If you need that info)
Title: Re: Could not make context current (beta 4)
Post by: Matzon on December 12, 2006, 05:58:12
Do you have your drivers installed ???
Title: Re: Could not make context current (beta 4)
Post by: Swackhammer1 on December 12, 2006, 06:06:00
My video card drivers? Yes, they're installed.
I've run OpenGL programs on my machine before albeit using C++ and OpenGL directly.
Title: Re: Could not make context current (beta 4)
Post by: Matzon on December 12, 2006, 11:55:53
wonder if it's a screen resolution thing?
can you try and append -Dorg.lwjgl.util.Debug=true ?
Title: Re: Could not make context current (beta 4)
Post by: Swackhammer1 on December 12, 2006, 13:46:55
Well, I ran the command again, and this time I pressed 'F' right after it started. It went to Fullscreen mode without any problems.
I ran it a third time, repeating the steps I did the first time, i.e., pressing L to list all the modes then pressing '0' for 640 x 480 then pressing '3' for 800 x 600, pressing '6' for 1024 x 768 and finally pressing 'F' for Fullscreen mode and once again I got:

org.lwjgl.LWJGLException: Could not make context current
        at org.lwjgl.opengl.WindowsContextImplementation.nMakeCurrent(Native Met
hod)
        at org.lwjgl.opengl.WindowsContextImplementation.makeCurrent(WindowsCont
extImplementation.java:85)
        at org.lwjgl.opengl.Context.makeCurrent(Context.java:193)
        at org.lwjgl.opengl.Display.makeCurrent(Display.java:626)
        at org.lwjgl.opengl.Display.setFullscreen(Display.java:466)
        at org.lwjgl.test.WindowCreationTest.handleInput(WindowCreationTest.java
:228)
        at org.lwjgl.test.WindowCreationTest.execute(WindowCreationTest.java:128
)
        at org.lwjgl.test.WindowCreationTest.main(WindowCreationTest.java:285)
Exception in thread "main" java.lang.NullPointerException
        at org.lwjgl.opengl.GL11.glClearColor(GL11.java:562)
        at org.lwjgl.test.WindowCreationTest.render(WindowCreationTest.java:254)

        at org.lwjgl.test.WindowCreationTest.execute(WindowCreationTest.java:131
)
        at org.lwjgl.test.WindowCreationTest.main(WindowCreationTest.java:285)


btw, this was with the debug command added in.

And when I press 'L' only 0,3,6 are available modes (the ones I stated above). All others are 'null'. The available modes are    x16 @60Hz. My video setting are set to 32 bit color.
Title: Re: Could not make context current (beta 4)
Post by: Matzon on December 13, 2006, 11:38:10
might be a 16 bit vs 32 bit thing
not sure it's an lwjgl bug - probably more a bug in the test for not handling inability to set fullscreen.
Title: Re: Could not make context current (beta 4)
Post by: Swackhammer1 on December 13, 2006, 17:31:01
so does that mean that lwjgl will run fine on my machine the way it is currently set? Or will I have to change something?
Title: Re: Could not make context current (beta 4)
Post by: paco on December 13, 2006, 20:58:39
Hi

I have a similar error when trying to initialize 1024x768 24bits:


org.lwjgl.LWJGLException: Could not find a valid pixel format
        at org.lwjgl.opengl.WindowsPeerInfo.nChoosePixelFormat(Native Method)
        at org.lwjgl.opengl.WindowsPeerInfo.choosePixelFormat(WindowsPeerInfo.ja
va:52)
        at org.lwjgl.opengl.WindowsDisplayPeerInfo.<init>(WindowsDisplayPeerInfo
.java:50)
        at org.lwjgl.opengl.WindowsDisplay.createPeerInfo(WindowsDisplay.java:28
8)
        at org.lwjgl.opengl.Display.create(Display.java:681)
        at org.lwjgl.opengl.Display.create(Display.java:657)
        at org.lwjgl.opengl.Display.create(Display.java:641)
        at com.golden.gamedev.engine.lwjgl.LWJGLMode.d(Unknown Source)
        at com.golden.gamedev.engine.lwjgl.LWJGLMode.<init>(Unknown Source)
        at com.golden.gamedev.OpenGLGameLoader.setupLWJGL(Unknown Source)
        at com.golden.gamedev.OpenGLGameLoader.setupLWJGL(Unknown Source)
        at com.pepasoft.ranaremake.Ranaremake.main(Ranaremake.java:117)
java.lang.RuntimeException: LWJGL Error: Unable to initialize display
        at com.golden.gamedev.engine.lwjgl.LWJGLMode.d(Unknown Source)
        at com.golden.gamedev.engine.lwjgl.LWJGLMode.<init>(Unknown Source)
        at com.golden.gamedev.OpenGLGameLoader.setupLWJGL(Unknown Source)
        at com.golden.gamedev.OpenGLGameLoader.setupLWJGL(Unknown Source)
        at com.pepasoft.ranaremake.Ranaremake.main(Ranaremake.java:117)


But the program runs very well on other machines and the graphic card drivers are installed. This is a WindowsXP SP2 machine. I have noticed of this issue in a set of machines with the same configurations and only is present in a subset of them.

Is this a problem of the machine or of my code?

I have another issue but I'm very surprised with it, look at the images, I only find this issue in one machine:

http://www.mediafire.com/?byywydxjowy (http://www.mediafire.com/?byywydxjowy)

http://www.mediafire.com/?connnn4zyig (http://www.mediafire.com/?connnn4zyig)

The configuration of this machine is:


Intel(R) Graphics Media Accelerator Driver Report


Report Date: 12/13/2006
Report Time[hr:mm:ss]: 10:37:21
Driver Version: 6.14.10.4363
Operating System: Windows XP* Professional, Service Pack 2 (5.1.2600)
Default Language: Spanish
DirectX* Version: 9.0
Physical Memory: 1015 MB
Minimum Graphics Memory: 8 MB
Maximum Graphics Memory: 224 MB
Graphics Memory in Use: 11 MB
Processor: x86
Processor Speed: 2926 MHZ
Vendor ID: 8086
Device ID: 2772
Device Revision: 02


*   Accelerator Information   *

Accelerator in Use: Intel(R) 82945G Express Chipset Family
Video BIOS: 1224
Current Graphics Mode: 1280 x 1024 True Color (60 Hz)



*   Devices Connected to the Graphics Accelerator   *


Active Monitors: 1


*   Monitor   *

Monitor Name: Monitor Plug and Play
Display Type: Analog
Gamma Value: 2,20
DDC2 Protocol: Supported
Maximum Image Size: Horizontal: 13,3 inches
Vertical:   10,6 inches
Monitor Supported Modes:
640 x 480 (60 Hz)
640 x 480 (75 Hz)
640 x 480 (75 Hz)
720 x 400 (70 Hz)
800 x 600 (60 Hz)
800 x 600 (75 Hz)
800 x 600 (75 Hz)
832 x 624 (75 Hz)
1024 x 768 (60 Hz)
1024 x 768 (75 Hz)
1024 x 768 (75 Hz)
1152 x 870 (75 Hz)
1280 x 1024 (60 Hz)
1280 x 1024 (75 Hz)
Display Power Management Support:
Standby Mode: Supported
Suspend Mode: Supported
Active Off Mode: Supported


Do you know what may be happen?

Thanks in advance.
Paco.
Title: Re: Could not make context current (beta 4)
Post by: Fool Running on December 13, 2006, 21:25:00
Quoteso does that mean that lwjgl will run fine on my machine the way it is currently set? Or will I have to change something?
Could you print out the results from Display.getAvailableDisplayModes()? It looks like your card only supports 16bit color and the test is looking for 24 or 32 bit colors. So it should work fine if you just select 16 bit colors (just a guess :) )

QuoteI have a similar error when trying to initialize 1024x768 24bits
My guess is that the display modes are listed as 32bits instead of 24bits.
QuoteI have another issue but I'm very surprised with it, look at the images, I only find this issue in one machine
Looks like a Unicode normalization issue, or a font issue... Does the the machine have the font you used? I would be surprised if it was a Unicode normalization issue, but that is what it looks like. I'm not sure how to normalize characters in Java, unfortunately. :( Non-English characters can be nasty sometimes ;D
Title: Re: Could not make context current (beta 4)
Post by: Swackhammer1 on December 13, 2006, 21:38:32
My card does support 32 bit colors. That's why that was the default setting. Regarding the Display.getAvailableDisplayModes() could you tell me exactly what to do since this is the first time I'm using lwjgl.
Thanks.
Title: Re: Could not make context current (beta 4)
Post by: paco on December 14, 2006, 14:31:56
I noticed that the "color tinting" issue and transparency occurs only in machines with Intel Graphics cards. It's very curious! The font is bitmap font, so no normalized font nor unicode transform ;-) The images show the tinted images in black and red (they are full color) issue.

I'll check the "getAvailableDisplay" ;-) and I will back with the results ;-)

Thanks very much.

Paco.