Java-Gaming.org Hi !
Featured games (81)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (576)
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  
  Someone explain me DisplayMode in lwjgl...  (Read 3043 times)
0 Members and 1 Guest are viewing this topic.
Offline Themroc

Junior Duke





« Posted 2003-02-06 15:36:07 »

OK, I used the simple code from the Nehe-examples for screen mode selection so far (running in a loop until correct mode for width, height, bpp has been found), that worked so far.

Now today I programmed an DisplayModeRequester, so the user can choose the DisplayMode. What was odd that there were multiple modes for each resolution/bpp/frequency, they had different depth/alpha/stencil.

Now I selected a few of them and every mode with alpha>0 made my program crash immediately ("error in native code outside vm"). So I'm thinking about filtering all these modes out and only offer the user modes with alpha and stencil zero.

Will that give me any problems? What is a mode with alpha>0 good for anyway (I'm using alpha already for masking and it works in a mode with alpha=0). Why are there modes with different depths for same bpp?
Someone enlighten me ...

I'm using a Geforce2/WinXp, if that makes a difference.
Offline princec

JGO Kernel


Medals: 404
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #1 - Posted 2003-02-06 16:28:21 »

Because of inconsistencies in the way different windowing systems handle the initialization of GL, and the relative difficulty in finding out which modes are valid given a fairly patchy API, we "manufacture" all the combinations of alpha, depth, and stencil for each actual display resolution/frequency/bpp.

You shouldn't crash if you select a mode with alpha=8 on Nvidia hardware; can you post the whole error up so we can have a look at it.

Alpha is used for some Very Special Effects. That ol' terrain demo which used to be kicking about these parts used the alpha buffer to store intermediate results for per-pixel lighting operations (and did subsequent passes with GL_DST_ALPHA and GL_ONE_MINUS_DST_ALPHA in glBlendFunc). It can be used for a lot of other clever things too but a lot of this is falling by the wayside as multi-pass rendering techniques slowly give way to fragment programs.

Cas Smiley

Offline Themroc

Junior Duke





« Reply #2 - Posted 2003-02-06 16:43:08 »

That sounds reasonable. What is the depth parameter good for?

I hope I can post the complete error tomorrow (it's on my machine at home)

Does anybody know about a site with collected info about the capabililties of the different chips and OpenGL implementations?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline EgonOlsen
« Reply #3 - Posted 2003-02-06 19:55:37 »

Is it ok to assume that at least a mode with alpha and stencil=0 is available on "normal" hardware? I don't need them at the moment, so i would like to ignore them by always choosing a A=0/S=0 mode.

Offline Themroc

Junior Duke





« Reply #4 - Posted 2003-02-07 06:57:11 »

Ther error was my fault, I could have avoided it with proper checking:

I now tested again and found the error. The error was not in opening the display, but when I tried to use "gl.wglSwapIntervalEXT(0);".
The reason seems to be that whenever I request a DisplayMode with more than 0bit alpha the Nvidia renderer is replaced with the GDI renderer of Windows (and is then horribly slow). That renderer does not support wglSwapControl.

No alpha gives:
"Renderer=GeForce2 GTS/AGP/SSE/3DNOW!"
8bit alpha gives:
"Renderer=GDI Generic"

Well, I now used a  "if (GL.WGL_EXT_swap_control){...}" check around the wglSwapControl and that works.
Offline princec

JGO Kernel


Medals: 404
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #5 - Posted 2003-02-07 09:36:14 »

Your GF2 *does* support alpha but there's only a certain combination of depth & colour & alpha that it actually supports. I forget which exactly but I'm certain that you should ask for 32 BPP.

And you should never, ever assume anything - you have to know. Unfortunately the only way of testing right now is to try each mode in turn and check you haven't ended up with a software mode. What I do get all the display modes, filter out the ones that don't meet my minimum and maximum criteria, and then sort them in ascending and descending order on each criteria, to get a list of display modes with my preferred modes at the top. Then I cycle through them until one of them doesn't throw an Exception. I'm not checking for software mode yet which I will be doing soon but I need a cross-platform way to check this.

Cas 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.

Longarmx (41 views)
2014-10-17 03:59:02

Norakomi (33 views)
2014-10-16 15:22:06

Norakomi (26 views)
2014-10-16 15:20:20

lcass (30 views)
2014-10-15 16:18:58

TehJavaDev (59 views)
2014-10-14 00:39:48

TehJavaDev (60 views)
2014-10-14 00:35:47

TehJavaDev (50 views)
2014-10-14 00:32:37

BurntPizza (66 views)
2014-10-11 23:24:42

BurntPizza (38 views)
2014-10-11 23:10:45

BurntPizza (80 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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
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!