LWJGL Forum

Programming => OpenGL => Topic started by: Spezi on October 03, 2006, 13:03:47

Title: Problems with 2nd monitor activated
Post by: Spezi on October 03, 2006, 13:03:47
If I run our game with a 2nd monitor enabled the background texture is not loaded and i get the following message with
"-Dorg.lwjgl.util.Debug=true":

Could not locate symbol wglGetExtensionsStringARB
Could not locate symbol wglGetExtensionsStringEXT


Is there any way to fix this or at least to check if more than one monitor is active?
Title: Problems with 2nd monitor activated
Post by: Matzon on October 03, 2006, 13:40:34
err - I have three monitors, and no issues.
Are you sure you didn't change primary monitor and have two graphics cards in the computer ?
Title: Problems with 2nd monitor activated
Post by: Spezi on October 03, 2006, 15:36:31
Quote from: "Matzon"Are you sure you didn't change primary monitor and have two graphics cards in the computer ?

I didn't change anything, just a primary and a secondary (not cloned) monitor. Both connected to one graphics card (ATI Radeon x700 Pro for PCI Express).
Title: Problems with 2nd monitor activated
Post by: Spezi on October 04, 2006, 21:10:04
I have the same problem on another PC with 2 monitors.
Same settings (both monitors plugged into one graphics card and primary+secondary monitor) but this time with a ATI 9600 Pro All-In-Wonder.

Maybe this is only with ATI cards/drivers?

So if this can't be fixed, is there any way to check how many monitors are currently active so I can prompt the user to disable the other ones?
Title: Re: Problems with 2nd monitor activated
Post by: elias on October 04, 2006, 21:32:16
Quote from: "Spezi"
Could not locate symbol wglGetExtensionsStringARB
Could not locate symbol wglGetExtensionsStringEXT


Those are a bit odd. Could you post the various GL info strings (GL_RENDERER, GL_VENDOR, GL_VERSION)?

- elias
Title: Problems with 2nd monitor activated
Post by: Spezi on October 04, 2006, 22:27:38
Quote from: "elias"Could you post the various GL info strings (GL_RENDERER, GL_VENDOR, GL_VERSION)?

Hmm interesting, from the PC mentioned in the 3rd post i got...

with 1 monitor:GL_VENDOR: ATI Technologies Inc.  
GL_RENDERER: RADEON X700 PRO x86/SSE2
GL_VERSION: 2.0.6012 WinXP Release


with 2 monitors:GL_VENDOR: Microsoft Corporation
GL_RENDERER: GDI Generic
GL_VERSION: 1.1.0


What can I do?
Title: Problems with 2nd monitor activated
Post by: Matzon on October 05, 2006, 05:29:13
make sure the ati one is the primary?
Title: Problems with 2nd monitor activated
Post by: elias on October 05, 2006, 06:20:53
Hmm, odd. Have you set the org.lwjgl.opengl.Display.allowSoftwareOpenGL flag?

- elias
Title: Problems with 2nd monitor activated
Post by: Matzon on October 05, 2006, 06:34:44
well, in this case he'd just end up creating the display on the generic display and get software eumlation.

I just dont get why this is happening, unless the display is being created on the secondary display, which would be odd.
Title: Problems with 2nd monitor activated
Post by: Spezi on October 05, 2006, 08:02:57
Quote from: "Matzon"make sure the ati one is the primary?
How do you mean that? There's only the ATI one.

Quote from: "elias"Have you set the org.lwjgl.opengl.Display.allowSoftwareOpenGL flag?
Yes, it's set. I removed it but the problem remains.
I thought software mode will only be used if no hardware mode is available.

Quote from: "Matzon"I just dont get why this is happening, unless the display is being created on the secondary display, which would be odd.
The game is shown on the primary monitor as usual.
Title: Problems with 2nd monitor activated
Post by: Spezi on October 05, 2006, 08:23:33
The game runs in 1280x1024.

