I have been trying to get my hand with OpenGL but not getting very far. I have installed two Envidia GeoForce video card. This is supposed to be OpenGL . Also use Wolfram Mathematica which allows to encode an OpenGL C++ code . So far, My Mathematica engine states that my hardware is ready for OpenGL.
Here is my problem.
I need a simple OpenGL code inside my C++ code that will allow me to identify the presence of all my monitors ( I have 3 attached to my Win10 computer) and allow me to control each pixel of a choose monitor. One thing that I am very interested is to blank to a color the full background of the monitor and assign specific colors on a pixel by pixel basis based on an algorithm entered in the C++ code. For example to draw vertical lines with a certain line frequency between black and bright white or color lines extending across the screen.
I know the last item is more complicated, but will like to get started how to code to output graphic to one monitor when presence of multi monitor environment.
I am using Visual Studio 2017, Win10 , and Nvidia Geoforce cards
#1 has nothing to do with OpenGL. This is pure Windows Display API. The basic idea is you query all of the screens (Windows confusingly calls these “display adapters”) attached to your desktop using EnumDisplayDevices(), filtering out just those where ( device.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP ). Using the same API, you determine which monitors are driven by each screen. For more detail on each monitor (such as its bounds on the desktop), you can use EnumDisplayMonitors() and GetMonitorInfo(). (example code) Then you can use CreateWindowEx() to create windows on specific screens (full-screen or not). If your drawing needs are simple, you could even use the Windows display APIs to do your drawing.
However, if you wanted to use OpenGL to render to a window created with the above, you just create an OpenGL context (wglCreateContext()) that can render to the window’s DC (GetDC()), bind it (wglMakeCurrent()), and then render your window(s) with OpenGL.
If this seems complicated, or if you’d like a “query-monitors and create-window” solution that ideally isn’t so heavily tied to Windows APIs, you might consider using GLFW to query the monitors on your system and create an OpenGL-capable window on your desktop. Here are a few links on that (note: I haven’t tried this personally):