Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (495)
Games in Android Showcase (114)
games submitted by our members
Games in WIP (563)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Display.getDepth fix  (Read 1759 times)
0 Members and 1 Guest are viewing this topic.
Offline aldacron

Senior Member


Medals: 9
Exp: 16 years


Java games rock!


« Posted 2004-01-26 16:27:22 »

I saw a thread over at the puppygames forums realted to a problem with Display.getDepth. The poster stated he was getting odd return values. I've been bitten by this as well and I believe I've found the problem. It seems to be taking forever and a day to receive my account activation email from the forums there, so I'm posting here before I forget.

Line 253 of win32/org_lwjgl_Display.cpp:
bpp = GetDeviceCaps(screenDC, COLORRES);

The value returned from this call is used to initialize the initial display mode (desktop). Later, if a call to Display.getDepth is made, it is this value that is returned. Unfortunately, the call as it is does not retrieve the actual color depth of the desktop. Instead, it is getting the 'color resolution' of the device, which may not always be valid.

MSDN defines COLORRES as:
Quote

Actual color resolution of the device, in bits per pixel. This index is valid only if the device driver sets the RC_PALETTE bit in the RASTERCAPS index and is available only if the driver is compatible with 16-bit Windows.


When my desktop is set to 16 bpp, this call repeatedly returns 24 on a Geforce2MX 400. If I use this value in Window.create then LWJGL happily throws an Exception telling me that my application requires a greater color depth since pixelformat selection is, assumedly, returning 16 in the colorbits field.  The original poster has the same problem on one machine, but was getting 16 on another. Obviously, this is not the intended behavior.

The correct thing to do would be to change COLORRES to BITSPIXEL. This will return the current desktop color depth correctly, and is the value one would want to use when describing the pixel format in windowed mode.
Offline elias

Senior Member





« Reply #1 - Posted 2004-01-26 16:58:30 »

Seems reasonable, fixed in CVS.

- elias

Offline aldacron

Senior Member


Medals: 9
Exp: 16 years


Java games rock!


« Reply #2 - Posted 2004-01-26 17:05:14 »

I forgot to mention that I tested it locally and it does fix the issue.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #3 - Posted 2004-01-26 18:58:50 »

Quote
Seems reasonable, fixed in CVS.

- elias


Huh Huh Huh How Huh Huh Huh
Last time I played with SF CVS I got a
Quote
cvs update: warning: unrecognized response `FATAL ERROR: Network error: Connection refused
' from cvs server
cvs [update aborted]: end of file from server (consult above messages if any)

Angry

Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #4 - Posted 2004-01-26 20:29:28 »

back online - w00t  Shocked

Offline princec

JGO Kernel


Medals: 378
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #5 - Posted 2004-01-27 06:35:59 »

The account activation from our forums is probably because SpamAssassin or somesuch has blacklisted our server. We got hacked for a few hours last year and the result is the whole internet treats puppygames mail as spam forever more and there's nothing we can do about it :/

<edit>There, activated you directly.

Cas Smiley

Offline aldacron

Senior Member


Medals: 9
Exp: 16 years


Java games rock!


« Reply #6 - Posted 2004-01-27 09:21:56 »

thanks Smiley
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Dwinin (28 views)
2014-09-12 09:08:26

Norakomi (57 views)
2014-09-10 13:57:51

TehJavaDev (76 views)
2014-09-10 06:39:09

Tekkerue (38 views)
2014-09-09 02:24:56

mitcheeb (58 views)
2014-09-08 06:06:29

BurntPizza (45 views)
2014-09-07 01:13:42

Longarmx (29 views)
2014-09-07 01:12:14

Longarmx (35 views)
2014-09-07 01:11:22

Longarmx (35 views)
2014-09-07 01:10:19

mitcheeb (40 views)
2014-09-04 23:08:59
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!