Quantcast

requested graphics configuration

classic Classic list List threaded Threaded
24 messages Options
12
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

requested graphics configuration

runiter
I found -Dnewt.debug="all" -Djogl.debug="all" -Dnativewindow.debug="all" -Dsun.java2d.noddraw=true very useful.

I noticed that given the following in Ardor3D:

new DisplaySettings(400, 300, 32, 0, 0, 32, 0, 4, false, false)

Jogl generates the following:

requested GLCaps[rgba 0x8/8/8/1, opaque, accum-rgba 0/0/0/0, dp/st/ms: 32/0/4, sample-ext default, dbl, mono  , hw, GLProfile[GL3bc/GL3bc.hw], on-scr[.]],

chosen    GLCaps[wgl vid 0x13 arb: rgba 0x8/8/8/0, opaque, accum-rgba 16/16/16/16, dp/st/ms: 24/0/2, sample-ext default, dbl, mono  , hw, GLProfile[GL3bc/GL3bc.hw], on-scr[.]]]]],


As for the requested part, how does 32bit color buffer bits translates to rgba 8/8/8/1?
As for the chosen part, why did it chose 2 sampling size instead of the 4 which was requested! I have a 3 year old nvidia card in my laptop so I figured it would support 4 sampling easily!
Saeid Nourian, Ph.D. Eng. | Graphing Calculator 3D
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: requested graphics configuration

gouessej
Administrator
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: requested graphics configuration

runiter
Thanks, DefaultGLCapabilitiesChooser answers most of my questions.
But I still don't understand why asking for colorbit of 32 translates to request of rgba 8/8/8/1. Shouldn't it be 32/32/32/32? Can you explain this please?
Saeid Nourian, Ph.D. Eng. | Graphing Calculator 3D
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: requested graphics configuration

gouessej
Administrator
You can look at the source code, maybe some criteria are not mentioned in the documentation.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: requested graphics configuration

runiter
okay, this what I found out by looking at ardor3d and jogl code.

The only reference to DisplaySettings.getColorDepth() occurs at the following method:

JoglCanvas.privateInit()

But the above method is never called if your use JoglAwtCanvas. So basically in my swing applications my preferred ColorDepth settings seem to be completely ignored by Jogl. Is this a bug or is it by design?

Saeid Nourian, Ph.D. Eng. | Graphing Calculator 3D
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: requested graphics configuration

gouessej
Administrator
runiter wrote
The only reference to DisplaySettings.getColorDepth() occurs at the following method:

JoglCanvas.privateInit()

But the above method is never called if your use JoglAwtCanvas. So basically in my swing applications my preferred ColorDepth settings seem to be completely ignored by Jogl. Is this a bug or is it by design?
It's called in CapsUtil.getCapsForSettings() but if you want to set the depth bits of the z buffer, rather use the parameter "_depthBits" (as you already do).
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: requested graphics configuration

runiter
I don't see it there. If you look at the CapsUtil.getCapsForSettings() below you will notice that settings.getColorDepth() is used to check to ensure it is one of 16, 24 or 32 values. But other than that nothing happens here. Its value is never passed to GLCapabilities.

I noticed that GLCapabilities doesn't have setColotDepth() method, but it does have setRedBits(), setGreenBits() and setBlueBits() methods. However those 3 setter methods are never called. Why?

p.s. don't confuse "ColorDepthBits" with z-buffer "DepthBits". I'm only talking about ColorDepthBits here.


    public static GLCapabilities getCapsForSettings(final DisplaySettings settings) {

        // Validate window dimensions.
        if (settings.getWidth() <= 0 || settings.getHeight() <= 0) {
            throw new Ardor3dException("Invalid resolution values: " + settings.getWidth() + " " + settings.getHeight());
        }

        // Validate bit depth.
        if ((settings.getColorDepth() != 32) && (settings.getColorDepth() != 16) && (settings.getColorDepth() != 24)
                && (settings.getColorDepth() != -1)) {
            throw new Ardor3dException("Invalid pixel depth: " + settings.getColorDepth());
        }

        final GLCapabilities caps = new GLCapabilities(GLProfile.getMaxFixedFunc(true));
        caps.setHardwareAccelerated(true);
        caps.setDoubleBuffered(true);
        caps.setAlphaBits(settings.getAlphaBits());
        caps.setDepthBits(settings.getDepthBits());
        caps.setNumSamples(settings.getSamples());
        caps.setSampleBuffers(settings.getSamples() != 0);
        caps.setStereo(settings.isStereo());
        caps.setStencilBits(settings.getStencilBits());
        return caps;
    }
Saeid Nourian, Ph.D. Eng. | Graphing Calculator 3D
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: requested graphics configuration

gouessej
Administrator
Now I see what you mean and I can fix this bug.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: requested graphics configuration

runiter
great, thanks :)
Saeid Nourian, Ph.D. Eng. | Graphing Calculator 3D
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: requested graphics configuration

gouessej
Administrator
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: requested graphics configuration

runiter
In reply to this post by gouessej
I noticed that in your code below you are treating 32bits and 24bits color depth the same ways!
Shouldn't 32bits also include alpha channel? like this: caps.setAlphaBits(8)


switch (settings.getColorDepth()) {
case 32:
case 24:
caps.setRedBits(8);
caps.setBlueBits(8);
caps.setGreenBits(8);
break;
case 16:
caps.setRedBits(4);
caps.setBlueBits(4);
caps.setGreenBits(4);
break;
}
 
