Hi !
Featured games (85)
games approved by the League of Dukes
Games in Showcase (616)
Games in Android Showcase (173)
games submitted by our members
Games in WIP (659)
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 3333 times)
0 Members and 1 Guest are viewing this topic.
Offline Themroc

Junior Devvie

« 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 Spiffy Duke »

Medals: 568
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 Devvie

« 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 Devvie

« 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 Spiffy Duke »

Medals: 568
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.

Coldstream24 (18 views)
2015-09-03 00:41:28

Andrew_3ds (30 views)
2015-09-01 19:08:10

afikri (20 views)
2015-08-31 09:30:22

afikri (27 views)
2015-08-31 09:30:07

afikri (15 views)
2015-08-31 09:27:24

afikri (17 views)
2015-08-31 09:26:40

Roquen (32 views)
2015-08-29 11:30:54

GamerC4 (38 views)
2015-08-22 20:38:50

GamerC4 (36 views)
2015-08-22 20:37:18

GamerC4 (42 views)
2015-08-22 20:37:01
HotSpot Options
by Roquen
2015-08-29 11:33:11

Rendering resources
by Roquen
2015-08-17 12:42:29

Rendering resources
by Roquen
2015-08-17 09:36:56

Rendering resources
by Roquen
2015-08-13 07:40:51

Networking Resources
by Roquen
2015-08-13 07:40:43

List of Learning Resources
by gouessej
2015-07-09 11:29:36

How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30 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‑
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!