1

Topic: MSVC-2015 unit-tests together with OpenGL

Kind time of days, dear colleagues! Last night, I and my fellow workers faced a problem: Using a Visual Studio 2015 - we do a unit-test as it is described here https://msdn.microsoft.com/en-us/library/hh598953.aspx Our project using OpenGL (freeglut, etc.) Does not work normally. But procedure which should launch  in a window is not launched, why - it is not known. glutSetWindow (m_hWindow); glutPostRedisplay ();//a command on  glutMainLoopEvent ();//to transit one operation cycle glut messages Itself OpenGL does not cause registered call-back function: glutDisplayFunc (DisplayGL);//we DisplayGL is not caused!!! All works in one thread ( it is locked). OS Windows-7 / 64 (+SP1). In the normal console project, also as well as in MFC/Qt application all works normally. The project is tested - on MFC application: there all works, as a Swiss watch Thankful in advance for any thoughts! Probably, there are any adjustments and options for a Visual Studio 2015 unit-test of a subsystem? P.S. I will note that: m_hWindow = glutCreateWindow ("Model Window");//returns  "" At application execution - any run-time errors is not present; all return codes - ; exceptions - also is not present, however the above-stated problem - is.

2

Re: MSVC-2015 unit-tests together with OpenGL

Hello, AlexGin, you wrote: AG> Itself OpenGL does not cause registered call-back function: AG> AG> glutDisplayFunc (DisplayGL);//we DisplayGL is not caused!!! AG> I will assume, what something did not initialize in the test code can give a minimum code of the test to send on errands at myself? Let everything is drawn, though a black box

3

Re: MSVC-2015 unit-tests together with OpenGL

Hello, AlexGin, you wrote: AG> P.S. I will note that: AG> AG> m_hWindow = glutCreateWindow ("Model Window");//returns  "" AG> Obviously what to try without glut: HDC hdc =:: GetDC (hwnd); PIXELFORMATDESCRIPTOR pixel_format = {sizeof (PIXELFORMATDESCRIPTOR)...}; int pixel_format_id =:: ChoosePixelFormat (hdc, &pixel_format);:: SetPixelFormat (hdc, pixel_format_id, &pixel_format); HGLRC hglrc = wglCreateContext (hdc); wglMakeCurrent (hdc, hglrc);//call OpenGL APIs as desired...

4

Re: MSVC-2015 unit-tests together with OpenGL

Hello, uzhas, you wrote: U> Hello, AlexGin, you wrote: AG>> Itself OpenGL does not cause registered call-back function: AG>> AG>> glutDisplayFunc (DisplayGL);//we DisplayGL is not caused!!! AG>> U> I will assume that something did not initialize in the code of the test the Assumption - erraticly as just the same code, only in a type command-line Win32 application - normally works. U> can give a minimum code of the test to send on errands at itself? Let everything though the black box Is big enough and twirled pieces of the code is drawn. To pull out something minimum it is uneasy Nevertheless, thanks, respected uzhas, for desire to help!

5

Re: MSVC-2015 unit-tests together with OpenGL

Hello, turbocode, you wrote: T> Hello, AlexGin, you wrote: AG>> P.S. I will note that: AG>> AG>> m_hWindow = glutCreateWindow ("Model Window");//returns  "" AG>> T> Obviously what to try without glut: T> T> HDC hdc =:: GetDC (hwnd); T> PIXELFORMATDESCRIPTOR pixel_format = {sizeof (PIXELFORMATDESCRIPTOR)...}; T> int pixel_format_id =:: ChoosePixelFormat (hdc, &pixel_format); T>:: SetPixelFormat (hdc, pixel_format_id, &pixel_format); T> HGLRC hglrc = wglCreateContext (hdc); T> wglMakeCurrent (hdc, hglrc); T>//call OpenGL APIs as desired... T> Is not present, to do all glut "manually" -  not the most correct decision P.S. The Small chest simply was possible  the given problem opened:  function invocation glutShowWindow () - to show a window, in the unit-test for some reason a window "is by default latent", in other projects it has been commented out also all worked normally.

6

Re: MSVC-2015 unit-tests together with OpenGL

Hello, AlexGin, you wrote: AG> in the unit-test for some reason the window "is by default latent", in other projects it has been commented out also all worked normally. It is logical, because tests almost always are not visual.

7

Re: MSVC-2015 unit-tests together with OpenGL

Hello, AlexGin, you wrote: AG> the Small chest simply opened: AG> Raskomentirovali function invocation glutShowWindow () - to show a window, AG> in the unit-test for some reason a window "is by default latent", in other projects it has been commented out also all worked normally. Probably the process fulfilling the test, is launched with instructions SW_HIDDEN in STARTUPINFO, accordingly the window on-default does not appear. If this test simply on  it makes sense not to create at all any windows.

8

Re: MSVC-2015 unit-tests together with OpenGL

VTT> Probably the process fulfilling the test, is launched with instructions SW_HIDDEN in STARTUPINFO, accordingly the window on-default does not appear. VTT> if this test simply on  it makes sense not to create at all any windows. To me also is thought what to show a window it is an incorrect way, it is necessary to draw in storage (instead of on a window) and to compare result.

9

Re: MSVC-2015 unit-tests together with OpenGL

Hello, turbocode, you wrote: VTT>> Probably the process fulfilling the test, is launched with instructions SW_HIDDEN in STARTUPINFO, accordingly the window on-default does not appear. VTT>> if this test simply on  it makes sense not to create at all any windows. T> to me also is thought what to show a window it is an incorrect way, it is necessary to draw in storage (instead of on a window) and to compare result. And how much it is possible for OpenGL?

10

Re: MSVC-2015 unit-tests together with OpenGL

T>> To me also is thought what to show a window it is an incorrect way, it is necessary to draw in storage (instead of on a window) and to compare result. AG> and how much it is possible for OpenGL? glReadPixels (it is even better Pixel Buffer Objects [PBO] if version OpenGL allows) on  as that so.