1 // Copyright (C)2004 Landmark Graphics Corporation 2 // Copyright (C)2005 Sun Microsystems, Inc. 3 // Copyright (C)2009-2014, 2017-2020 D. R. Commander 4 // 5 // This library is free software and may be redistributed and/or modified under 6 // the terms of the wxWindows Library License, Version 3.1 or (at your option) 7 // any later version. The full license is in the LICENSE.txt file included 8 // with this distribution. 9 // 10 // This library is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // wxWindows Library License for more details. 14 15 #ifndef __VIRTUALWIN_H__ 16 #define __VIRTUALWIN_H__ 17 18 #include "VirtualDrawable.h" 19 #include "VGLTrans.h" 20 #ifdef USEXV 21 #include "XVTrans.h" 22 #endif 23 #include "TransPlugin.h" 24 #include "TempContext.h" 25 26 27 namespace vglfaker 28 { 29 class VirtualWin : public VirtualDrawable 30 { 31 public: 32 33 VirtualWin(Display *dpy, Window win); 34 ~VirtualWin(void); 35 void clear(void); 36 void cleanup(void); 37 GLXDrawable getGLXDrawable(void); 38 GLXDrawable updateGLXDrawable(void); 39 void checkConfig(VGLFBConfig config); 40 void resize(int width, int height); 41 void checkResize(void); 42 void initFromWindow(VGLFBConfig config); 43 void readback(GLint drawBuf, bool spoilLast, bool sync); 44 void swapBuffers(void); 45 bool isStereo(void); 46 void wmDelete(void); 47 void vglWMDelete(void); getSwapInterval(void)48 int getSwapInterval(void) { return swapInterval; } setSwapInterval(int swapInterval_)49 void setSwapInterval(int swapInterval_) { swapInterval = swapInterval_; } 50 51 bool dirty, rdirty; 52 53 private: 54 55 int init(int w, int h, VGLFBConfig config); 56 void readPixels(GLint x, GLint y, GLint width, GLint pitch, GLint height, 57 GLenum glFormat, PF *pf, GLubyte *bits, GLint buf, bool stereo); 58 void makeAnaglyph(vglcommon::Frame *f, int drawBuf, int stereoMode); 59 void makePassive(vglcommon::Frame *f, int drawBuf, GLenum glFormat, 60 int stereoMode); 61 void sendVGL(GLint drawBuf, bool spoilLast, bool doStereo, 62 int stereoMode, int compress, int qual, int subsamp); 63 void sendX11(GLint drawBuf, bool spoilLast, bool sync, bool doStereo, 64 int stereoMode); 65 void sendPlugin(GLint drawBuf, bool spoilLast, bool sync, bool doStereo, 66 int stereoMode); 67 #ifdef USEXV 68 void sendXV(GLint drawBuf, bool spoilLast, bool sync, bool doStereo, 69 int stereoMode); 70 #endif 71 TempContext *setupPluginTempContext(GLint drawBuf); 72 73 Display *eventdpy; 74 OGLDrawable *oldDraw; 75 int newWidth, newHeight; 76 vglserver::X11Trans *x11trans; 77 #ifdef USEXV 78 vglserver::XVTrans *xvtrans; 79 #endif 80 vglserver::VGLTrans *vglconn; 81 vglcommon::Profiler profGamma, profAnaglyph, profPassive; 82 bool syncdpy; 83 vglserver::TransPlugin *plugin; 84 bool stereoVisual; 85 vglcommon::Frame rFrame, gFrame, bFrame, frame, stereoFrame; 86 bool doWMDelete; 87 bool doVGLWMDelete; 88 bool newConfig; 89 int swapInterval; 90 bool alreadyWarnedPluginRenderMode; 91 }; 92 } 93 94 #endif // __VIRTUALWIN_H__ 95