Now a bit loose thinking:
Maybe a small part of the game window is shown on the second monitor (which is placed right to the primary one).
So I scaled it down a little to 1278x1022 and it runs fine now apart from the missing pixels on every side.
1279x1023, 1279x1022 or 1278x1023 don't work.

I can't keep it in this size since it runs in windowed mode (using AWTGLCanvas) and if it's not filling this resolution the Windows Taskbar is shown and overlapping a part of the window.
Title: hmmmmmm...
Post by: Fool Running on October 05, 2006, 13:27:19
QuoteMaybe a small part of the game window is shown on the second monitor (which is placed right to the primary one).
Can you see part of the game window on the second monitor?
QuoteI can't keep it in this size since it runs in windowed mode (using AWTGLCanvas) and if it's not filling this resolution the Windows Taskbar is shown and overlapping a part of the window.
Is there a reason you have to run in windowed mode? You seem to be trying to make it as big as the screen anyways...
Is it possible its a Java-LWJGL interaction problem when the AWTGLCanvas is the same size/bigger than the screen?
Title: Re: hmmmmmm...
Post by: Spezi on October 05, 2006, 13:57:47
Quote from: "Fool Running"
Quote from: "Spezi"Maybe a small part of the game window is shown on the second monitor (which is placed right to the primary one).
Can you see part of the game window on the second monitor?
No. As I wrote, with 1278x1022 there is one pixel missing on every side, so there cannot be something on the other screen with 1280x1024.
Quote from: "Fool Running"
Quote from: "Spezi"I can't keep it in this size since it runs in windowed mode (using AWTGLCanvas) and if it's not filling this resolution the Windows Taskbar is shown and overlapping a part of the window.
Is there a reason you have to run in windowed mode? You seem to be trying to make it as big as the screen anyways...
If it would be possible to change to fullscreen I would do that but I don't know how.
Title: hmmmmmmm...
Post by: Fool Running on October 05, 2006, 16:07:50
QuoteIf it would be possible to change to fullscreen I would do that but I don't know how.
Sorry :oops: , I guess my question should have been: "Is there a reason you have to use an AWTGLCanvas?"If you want your entire OpenGL window to fill the screen, you should just use the built in display handing in LWJGL (i.e. set fullscreen on the display with setFullscreen()) and don't use an AWTGLCanvas.

If you need to use a AWTGLCanvas, then I think you are right... there is no way to go fullscreen in Java. You have to make a window as big as the screen... :cry:

Anyone else have any ideas? :lol:
Title: Re: hmmmmmmm...
Post by: Spezi on October 05, 2006, 19:13:12
Quote from: "Fool Running"
Quote from: "Spezi"If it would be possible to change to fullscreen I would do that but I don't know how.
Sorry :oops: , I guess my question should have been: "Is there a reason you have to use an AWTGLCanvas?"If you want your entire OpenGL window to fill the screen, you should just use the built in display handing in LWJGL (i.e. set fullscreen on the display with setFullscreen()) and don't use an AWTGLCanvas.
Right, I used LWJGL's Display before I needed to play Quicktime movies within the game, so I changed everything to AWTGLCanvas and lost the chance to switch to real fullscreen.

But my problem is still not solved. :cry:
Title: Problems with 2nd monitor activated
Post by: Matzon on October 05, 2006, 19:51:56
so to test, do you still get the issue if you create a 640x480 AWTGLCanvas ?
Title: Problems with 2nd monitor activated
Post by: Spezi on October 05, 2006, 20:06:19
Quote from: "Matzon"so to test, do you still get the issue if you create a 640x480 AWTGLCanvas ?
No, runs fine.
Title: Problems with 2nd monitor activated
Post by: Matzon on October 05, 2006, 21:04:30
k, so something must be messing up when you "approach" the secondary monitor.
I'm not sure what we can do to prevent that ?
Title: Problems with 2nd monitor activated
Post by: elias on October 06, 2006, 08:06:48
Are you using the built in java2d fullscreen feature in GraphicsDevice?

