jdomnitz's picture

Issues with XP and GDI Renderer

I'm having an issue with some of my users on XP systems. They were experiencing high CPU usage and on further investigation we found out that they were defaulting to Microsoft's GDI renderer. I had them update to the latest official drivers (nvidia) which I knew supported openGL 3.3.

Unfortunately, thats not fixing the problem. Using the OpenGL extension viewer (http://www.realtech-vr.com/glview/) it shows two renderers installed, GDI Renderer and the hardware accelerated Nvidia one. Why does OpenTK default to using the GDI renderer (i'm assuming its not an openTK flaw since all it does is call opengl32.dll) and what steps can we tell users who have this problem?



Comment viewing options

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

OpenTK always requests an accelerated context from the OS - the rest is up to the OS. Off the top of my head, fallback to software rendering might happen:

  • with some uncommon GraphicsModes (e.g. 8bpp color buffers). Use GraphicsMode.Default if in doubt.
  • with some older multi-monitor configurations, where hardware-acceleration is only supported on the primary monitor.
  • when rendering to a GDI bitmap instead of an actual window.

Are you using GLControl or GameWindow? Is this reproducible with a simple test case (create window, print GL.GetString(StringName.Renderer), exit)?

jdomnitz's picture

Using the GameWindow... I'm working on a test case to produce it reliably-will post that later today

jdomnitz's picture

Alright I found the issue.... It was caused by one of the changes I made. I added an opacity property to INativeWindow and implemented it for windows and linux. with the windows implementation I had to change the extended window style to EX_LAYERED so that opacity could be changed. In doing so on vista and win7 everything works perfectly. On XP this forces the renderer to be the GDI renderer.

Is this due to XPs lack of a DWM (and direct to the card openGL rendering)? or is there a bug in openTK thats causing this?

I figured this info would be good to post either way just in case other users have similar issues.

the Fiddler's picture

Interesting. A quick search reveals people using pbuffers, glReadPixels and gdi blits to draw to WS_EX_LAYERED windows on Win2K/XP. Hardware acceleration on such windows is probably not possible before Vista and the DWM.

Out of curiosity, what happens if you disable Aero? Do you also lose hardware acceleration on WS_EX_LAYERED windows?

Edit: See also this.


From: Greg Binkerd [MS] (GregB@online.microsoft.com)
Subject: RE: WS_EX_LAYERED and OpenGL together?
View: Complete Thread (3 articles)
Original Format
Newsgroups: microsoft.public.win32.programmer.gdi
Date: 2002-06-05 10:18:55 PST

Hi, Craig.

Unfortunately, OpenGL (and DirectX) can not be used in a layered window. The hardware performs all rendering and will not incorporate the semitransparency effect displayed by a layered window. In fact, if you create a layered window and you move it over an OpenGL application or windowed DirectX application, you will see "flashing" of the layered window, since the hardware will draw the 3D primitives directly on the primary surface, drawing over the layered window and the layered window will immediately redraw itself in a semitransparent state. Note, this will only occur with hardware accelerated OpenGL and DirectX applications.

Microsoft Developer Support

jdomnitz's picture

Graphical Issues I would expect....it was the falling back to GDI Renderer that I couldn't find any mention of anywhere.

Tested on win7 with aero disabled and found no issues. Although dragging windows around does produce some artifacts-which would be expected.