aik6980's picture

ES20 application problem, Graphicmode with stencil buffer?

Project:The Open Toolkit library
Version:1.0-beta-3
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

how could I use OpenTK to create ES20 application with stencil buffer?

here is what I use and got error
public Game()
: base (Renderer.PANDORA_SCREEN_WIDTH, Renderer.PANDORA_SCREEN_HEIGHT, new GraphicsMode(16, 8, 8), "Equilibrium", GameWindowFlags.Default, DisplayDevice.Default, 2, 0, GraphicsContextFlags.Embedded)

GraphicsMode: Index: 9, Color: 24 (0888), Depth: 24, Stencil: 8, Samples: 0, Accum: 64 (16161616), Buffers: 2, Stereo: False
IWindowInfo: Windows.WindowInfo: Handle 400008, Parent (Windows.WindowInfo: Handle 8390682, Parent (null))
GraphicsContextFlags: Embedded
error: "EGL window surface not supported" -> something along this line

if I use GraphicsMode(16, 16), the application run fine

application is tested on AMD ES Emulator
any ideas?

ok, I got a workaround on this, which I'm not 100% sure this is the correct way to fix this problem
Here I have modified this line

OpenTK\Platform\Egl\EglContext.cs

Mode = new EglGraphicsMode().SelectGraphicsMode(mode.ColorFormat, mode.Depth, mode.Stencil, mode.Samples, mode.AccumulatorFormat, mode.Buffers, mode.Stereo);
            if (!Mode.Index.HasValue)
                throw new GraphicsModeException("Invalid or unsupported GraphicsMode.");
            // EqFixed: Stencil buffer problem
            //EGLConfig config = new EGLConfig(mode.Index.Value);
            EGLConfig config = new EGLConfig(Mode.Index.Value);

the result show that the supported surface has been created, but

public Game()
: base (Renderer.PANDORA_SCREEN_WIDTH, Renderer.PANDORA_SCREEN_HEIGHT, new GraphicsMode(16, 8, 8), "Equilibrium", GameWindowFlags.Default, DisplayDevice.Default, 2, 0, GraphicsContextFlags.Embedded)

why the final surface config shows

GraphicsMode: Index: 9, Color: 24 (0888), Depth: 24, Stencil: 8, Samples: 0, Accum: 64 (16161616), Buffers: 2, Stereo: False
IWindowInfo: Windows.WindowInfo: Handle 2693780, Parent (Windows.WindowInfo: Handle 597098, Parent (null))
GraphicsContextFlags: Embedded

hmm, the graphic mode doesn't show matched surface, 16-8-8(ES) -> 32-24-8(WGL)??


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

#1

Status:open» confirmed

This is indeed a bug.

the Fiddler's picture

#2

Version:1.0-beta-2» 0.9.x-dev
Status:confirmed» fixed

Fixed in r2574.

the Fiddler's picture

#4

Version:0.9.x-dev» 1.0-beta-3
Status:fixed» closed

Closing issues fixed in opentk-1.0-beta-3.