Stepping through display settings to find a valid pixel format

Ok, It's been a couple of weeks, and I finally got a chance to wrap up some stuff I am working on.  I have come to an area where I need some info from you all.  Here's a sample of what I am doing, and I'll post all of the classes and such here after I finish up documentation and I figure out valid values for some settings.



So, for example, the DepthStepper class allows statically coded values of 16, 24, and 32.



The SamplesStepper class allows all even values from 0 to 32



WidthStepper and HeightStepper classes allow what ever Display.getAvailableDisplayModes(); returns (the resolutionStepper class uses exact resolutions and really renders width and height useless)



FrequencyStepper pulls from returned modes as well (may need another class to join resolutions and frequencies)





But I have no idea where to get values for AlphaBits, StencilBits, and DepthBits.  Any advice here?



All of the above classes are extensions of a Stepper class that I've developed which is a class that allows counting through objects arbitrarily. (This will probably confuse everyone because it is hard for me to describe it, but you could create a class chain to count in a base 10 method, or base 16, then base 2 for the second digit and letters only for the 3rd digit, etc… any arbitrary method you can think of).  The stepper class is inspired by the Decorator Pattern.



Here's some teaser code intentionally using an invalid limit value for samples so we can see it step all the way through the options.  The setNextStepper call builds the chain and the order of stepping.

/** Create display using closest desired settings */              
               Stepper propDepth = new DepthStepper();
               propDepth.setStartValue( 32 );
               propDepth.setLimitStepValue( 16 );
              
               Stepper propSamples = new SamplesStepper();
               propSamples.setStartValue( 22 );
               propSamples.setLimitStepValue( 18 );
               propDepth.setNextStepper( propSamples );
              
               Stepper propResolution = new ResolutionStepper();
               propResolution.setStartValue( "1024x768" );
               propResolution.setLimitStepValue( "640x480" );
               propSamples.setNextStepper( propResolution );
              
               display.createWindow( propDepth );



And here's the output (shortened up the text length a bit for readability):

