LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: EgonOlsen on September 10, 2003, 23:56:55

Title: Keyboard on Win2K?
Post by: EgonOlsen on September 10, 2003, 23:56:55
Hi,

i'm in the process of porting jPCT's OpenGL-renderer to LWJGL0.7. It works fine so far, but i've a problem with Keyboard.create().
On my two WinXP machines, the demo-app runs fine but on the Win2K one, i can't create a Keyboard. It's always telling me that the Keyboard could not be created and that there is "no window", which is obviously not true (http://www.jpct.net/pics/keyboarderror.jpg). This happens in fullscreen as well as in windowed mode and it worked fine using LWJGL0.6.
Maybe i'm doing something wrong?

Edit: That's on an Athlon XP 2200+ running Win2K Pro SP4 and a Geforce4Ti
Title: Keyboard on Win2K?
Post by: elias on September 11, 2003, 07:49:47
This is a very weird bug, because the hwnd is checked for NULL in Window.create. One clarifying question though: you are not by any chance doing the creation of LWJGL stuff from different threads, are you? If not, can you assemble a minimal application that exhibit the same behaviour?

EDIT: And what's the output from the debug build of LWJGL?

- elias
Title: Keyboard on Win2K?
Post by: EgonOlsen on September 11, 2003, 15:29:46
Quote from: "elias"This is a very weird bug, because the hwnd is checked for NULL in Window.create. One clarifying question though: you are not by any chance doing the creation of LWJGL stuff from different threads, are you? If not, can you assemble a minimal application that exhibit the same behaviour?

EDIT: And what's the output from the debug build of LWJGL?

- elias
Here it is: http://www.jpct.net/stuff/KeyboardTest.java

When run under WinXP, everything is fine but under Win2K, the Window is created and the Keyboard create() keeps telling me "No window" and i get the exception.
Title: Keyboard on Win2K?
Post by: nala-naj on September 11, 2003, 15:39:31
I dont have a win2k box to try this on, but you might want to add a this line after you create your keyboard...

Keyboard.enableBuffer();
Title: Keyboard on Win2K?
Post by: elias on September 11, 2003, 15:56:04
That won't work, because the bug occurs in the Keyboard creation. Now, before I try to stomp up a 2k, can any of you guys out there run the apparantly correct test?

- elias
Title: Keyboard on Win2K?
Post by: nala-naj on September 11, 2003, 16:18:23
Quote from: "elias"That won't work, because the bug occurs in the Keyboard creation. Now, before I try to stomp up a 2k, can any of you guys out there run the apparantly correct test?

- elias

i just tried it on a win2k box, but the graphics card is a piece of crap and doesnt support opengl (it is a 4mb card on the board)... after it pucked it did give me the No window message.
Title: Keyboard on Win2K?
Post by: nala-naj on September 11, 2003, 16:29:02
btw - i can try it on a good win2k box in about an hour when i go home for lunch... if you can wait that long.  how do i turn on debugging in lwjgl in case i need more info?
Title: Keyboard on Win2K?
Post by: EgonOlsen on September 11, 2003, 16:43:59
Here the output when using the debug-dll:


Window registered
Created window
Pixel format is 5
No window
java.lang.Exception: The keyboard could not be created.
       at org.lwjgl.input.Keyboard.create(Unknown Source)
       at KeyboardTest.doStuff(KeyboardTest.java:18)
       at KeyboardTest.<init>(KeyboardTest.java:10)
       at KeyboardTest.main(KeyboardTest.java:6)
Delete GL context
Destroying directinput
Releasing DC
Destroy window
Destroyed window
Title: Keyboard on Win2K?
Post by: nala-naj on September 11, 2003, 17:09:54
i just tried running your program at home on my win2k box and it ran great... sorry.

its a dell 1.5 ghz, 256mb ram, and a 32mb ati rage 128 ultra card
win2k professional that is... dont know if there is a home version for that or not.
Title: Keyboard on Win2K?
Post by: EgonOlsen on September 11, 2003, 17:18:35
Quote from: "nala-naj"i just tried running your program at home on my win2k box and it ran great... sorry.
No need to be sorry that it worked for you... :wink:  Anyway, i also tried it under Win98SE (same machine, dual boot) and it worked there too. But i don't think that something is fishy with my 2k (there is no "home" version of 2k btw. Professional is the smallest) because the Keyboard-stuff worked fine using LWJGL0.6...so something seems to have changed to the worse with 0.7.
Title: Keyboard on Win2K?
Post by: elias on September 11, 2003, 18:15:19
I'd still like to see the debug output from the debug LWJGL build. Can you supply us with that?

- elias
Title: Keyboard on Win2K?
Post by: EgonOlsen on September 11, 2003, 18:24:13
Quote from: "elias"I'd still like to see the debug output from the debug LWJGL build. Can you supply us with that?
I posted the output from the debug-dll some posts above. I that what you mean, or can i do something to get more detailed output?
Title: Keyboard on Win2K?
Post by: elias on September 11, 2003, 20:15:01
Sorry about that, I must have ovrelooked it.

- elias
Title: Keyboard on Win2K?
Post by: elias on September 12, 2003, 16:07:42
Yet another look at the code tells me that the only way the hwnd can be null after a succesful Window.create() is destroy() or a buffer overrun. Interestingly, Cas' fix for the matrox cards was in fact a buffer overrun fix(*), so your bug may already be fixed.

So Cas, can you upload a CVS build for Egon to test? As an added bonus,  he gets to test the NT4 fix at his workplace :-)