- elias
Title: Problems with 2nd monitor activated
Post by: Spezi on October 06, 2006, 08:24:59
Quote from: "elias"Are you using the built in java2d fullscreen feature in GraphicsDevice?
Never heard of that, how can I check it?
Title: Problems with 2nd monitor activated
Post by: elias on October 06, 2006, 08:34:54
Take a loot at GraphicsDevice.setFullscreenWindow() in the javadocs. Or search for a fullscreen java2d sample to use. It should work with a Window or Frame with an AWTGLCanvas inside, but I haven't actually tried it :)

- elias
Title: Problems with 2nd monitor activated
Post by: Spezi on October 06, 2006, 08:56:54
Hmm no, this unfortunately also doesn't solve the problem.
Title: Problems with 2nd monitor activated
Post by: Spezi on October 09, 2006, 17:24:06
Is there any chance that this issue can be solved in the next 2 days?
Else I have to implement some user request to disable any additional monitors.
Title: Problems with 2nd monitor activated
Post by: Matzon on October 09, 2006, 17:44:49
Could you make the smallest testcase possible, then we might have a chance of figuring out whats going on?
I guess its because that you're approaching the other monitor - but I have no clue really.
Title: Problems with 2nd monitor activated
Post by: Spezi on October 09, 2006, 23:01:16
Quote from: "Matzon"Could you make the smallest testcase possible, then we might have a chance of figuring out whats going on?

There is a small version of the game wrapping: http://mitglied.lycos.de/spezi/

This is meant for a resolution of 1280x1024.

With just one active monitor this should give a blue screen, with more than one the blue background texture will not be shown and the background is white.

If I comment MainWindow:14-15 and uncomment MainWindow:16-17 the blue screen is visible in both situations, but with small borders around the window and the taskbar overlapping it.

I maybe found the problem but don't know how to fix it:
With the original width and height values comment MainWindow:42-43.
Then it also works in both situations as it should. But this imagePanel is used to display a simple image as loading screen, thus is needed.
Title: Problems with 2nd monitor activated
Post by: Matzon on October 11, 2006, 08:37:06
I'm not sure whats going on here - however I have a small workaround for you:
In you MainWindow, if you comment out one of these lines, it all works:
gameWindow.setBounds(-1, -1, 1, 1); // Spielefenster verstecken

add(imagePanel);
Title: Problems with 2nd monitor activated
Post by: elias on October 11, 2006, 14:09:06
Ok, I fixed a bug that could cause LWJGL to confuse pixel formats and allow the GDI renderer even though only accelerated formats should be used. The fix won't help you much though, since all it does is properly detect GDI and throw an exception on the first paintGL().

I believe the real problem is caused by the fact that you set the AWTGLCanvas position outside any screen coordinates (the gameWindow.setLocation(-1, -1, 1, 1) part). You'll need to find some other way to overlay AWT stuff, I'm afraid.

- elias
Title: Problems with 2nd monitor activated
Post by: Evil-Devil on October 11, 2006, 14:53:48
THe Canvas can be overlayed with any heavyweight AWT Widget. To overlay it with any lowweight Swing Widget you have to set the Swing Widget to Heavy Weight.

JPopupMenu.setDefaultLightWeightPopupEnabled(false);    // disable leightweight
// any widget defined within these two lines will be heavyweight and overlay the awtglcanvas
// thats extremly usefull for menus :)
JPopupMenu.setDefaultLightWeightPopupEnabled(true);     // enable leightweight
Title: Problems with 2nd monitor activated
Post by: Spezi on October 12, 2006, 15:39:37
Quote from: "Matzon"I'm not sure whats going on here - however I have a small workaround for you:
In you MainWindow, if you comment out one of these lines, it all works:
gameWindow.setBounds(-1, -1, 1, 1); // Spielefenster verstecken
add(imagePanel);

Oh well, after disabling the first one, everything's fine now. I don't know why this line was still in there, but I really appreciate your suggestion.
Sometimes a second sight just works wonders. :wink: Thank you for this one.