tksuoran's picture

GraphicsMode() selects indexed color format and fails with it (on Mac)

Project:The Open Toolkit library
Version:1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:open
Description

This works fine on Windows but fails on Mac OSX Lion:

    public class LoadingWindow : OpenTK.GameWindow, ILoadingWindow
    {
        public LoadingWindow()
        :   base(
            500, 50,
            new GraphicsMode(
                new ColorFormat(0, 0, 1, 0), // r g b a
                0, 0, 0
            ),
            "Loading...", 
            OpenTK.GameWindowFlags.Default,
            OpenTK.DisplayDevice.Default, 
            2, 
            1, 
            GraphicsContextFlags.Default
        )

It is not entirely clear to me if this should work or not. This is only for loading window, where I only draw solid blue progress bar on black background. On Mac I get this exception:

OpenTK.Platform.MacOS.MacOSGraphicsMode.SelectPixelFormat (color={1 ( indexed)}, depth=0, stencil=0, samples=0, accum={0 (0000)}, buffers=2, stereo=false) in Documents/dev/Projects/technologies/opentk/Source/OpenTK/Platform/MacOS/MacOSGraphicsMode.cs:149
OpenTK.Platform.MacOS.MacOSGraphicsMode.SelectGraphicsMode (color={1 ( indexed)}, depth=0, stencil=0, samples=0, accum={0 (0000)}, buffers=2, stereo=false) in Documents/dev/Projects/technologies/opentk/Source/OpenTK/Platform/MacOS/MacOSGraphicsMode.cs:45
OpenTK.Graphics.GraphicsMode.LazySelectGraphicsMode () in Documents/dev/Projects/technologies/opentk/Source/OpenTK/Graphics/GraphicsMode.cs:346
OpenTK.Graphics.GraphicsMode.get_Index () in Documents/dev/Projects/technologies/opentk/Source/OpenTK/Graphics/GraphicsMode.cs:183
OpenTK.Graphics.GraphicsMode.ToString () in Documents/dev/Projects/technologies/opentk/Source/OpenTK/Graphics/GraphicsMode.cs:367
System.String.FormatHelper (result={GraphicsMode: }, provider=(null), format="GraphicsMode: {0}", args={object[1]}) in
System.String.Format (provider=(null), format="GraphicsMode: {0}", args={object[1]}) in
System.String.Format (format="GraphicsMode: {0}", args={object[1]}) in
System.Diagnostics.Debug.Print (format="GraphicsMode: {0}", args={object[1]}) in
OpenTK.Graphics.GraphicsContext..ctor (mode=, window=, major=, minor=, flags=) in Documents/dev/Projects/technologies/opentk/Source/OpenTK/Graphics/GraphicsContext.cs:113
OpenTK.GameWindow..ctor (Parameters=) in Documents/dev/Projects/technologies/opentk/Source/OpenTK/GameWindow.cs:208
OpenTK.GameWindow..ctor (Parameters=) in Documents/dev/Projects/technologies/opentk/Source/OpenTK/GameWindow.cs
example.Loading.LoadingWindow..ctor (Parameters=) in Documents/dev/Projects/examples/RenderStack/example.Loading/LoadingWindow.cs
example.Loading.LoadingScreenManager.LoadingScreen (Parameters=) in Documents/dev/Projects/examples/RenderStack/example.Loading/Loading.cs:218
System.Threading.Thread.StartInternal (Parameters=) in