mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-30 04:40:53 +00:00
Update: Merged in nlWindow patch from SVN.
This commit is contained in:
parent
574a07ae9c
commit
445b18e5e8
12 changed files with 42 additions and 24 deletions
|
@ -178,7 +178,7 @@ public:
|
|||
|
||||
// first param is the associated window.
|
||||
// Must be a HWND for Windows (WIN32).
|
||||
virtual bool setDisplay(void* wnd, const GfxMode& mode, bool show = true, bool resizeable = true) throw(EBadDisplay)=0;
|
||||
virtual bool setDisplay(nlWindow wnd, const GfxMode& mode, bool show = true, bool resizeable = true) throw(EBadDisplay)=0;
|
||||
// Must be called after a setDisplay that initialize the mode
|
||||
virtual bool setMode(const GfxMode& mode)=0;
|
||||
virtual bool getModes(std::vector<GfxMode> &modes)=0;
|
||||
|
|
|
@ -138,7 +138,7 @@ public:
|
|||
|
||||
/// create the window.
|
||||
virtual bool setDisplay(const CMode &mode, bool show, bool resizeable);
|
||||
virtual bool setDisplay(void *wnd, const CMode &mode, bool show, bool resizeable);
|
||||
virtual bool setDisplay(nlWindow wnd, const CMode &mode, bool show, bool resizeable);
|
||||
virtual bool setMode(const CMode& mode);
|
||||
virtual bool getModes(std::vector<CMode> &modes);
|
||||
virtual bool getCurrentScreenMode(CMode &mode);
|
||||
|
|
|
@ -64,7 +64,7 @@ public:
|
|||
*
|
||||
* You can access the driver with CNELU::Driver.
|
||||
*/
|
||||
static bool initDriver(uint w, uint h, uint bpp=32, bool windowed=true, void *systemWindow=NULL, bool offscreen=false, bool direct3d=false) throw(EDru);
|
||||
static bool initDriver(uint w, uint h, uint bpp=32, bool windowed=true, nlWindow systemWindow=EmptyWindow, bool offscreen=false, bool direct3d=false) throw(EDru);
|
||||
|
||||
/** Init all that we need for a Scene.
|
||||
* - register scene basics models,
|
||||
|
@ -108,7 +108,7 @@ public:
|
|||
* - initScene();
|
||||
* - initEventServer();
|
||||
*/
|
||||
static bool init(uint w, uint h, CViewport viewport=CViewport(), uint bpp=32, bool windowed=true, void *systemWindow=NULL, bool offscreen = false, bool direct3d = false) throw(EDru);
|
||||
static bool init(uint w, uint h, CViewport viewport=CViewport(), uint bpp=32, bool windowed=true, nlWindow systemWindow=EmptyWindow, bool offscreen = false, bool direct3d = false) throw(EDru);
|
||||
|
||||
/** Delete all:
|
||||
* - releaseEventServer();
|
||||
|
|
|
@ -178,7 +178,7 @@ public:
|
|||
* \param show show or hide the window in window mode.
|
||||
*/
|
||||
virtual bool setDisplay(const CMode &mode, bool show = true, bool resizeable = true) =0;
|
||||
virtual bool setDisplay(void *wnd, const CMode &mode, bool show = true, bool resizeable = true) =0;
|
||||
virtual bool setDisplay(nlWindow wnd, const CMode &mode, bool show = true, bool resizeable = true) =0;
|
||||
virtual bool setMode(const CMode& mode)=0;
|
||||
virtual bool getModes(std::vector<CMode> &modes)=0;
|
||||
virtual bool getCurrentScreenMode(CMode &mode)=0;
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#ifdef NL_OS_WINDOWS
|
||||
# include <process.h>
|
||||
# include <intrin.h>
|
||||
# include <windows.h>
|
||||
#else
|
||||
# include <cmath>
|
||||
# include <unistd.h>
|
||||
|
@ -41,6 +42,13 @@
|
|||
|
||||
#include "string_common.h"
|
||||
|
||||
#ifdef NL_OS_WINDOWS
|
||||
typedef HWND nlWindow;
|
||||
#define EmptyWindow NULL
|
||||
#else
|
||||
typedef int nlWindow;
|
||||
#define EmptyWindow 0
|
||||
#endif
|
||||
|
||||
/// This namespace contains all miscellaneous classes used by other modules
|
||||
namespace NLMISC
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace NL3D
|
|||
{
|
||||
|
||||
// ***************************************************************************
|
||||
const uint32 IDriver::InterfaceVersion = 0x63; // added supportNonPowerOfTwoTextures()
|
||||
const uint32 IDriver::InterfaceVersion = 0x64; // Added nlWindow patch.
|
||||
|
||||
// ***************************************************************************
|
||||
IDriver::IDriver() : _SyncTexDrvInfos( "IDriver::_SyncTexDrvInfos" )
|
||||
|
|
|
@ -1295,7 +1295,7 @@ const D3DFORMAT FinalPixelFormat[ITexture::UploadFormatCount][CDriverD3D::FinalP
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CDriverD3D::setDisplay(void* wnd, const GfxMode& mode, bool show, bool resizeable) throw(EBadDisplay)
|
||||
bool CDriverD3D::setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool resizeable) throw(EBadDisplay)
|
||||
{
|
||||
H_AUTO_D3D(CDriver3D_setDisplay);
|
||||
if (!_D3D)
|
||||
|
|
|
@ -737,7 +737,7 @@ public:
|
|||
|
||||
// Mode initialisation, requests
|
||||
virtual bool init (uint windowIcon = 0, emptyProc exitFunc = 0);
|
||||
virtual bool setDisplay(void* wnd, const GfxMode& mode, bool show, bool resizeable) throw(EBadDisplay);
|
||||
virtual bool setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool resizeable) throw(EBadDisplay);
|
||||
virtual bool release();
|
||||
virtual bool setMode(const GfxMode& mode);
|
||||
virtual bool getModes(std::vector<GfxMode> &modes);
|
||||
|
|
|
@ -98,7 +98,7 @@ uint CDriverGL::_Registered=0;
|
|||
#endif // NL_OS_WINDOWS
|
||||
|
||||
// Version of the driver. Not the interface version!! Increment when implementation of the driver change.
|
||||
const uint32 CDriverGL::ReleaseVersion = 0xf;
|
||||
const uint32 CDriverGL::ReleaseVersion = 0x10;
|
||||
|
||||
// Number of register to allocate for the EXTVertexShader extension
|
||||
const uint CDriverGL::_EVSNumConstant = 97;
|
||||
|
@ -551,7 +551,7 @@ void CDriverGL::disableHardwareTextureShader()
|
|||
|
||||
// --------------------------------------------------
|
||||
|
||||
bool CDriverGL::setDisplay(void *wnd, const GfxMode &mode, bool show, bool resizeable) throw(EBadDisplay)
|
||||
bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool resizeable) throw(EBadDisplay)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL_setDisplay)
|
||||
|
||||
|
@ -1091,10 +1091,7 @@ bool CDriverGL::setDisplay(void *wnd, const GfxMode &mode, bool show, bool resiz
|
|||
nldebug("3D: glXCreateContext() OK");
|
||||
}
|
||||
|
||||
Colormap cmap = XCreateColormap (dpy, RootWindow(dpy, DefaultScreen(dpy)), visual_info->visual, AllocNone);
|
||||
|
||||
XSetWindowAttributes attr;
|
||||
attr.colormap = cmap;
|
||||
attr.background_pixel = BlackPixel(dpy, DefaultScreen(dpy));
|
||||
|
||||
#ifdef XF86VIDMODE
|
||||
|
@ -1113,17 +1110,30 @@ bool CDriverGL::setDisplay(void *wnd, const GfxMode &mode, bool show, bool resiz
|
|||
attr.override_redirect = False;
|
||||
#endif
|
||||
|
||||
int attr_flags = CWOverrideRedirect | CWColormap | CWBackPixel;
|
||||
int attr_flags = CWOverrideRedirect | CWBackPixel;
|
||||
|
||||
win = XCreateWindow (dpy, RootWindow(dpy, DefaultScreen(dpy)), 0, 0, width, height, 0, visual_info->depth, InputOutput, visual_info->visual, attr_flags, &attr);
|
||||
|
||||
if(!win)
|
||||
if(wnd == EmptyWindow)
|
||||
{
|
||||
nlerror("XCreateWindow() failed");
|
||||
nlWindow root = RootWindow(dpy, DefaultScreen(dpy));
|
||||
|
||||
attr.colormap = XCreateColormap(dpy, root, visual_info->visual, AllocNone);
|
||||
attr_flags |= CWColormap;
|
||||
|
||||
win = XCreateWindow (dpy, root, 0, 0, width, height, 0, visual_info->depth, InputOutput, visual_info->visual, attr_flags, &attr);
|
||||
|
||||
if (win == EmptyWindow)
|
||||
{
|
||||
nlerror("3D: XCreateWindow() failed");
|
||||
}
|
||||
else
|
||||
{
|
||||
nldebug("3D: XCreateWindow() OK");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nldebug("3D: XCreateWindow() OK");
|
||||
win = wnd;
|
||||
XChangeWindowAttributes(dpy, win, attr_flags, &attr);
|
||||
}
|
||||
|
||||
XSizeHints size_hints;
|
||||
|
|
|
@ -283,7 +283,7 @@ public:
|
|||
virtual void disableHardwareVertexArrayAGP();
|
||||
virtual void disableHardwareTextureShader();
|
||||
|
||||
virtual bool setDisplay(void* wnd, const GfxMode& mode, bool show, bool resizeable) throw(EBadDisplay);
|
||||
virtual bool setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool resizeable) throw(EBadDisplay);
|
||||
virtual bool setMode(const GfxMode& mode);
|
||||
virtual bool getModes(std::vector<GfxMode> &modes);
|
||||
virtual bool getCurrentScreenMode(GfxMode &mode);
|
||||
|
|
|
@ -224,11 +224,11 @@ bool CDriverUser::setDisplay(const CMode &mode, bool show, bool resizeable)
|
|||
{
|
||||
NL3D_HAUTO_UI_DRIVER;
|
||||
|
||||
return setDisplay(NULL, mode, show, resizeable);
|
||||
return setDisplay(EmptyWindow, mode, show, resizeable);
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
bool CDriverUser::setDisplay(void *wnd, const CMode &mode, bool show, bool resizeable)
|
||||
bool CDriverUser::setDisplay(nlWindow wnd, const CMode &mode, bool show, bool resizeable)
|
||||
{
|
||||
NL3D_HAUTO_UI_DRIVER;
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ CEventServer CNELU::EventServer;
|
|||
CEventListenerAsync CNELU::AsyncListener;
|
||||
|
||||
|
||||
bool CNELU::initDriver (uint w, uint h, uint bpp, bool windowed, void *systemWindow, bool offscreen, bool direct3d) throw(EDru)
|
||||
bool CNELU::initDriver (uint w, uint h, uint bpp, bool windowed, nlWindow systemWindow, bool offscreen, bool direct3d) throw(EDru)
|
||||
{
|
||||
// Init debug system
|
||||
// NLMISC::InitDebug();
|
||||
|
@ -174,7 +174,7 @@ void CNELU::releaseDriver()
|
|||
}
|
||||
}
|
||||
|
||||
bool CNELU::init (uint w, uint h, CViewport viewport, uint bpp, bool windowed, void *systemWindow, bool offscreen, bool direct3d) throw(EDru)
|
||||
bool CNELU::init (uint w, uint h, CViewport viewport, uint bpp, bool windowed, nlWindow systemWindow, bool offscreen, bool direct3d) throw(EDru)
|
||||
{
|
||||
NL3D::registerSerial3d();
|
||||
if (initDriver(w,h,bpp,windowed,systemWindow,offscreen,direct3d))
|
||||
|
|
Loading…
Reference in a new issue