Amann's picture

Working at windowed mode but black at fullscreen. opengl-cl interop, cloo, .AcquireGLObjects

Hello i am just getting started and mixed up serveral tutorials into a single extended GameWindow:
VBO: How to draw a simple triangle : http://www.opentk.com/node/2292
3rdPersonCamera Example : http://www.opentk.com/node/571
OpenCL / OpenGL Interoperation : http://www.cmsoft.com.br/index.php?option=com_content&view=category&layo...

I updated the last tutorial to the newest cloo-version and it worked, but it uses a Windows.Form with a glControl and a Timer for the rendering loop. So I converted the VBOs-creationing- and cl-program-compiling-, cl-computing-, and gl-rendering-parts to OnLoad, OnUpdateFrame, and OnRenderFrame.

In windowed mode it works like intendet:

But when i run my code with GameWindowFlags.Fullscreen it shows for a very short time the first(?) frame and then turns black, same when i lose program-focus and return, when i take a screenshot(print-key), it shows a rendered frame(i don't know if it is the first only).
When i Alt-Tap in W7 it renders the dynamic waves:

It also renders when the focus is on the Firefox-DL-Window

OnUpdateFrame is calling the following function:

    Protected Sub GLCLUpdate()
        If (Not initialized) Then Return
        GL.Finish()
        Dim c As List(Of ComputeMemory) = New List(Of ComputeMemory)() From {CLGLPositions, CLGLColors}
 
        CQ.AcquireGLObjects(c, Nothing)  ' A
 
 
        ' Read elapsed time from Stopwatch and write to Device memory
        Tempo(0) = CSng(sw.Elapsed.TotalSeconds)
        Dim dataHandle As GCHandle = GCHandle.Alloc(Tempo, GCHandleType.Pinned)
        CQ.Write(Of Single)(varTempo, True, 0, Tempo.LongLength, dataHandle.AddrOfPinnedObject(), Nothing) ' count = region
        dataHandle.Free()
 
        CQ.Execute(kernelinteropTeste, Nothing, New Int64() {CLng(PositionData.Length / 3)}, Nothing, Nothing)
        CQ.ReleaseGLObjects(c, Nothing)  ' B
        CQ.Finish()
    End Sub

After commenting out everything between A and B i know that CQ.AcquireGLObjects(c, Nothing) is responsible for this.

Using:
HD 5670
w7 64
net 4.0
OpenTK 1.0

Do you have an idea?


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
nythrix's picture
Without AcquireGLObjects CLGLPositions and CLGLColors might not be available to OpenCL. So, what exactly happens if you comment it out?
Amann's picture
nythrix wrote:

Without AcquireGLObjects CLGLPositions and CLGLColors might not be available to OpenCL.
So, what exactly happens if you comment it out?

Runs and doesn't turn black, but also doesen't calculate the waves and so only renders a blue Square.