I have a realtime OpenGL application rendering some objects with textures. I have build a function to make an internal screenshot of the rendered scene by rendering it to an DIB via PFD_DRAW_TO_BITMAP and copy it to an image. It works quite well except for one kind of texture. These are JPGs with 24bpp (so 8 Bit for every R,G,B). I can load them and they render correctly in realtime but not when rendered to the DIB. For other textures it works well. I have the same behaviour when testing my application on virtual machine (WinXP, no hardware acceleration!). Here these specific textures are not even shown in realtime rendering. Without hardware acceleration I guess WinXP uses its own software implementation of OpenGL and falls back to OpenGL 1.1. So are there any kinds of textures that cant be drawn without 3d hardware acceleration? Or is there a common pitfall?
Asked
Active
Viewed 418 times
1 Answers
5
PFD_DRAW_TO_BITMAP will always drop you into the fallback OpenGL-1.1 software rasterizer. So you should not use it. Create an off-screen FBO, render to that, retrieve the pixel data using glReadPixels and write it to a file using an image file I/O library.

datenwolf
- 159,371
- 13
- 185
- 298
-
I had a solution rendering to a hidden window (FBOs are not supported in the virtual machine), but on the virtual machine the window size was restricted to windows desktop solution. Maybe I can set a parameter in CreateWindowEx to enable this? Thus I could go without DIB. – Michbeckable Apr 29 '13 at 19:07
-
@MichiMichbeck: In virtual machine you may deal with software emulation anyway. In that particular case I suggest you install a Windows build of the software rasterizer part of Mesa3D to use instead. The nice thing about this is, that it allows you to create an OpenGL offscreen drawable that's completely independent of GPU and graphics system. Of course it's not HW accelerated. – datenwolf Apr 29 '13 at 19:19
-
Thx datenwolf. I will try MESA. I have now done it without the DIB Context but with a normal RenderContext and hidden window and that works for the 24bpp textures. But it doesnt work on the VM when 3D acceleration is turned off. Even the problem I stated above with the restricted window size is solved when I turn on 3D in VirtualMachine. Doesnt winXP on VM take the opengl32.dll as software implementation when no 3d acceleration is on? – Michbeckable Apr 30 '13 at 10:12
-
@MichiMichbeck: The software implementation in found in the default opengl32.dll is very, very limited. It's OpenGL-1.1 and as soon as you try doing anything above it, things will fall apart. Technically PFD_DRAW_TO_BITMAP will always use that software implementation, though. – datenwolf Apr 30 '13 at 10:30
-
I finally found the solution: Some textures where not sized power of two in width or height! OpenGL 1.1. ONLY supports POT textures! So I am scaling all textures now to the nearest power of two length! Mesa is an option also, and it works, but it is pretty slow. – Michbeckable May 30 '13 at 12:36