Saeid Nourian, Ph.D. Eng. | Graphing Calculator 3D
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: requested graphics configuration

gouessej
Administrator
There is already a separate flag in DisplaySettings to handle the alpha bits (which is not very intuitive), just look at the whole source code of this method, I already use settings.getAlphaBits() once:
caps.setAlphaBits(settings.getAlphaBits());
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: requested graphics configuration

runiter
Got it.

One more question. What does it mean when AlphaBits is zero? does it mean all semi-transparent shapes in the scene will appear as opaque? In my tests changing the AlphaBits doesn't seem to change anything in the rendering!
Saeid Nourian, Ph.D. Eng. | Graphing Calculator 3D
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: requested graphics configuration

runiter
Also, how can I request rgba of 10/10/10/2 which my graphics card seem to support:

117: GLCaps[wgl vid 0x76 arb: rgba 0xa/a/a/2, opaque, accum-rgba 16/16/16/16, dp/st/ms: 24/8/0, dbl, mono  , hw, GLProfile[GL3bc/GL3bc.hw], on-scr[.]]

Currently in your code of Ardor3D Jogl the maximum rgb seem to be 8bits each.
Saeid Nourian, Ph.D. Eng. | Graphing Calculator 3D
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: requested graphics configuration

Sven Gothel
Administrator
On 01/17/2013 07:01 PM, runiter [via jogamp] wrote:
> Also, how can I request rgba of 10/10/10/2 which my graphics card seem to
> support:
>
> 117: GLCaps[wgl vid 0x76 arb: rgba 0xa/a/a/2, opaque, accum-rgba 16/16/16/16,
> dp/st/ms: 24/8/0, dbl, mono  , hw, GLProfile[GL3bc/GL3bc.hw], on-scr[.]]
>
> Currently in your code of Ardor3D Jogl the maximum rgb seem to be 8bits each.

In JOGL you would set the requested RGBA value via GLCapabilities
while creating a GLContext/GLAutoDrawable.

RGB888 is default right now, the next closest avail. value will be chosen.

~Sven


signature.asc (911 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: requested graphics configuration

runiter
In reply to this post by runiter
I noticed a strange behavior with debug printout of DefaultGLCapabilitiesChooser.

I noticed with depth of 24 or below, I no longer get the debug printout of DefaultGLCapabilitiesChooser. It seem to be fine with depth of 25 and above though.

For example with the following I get the debug output:
final DisplaySettings settings = new DisplaySettings(400, 300, 32, 0, 0, 25, 0, 4, false, false);

But not with this configuration:
final DisplaySettings settings = new DisplaySettings(400, 300, 32, 0, 0, 25, 0, 4, false, false);

I looked at DefaultGLCapabilitiesChooser.java and couldn't find any code that could cause this, so it appears that the method DefaultGLCapabilitiesChooser.chooseCapabilities() is not called at all when Depth bit falls below 25bits.

Is this a bug?
Saeid Nourian, Ph.D. Eng. | Graphing Calculator 3D
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: requested graphics configuration

gouessej
Administrator
In reply to this post by runiter
runiter wrote
Also, how can I request rgba of 10/10/10/2 which my graphics card seem to support:

117: GLCaps[wgl vid 0x76 arb: rgba 0xa/a/a/2, opaque, accum-rgba 16/16/16/16, dp/st/ms: 24/8/0, dbl, mono  , hw, GLProfile[GL3bc/GL3bc.hw], on-scr[.]]

Currently in your code of Ardor3D Jogl the maximum rgb seem to be 8bits each.
DisplaySettings only has 2 variables. I would need to modify the core API of Ardor3D to add 2 variables in order to do what you want or Renanse should clarify how to use colorDepth and alphaBits. If colorDepth handled the 3 first components and alphabits the very last one, I would be able to provide a fix, you would set colorDepth to 30 and alphaBits to 2.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: requested graphics configuration

runiter
gouessej wrote
DisplaySettings only has 2 variables. I would need to modify the core API of Ardor3D to add 2 variables in order to do what you want or Renanse should clarify how to use colorDepth and alphaBits. If colorDepth handled the 3 first components and alphabits the very last one, I would be able to provide a fix, you would set colorDepth to 30 and alphaBits to 2.
Looks at least in Windows it's common practice to pick a general color bits (ie. 32 or 16) and alpha bits, and let the chooser handle how many bits each color should have.

Here's how Microsoft does it by ignoring red, green and blue bits passed to PIXELFORMATDESCRIPTOR and only taking the general number of bits per pixel and alpha bits into consideration:

http://msdn.microsoft.com/en-us/library/windows/desktop/dd318284(v=vs.85).aspx

I'm guessing that if the user passed ColorBit of 32 and AlphaBit of 8, then you can assume that each color component should have (32-8)/3=8 bits. Is this a good way to go?
Saeid Nourian, Ph.D. Eng. | Graphing Calculator 3D
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: requested graphics configuration

gouessej
Administrator
I would rather do colorDepth / 4 and use that for red, green and blue.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: requested graphics configuration

runiter
gouessej wrote
I would rather do colorDepth / 4 and use that for red, green and blue.
Then we should ask renanse to allow that. I'll suggest it in Ardor3D forum.
Saeid Nourian, Ph.D. Eng. | Graphing Calculator 3D
12
Loading...