INFO: Trying: DepthStepper = 32; SamplesStepper = 22; ResolutionStepper = 1024x768;
INFO: Trying: DepthStepper = 24; SamplesStepper = 22; ResolutionStepper = 1024x768;
INFO: Trying: DepthStepper = 16; SamplesStepper = 22; ResolutionStepper = 1024x768;
INFO: Trying: DepthStepper = 32; SamplesStepper = 20; ResolutionStepper = 1024x768;
INFO: Trying: DepthStepper = 24; SamplesStepper = 20; ResolutionStepper = 1024x768;
INFO: Trying: DepthStepper = 16; SamplesStepper = 20; ResolutionStepper = 1024x768;
INFO: Trying: DepthStepper = 32; SamplesStepper = 18; ResolutionStepper = 1024x768;
INFO: Trying: DepthStepper = 24; SamplesStepper = 18; ResolutionStepper = 1024x768;
INFO: Trying: DepthStepper = 16; SamplesStepper = 18; ResolutionStepper = 1024x768;
INFO: Trying: DepthStepper = 32; SamplesStepper = 22; ResolutionStepper = 800x600;
INFO: Trying: DepthStepper = 24; SamplesStepper = 22; ResolutionStepper = 800x600;
INFO: Trying: DepthStepper = 16; SamplesStepper = 22; ResolutionStepper = 800x600;
INFO: Trying: DepthStepper = 32; SamplesStepper = 20; ResolutionStepper = 800x600;
INFO: Trying: DepthStepper = 24; SamplesStepper = 20; ResolutionStepper = 800x600;
INFO: Trying: DepthStepper = 16; SamplesStepper = 20; ResolutionStepper = 800x600;
INFO: Trying: DepthStepper = 32; SamplesStepper = 18; ResolutionStepper = 800x600;
INFO: Trying: DepthStepper = 24; SamplesStepper = 18; ResolutionStepper = 800x600;
INFO: Trying: DepthStepper = 16; SamplesStepper = 18; ResolutionStepper = 800x600;
INFO: Trying: DepthStepper = 32; SamplesStepper = 22; ResolutionStepper = 720x576;
INFO: Trying: DepthStepper = 24; SamplesStepper = 22; ResolutionStepper = 720x576;
INFO: Trying: DepthStepper = 16; SamplesStepper = 22; ResolutionStepper = 720x576;
INFO: Trying: DepthStepper = 32; SamplesStepper = 20; ResolutionStepper = 720x576;
INFO: Trying: DepthStepper = 24; SamplesStepper = 20; ResolutionStepper = 720x576;
INFO: Trying: DepthStepper = 16; SamplesStepper = 20; ResolutionStepper = 720x576;
INFO: Trying: DepthStepper = 32; SamplesStepper = 18; ResolutionStepper = 720x576;
INFO: Trying: DepthStepper = 24; SamplesStepper = 18; ResolutionStepper = 720x576;
INFO: Trying: DepthStepper = 16; SamplesStepper = 18; ResolutionStepper = 720x576;
INFO: Trying: DepthStepper = 32; SamplesStepper = 22; ResolutionStepper = 720x480;
INFO: Trying: DepthStepper = 24; SamplesStepper = 22; ResolutionStepper = 720x480;
INFO: Trying: DepthStepper = 16; SamplesStepper = 22; ResolutionStepper = 720x480;
INFO: Trying: DepthStepper = 32; SamplesStepper = 20; ResolutionStepper = 720x480;
INFO: Trying: DepthStepper = 24; SamplesStepper = 20; ResolutionStepper = 720x480;
INFO: Trying: DepthStepper = 16; SamplesStepper = 20; ResolutionStepper = 720x480;
INFO: Trying: DepthStepper = 32; SamplesStepper = 18; ResolutionStepper = 720x480;
INFO: Trying: DepthStepper = 24; SamplesStepper = 18; ResolutionStepper = 720x480;
INFO: Trying: DepthStepper = 16; SamplesStepper = 18; ResolutionStepper = 720x480;
INFO: Trying: DepthStepper = 32; SamplesStepper = 22; ResolutionStepper = 640x480;
INFO: Trying: DepthStepper = 24; SamplesStepper = 22; ResolutionStepper = 640x480;
INFO: Trying: DepthStepper = 16; SamplesStepper = 22; ResolutionStepper = 640x480;
INFO: Trying: DepthStepper = 32; SamplesStepper = 20; ResolutionStepper = 640x480;
INFO: Trying: DepthStepper = 24; SamplesStepper = 20; ResolutionStepper = 640x480;
INFO: Trying: DepthStepper = 16; SamplesStepper = 20; ResolutionStepper = 640x480;
INFO: Trying: DepthStepper = 32; SamplesStepper = 18; ResolutionStepper = 640x480;
INFO: Trying: DepthStepper = 24; SamplesStepper = 18; ResolutionStepper = 640x480;
INFO: Trying: DepthStepper = 16; SamplesStepper = 18; ResolutionStepper = 640x480;
SEVERE: Could not create displaySystem com.jme.system.JmeException: Stepper ran out of options



So, I just need to know where to get AlphaBits, StencilBits, and DepthBits values, and I'll post all of the code after implementing that

Is there any interest in adding this to JME?  I got a new MAC (yay, no more windows!) and I have yet to get things up and running on it to continue development.  If it is not something that we want to add to JME, I will encapsulate and compile it into its own library and offer it separately from JME.  If we want to add it to JME, then I will post the source here and let you all fill in the sections that are needed still (or we can wait until I get around to setting up the Mac, but I will still need need to know what valid values are for AlphaBits, StencilBits, and DepthBits).


This will probably confuse everyone


Let me be the first to admit it.. it confused me  ://

Hehe.  Are you confused about what the purpose of these classes are, or just my attempt at explaining what I mean by arbitrary counting.



I can easily clarify what the classes do I think if thats the issue.

Has anyone been able to find out yet how one can programatically determine a system's accepted values for either AlphaBits, StencilBits, or DepthBits?



Or should I just stick with a base number that will be available on most all systems?  In various examples I've seen StencilBits set to 4…  Is that the norm, or the minimum value needed for rendering shadows and such?

:mrgreen:



Thanks.


Very good job, it will be very usefull, I hope you release it soon.