3

How can I determine if the OpenGL window is the active window?

ThinkingStiff
  • 64,767
  • 30
  • 146
  • 239
Datoxalas
  • 1,261
  • 5
  • 14
  • 23
  • 1
    Are you using any OpenGL toolkits such as GLUT or libraries such as SDL? What operating system is this for? – Maarten Apr 07 '11 at 09:48
  • @Maarten: It is for a Windows operating system. I am using SDL and I'm not sure whether I am using GLUT. – Datoxalas Apr 07 '11 at 15:22

2 Answers2

5

You can not do it from the opengl, because only the window manager knows which window is active. The best you can do, is you activate it yourself (for example, in glut it is done with glutSetWindow)

BЈовић
  • 62,405
  • 41
  • 173
  • 273
3

OpenGL only deals with drawing stuff. Terms like "Window" "Active" or "Focused" are completely outside the scope of OpenGL. You need to consult your windowing system's functions for this (Win32, X11, or functions provided by a cross-plattform toolkit)

datenwolf
  • 159,371
  • 13
  • 185
  • 298