(*) Are you not feeling lucky to use java when issues like that arise? I certainly am.

- elias
Title: Keyboard on Win2K?
Post by: princec on September 12, 2003, 17:55:09
LWJGL 0.71 alpha (http://www.puppygames.net/downloads/lwjgl0.71alpha.zip) just uploaded.

Cas :)
Title: Keyboard on Win2K?
Post by: EgonOlsen on September 13, 2003, 17:06:08
Thanx. I'll try it on monday, because i'm not at home during the weekend. I'll let you know if it fixes the problem.
Title: Keyboard on Win2K?
Post by: EgonOlsen on September 15, 2003, 15:34:39
OK, now it's monday and i downloaded and tested the 0.71alpha dlls and they don't help  :cry:  I get the same window-bug under 2K and it doesn't work with NT4 either (same messagebox as before appears).
I tried both, the normal and the debug-dll, and i double checked that i'm indeed using the dlls from the zip but nothing has changed at all.
Are you sure that the uploaded version really is 0.71a?
Title: Keyboard on Win2K?
Post by: princec on September 15, 2003, 15:58:26
Check the filesizes.

Cas :)
Title: Keyboard on Win2K?
Post by: elias on September 15, 2003, 15:59:09
That's very weird. Are you getting the NT messagebox even when you don't change the display mode?

- elias
Title: Keyboard on Win2K?
Post by: EgonOlsen on September 15, 2003, 16:05:37
Quote from: "princec"Check the filesizes.
They differ from the 0.7 release...lwjgl.dll is 188KB and lwjgl_d.dll ist 656KB...but what does this tell me?

Elias: What do you mean by 'don't change display mode'? All i'm trying to do is to open a LWJGL-window and it fails with the posted message-box. Do you mean if it happens in fullscreen only? If so, then no...it happens in both, windowed and fullscreen mode.
Title: Keyboard on Win2K?
Post by: elias on September 15, 2003, 16:11:30
Hmm, that tells me that the symbol resolver won't accept undefined symbols even though we won't ever call them. That makes it a lot harder to fix.

But apart from that your w2k bug is much worse - I don't know what's causing it.

Cas: Does the build actually work for Matrox users?

