views:

272

answers:

3

Hello all,

I am developing an OpenGL application that has two working modes: windowed mode and full screen. The app displays several graphic objects using OpenGL and writes some text strings using that same API. The program displays the texts strings in its intended positions when running as a windowed application, but when running full screen the text strings are displayed in an upper position that its intended position.

The app creates the fonts using wglUseFontBitmap and displays the text strings with glCallLists (it sets the text position using glRasterPos2i). Before the text is displayed I adjust the text position adding an offset to the Y coord. I get that offset using the GetDCOrgEx Win32 API call.

Any help will be wellcomed. Thanks in advance and excuse my English,

Eugenio

A: 

I think you have to call GetDCOrgEx again after getting in fullscreen mode, or do you already do this? It would help if you could post the code where you call GetDCOrgEx and calculate the Y offset.

EDIT: Another idea: Could it be that you can use the same Y offset, but negative? Or perhaps calculate Y position and then use height-ypos? There's some source code here that uses glRasterPos2i different when in fullScreen:

  if(!state->fullScreen)
    // if fullScreen (don't forget the image/GL y-coord vertical flip)
    glRasterPos2i((w - state->img->cols())/2, (h - state->img->rows())/2);
  else
    // for non-fullscreen images
    glRasterPos2i(0,h);
schnaader
A: 

Here's the code to calculate the Y offset:

POINT vOffset;

m_hdc = GetDC(m_hWnd); if (m_hdc) { GetDCOrgEx(m_hdc, &vOffset); m_iYOffset = vOffset.y; }

The above code is called once the program has set up full screen mode. I tried to call GetDCOrgEx every time I need to write a text string, but the text is written at the same positions that when GetDCOrgEx is called only once.

Eugenio

A: 

Schnaader, thanks a lot for your answers.

I have solved the problem modifying how I calculate the offset that I need to add to the Y coord. Now the offset is calculated with the following code:

m_iYOffset = GetSystemMetrics(SM_CYCAPTION) + GetSystemMetrics(SM_CYBORDER);

The above code solves the problem for my application.

Eugenio

Now accept your own answer so we can get rid of this unanswered question. Btw, I don't think you should excuse yourself for your english. It's very good :)
Magnus Skog