Hi there, I hope you are well.
I am currently building an application for Windows 10 using MFC and modern OpenGL as the inner renderer. What I am trying to do is print a portion of the screen on a printer using MFC and Win32 commands. It has proven to be a struggle.
I am aware there are two ways to do this, namely:
1. Read data from the framebuffer using something like glReadPixels() however the problem I foresee is that the resolution of my framebuffer is way smaller than the printing resolution. So this would ultimately lead to stretching the image, and hence not be the best solution.
2. I could render the image(s) to memory (a DIB or Bitmap image) using MFC, and I have gone into this quite extensively, but I cannot seem to render using my shaders. I can render simple primitives using glBegin() / glEnd() (URG!!) but when texturing, I again cannot get anything to run.
I believe my main issue is that I’m using modern OpenGL and shaders to do the rendering. All the tutorials, docs, and coding examples that I’ve found on this use old OpenGL 1.1 and no texturing - simply primitive shapes.
Re: Option 2, because I am rendering to a DIB location, a whole new OpenGL context has to be created and bound to the Windows device context. Within this new OpenGL context, I cannot seem to create any shader objects, buffer objects or texture objects, etc, so I assume modern OpenGL is not supported here.
I did not want to paste a whole lot of code in here, so if you think you can help, simply ask me for a section of the code I’m dealing with and I’ll paste it in.
I thank you for your time and assistance.