/usr/include/plib/puNative.h is in libplib-dev 1.8.5-8.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | /*
PLIB - A Suite of Portable Game Libraries
Copyright (C) 1998,2002 Steve Baker
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
For further information visit http://plib.sourceforge.net
$Id: puNative.h 1857 2004-02-16 13:49:03Z stromberg $
*/
#ifndef _PU_NATIVE_H_
#define _PU_NATIVE_H_
#ifndef PU_USE_NATIVE
# define PU_USE_NATIVE
#endif
#include "pu.h"
#if defined(UL_GLX)
# include <GL/glx.h>
#elif defined(UL_WGL)
// nothing
#elif defined(UL_AGL)
# include <agl.h>
#elif defined(UL_CGL)
# include <OpenGL/CGLCurrent.h>
#endif
inline int puGetWindowNative ()
{
#if defined(UL_GLX)
return (int) glXGetCurrentDrawable () ;
#elif defined(UL_WGL)
return (int) wglGetCurrentDC () ;
#elif defined(UL_AGL)
return (int) aglGetCurrentDrawable () ;
#elif defined(UL_CGL)
return (int) CGLGetCurrentContext () ;
#else
return 0 ;
#endif
}
inline void puGetWindowSizeNative ( int *width, int *height )
{
#if defined(UL_GLX)
Window root ;
int x, y ;
unsigned int w, h, b, d ;
XGetGeometry ( glXGetCurrentDisplay (),
glXGetCurrentDrawable (),
&root, &x, &y, &w, &h, &b, &d ) ;
*width = w ;
*height = h ;
#elif defined(UL_WGL)
RECT r ;
GetClientRect( WindowFromDC( wglGetCurrentDC() ), &r );
*width = r.right ;
*height = r.bottom ;
#else // Help! Need implementations for more systems.
GLint vp[4] ;
glGetIntegerv ( GL_VIEWPORT, vp ) ;
*width = vp[0] + vp[2] ;
*height = vp[1] + vp[3] ;
// Note: puSetOpenGLState calls glViewport(0, 0, w, h).
#endif
}
inline void puInitNative ()
{
puSetWindowFuncs ( puGetWindowNative, NULL,
puGetWindowSizeNative, NULL ) ;
puRealInit () ;
}
#endif
|