- elias
Title: Keyboard on Win2K?
Post by: EgonOlsen on September 15, 2003, 16:23:47
Quote from: "elias"But apart from that your w2k bug is much worse - I don't know what's causing it.
Anything else i can try/do?
BTW: I tested the app on my girlfriend's machine, which uses Win2K too (basically the same setup as mine) and it worked fine using 0.7 and 0.71a (is that good or bad... :wink: ).
Title: Keyboard on Win2K?
Post by: elias on September 15, 2003, 16:29:49
That's bad - we wan't reproducible bugs :-)

We'll probably find something else for you to test - stick around.

- elias
Title: Keyboard on Win2K?
Post by: elias on September 15, 2003, 16:34:29
Do you have any PM we can contact you through?

- elias
Title: Keyboard on Win2K?
Post by: EgonOlsen on September 15, 2003, 17:06:29
Quote from: "elias"Do you have any PM we can contact you through?
I've just installed ICQ and added the number to my profile. I don't have a clue how ICQ works though... :lol:
Title: Keyboard on Win2K?
Post by: princec on September 15, 2003, 17:11:58
Elias, we can fix that symbol resolution problem but it means we have to call GetProcAddress or whatever it was callled and get a pointer to the function. Pain in the arse but looks like it's necessary.

It doesn't yet work for Matrox users. Don't know why yet. It works in windowed mode for Matrox users but apparently you just get a black screen in fullscreen mode and no rendering. On Leknor's box at any rate.

Cas :)
Title: Keyboard on Win2K?
Post by: elias on September 15, 2003, 17:43:34
Yeah, we must add some dynamic linking code to support NT. I'll probably fix it tomorrow if Egon is available. Now, the real problem is the w2k bug... where I'm standing, only a buffer overflow can overwrite the hwnd with a null value, so how does one enable a bounds checker to the build? That would probably help a lot.

In the meantime: Egon, is the bug still showing if you create the Mouse instead of the keyboard?

- elias
Title: Keyboard on Win2K?
Post by: EgonOlsen on September 15, 2003, 18:00:26
Quote from: "elias"In the meantime: Egon, is the bug still showing if you create the Mouse instead of the keyboard?
Edit: Forget about it...seems like 0.71a does indeed fixes the Win2K-problem, but somehow the app mixed the lwjgl.dll in the dll-path with the one lying around in lib/ext (i wasn't aware of it...must have placed it there while tracking the keyboard-bug some days ago and forgot to remove it). After deleting the one in "ext", it works. I don't understand that though, because it told me that it couldn't find the lwjgl.dll if i haven't set the dll-path to the correct 0.71a. But when i did, it somehow grabbed the one in "ext" too... :?:
However, seems to work fine now. Now the NT4 problem remains and i can't help you there tomorrow, because NT4 is running on my machine at work only. I can't to anything more than testing a new version during a break or so.

Edit2: Re-checked this behaviour:

0.7 in the lib-path (-Djava.library.path=lib\lwjgl-0.7\) only makes *boom*
0.7 in "lib/ext" only gives me a "where's lwjgl?"-message
0.71a in the lib-path and 0.7 in "ext" makes *boom*
0.71a in lib-path while "ext" doesn't contain any lwjgl stuff works

What i don't get is, that 0.7 in "ext" alone doesn't seem to do be recognized but in addition to the 0.71a in the lib-path, it somehow is. Then again, renaming the lwjgl_d.dll in my lib-path to lwjgl.dll gives me debug-output but still crashes. How can this be, if he grabs the dll from ext...???
Then again, i don't know much about the way Windows handles DLL-stuff...
Title: Keyboard on Win2K?
Post by: princec on September 15, 2003, 18:09:16
Try running that with -ea and -Xcheck:jni as well.

Cas :)
Title: Keyboard on Win2K?
Post by: elias on September 15, 2003, 18:44:02
YES! I'd hate to debug that weird bug, so thank you very much Egon. The NT fix is, as we have stated before, much easier to fix. I'll probably fix it tomorrow, and then you can verify it at your own pace.

I'm not sure about that "ext" problem though. It's a little unnerving that you can't reliably override ext libs.

- elias