They are often very numerous, making it hard to see the final rendering.
glws::Drawable *
createDrawable(void);
+glws::Drawable *
+createPbuffer(int width, int height);
+
Context *
createContext(Context *shareContext, glws::Profile profile);
unsigned long long orig_drawable = call.ret->toUInt();
- glws::Drawable *drawable = glretrace::createDrawable();
+ glws::Drawable *drawable = glretrace::createPbuffer(width, height);
- drawable->resize(width, height);
- drawable->show();
-
drawable_map[orig_drawable] = drawable;
}
int iHeight = call.arg(3).toUInt();
unsigned long long orig_pbuffer = call.ret->toUIntPtr();
- glws::Drawable *drawable = glretrace::createDrawable();
-
- drawable->resize(iWidth, iHeight);
- drawable->show();
+ glws::Drawable *drawable = glretrace::createPbuffer(iWidth, iHeight);
pbuffer_map[orig_pbuffer] = drawable;
}
}
-glws::Drawable *
-createDrawable(glws::Profile profile) {
- glws::Drawable *draw = glws::createDrawable(getVisual(profile));
+static glws::Drawable *
+createDrawableHelper(glws::Profile profile, int width = 32, int height = 32, bool pbuffer = false) {
+ glws::Drawable *draw = glws::createDrawable(getVisual(profile), width, height, pbuffer);
if (!draw) {
std::cerr << "error: failed to create OpenGL drawable\n";
exit(1);
}
+glws::Drawable *
+createDrawable(glws::Profile profile) {
+ return createDrawableHelper(profile);
+}
+
+
glws::Drawable *
createDrawable(void) {
- return glretrace::createDrawable(getDefaultProfile());
+ return createDrawable(getDefaultProfile());
+}
+
+
+glws::Drawable *
+createPbuffer(int width, int height) {
+ return createDrawableHelper(getDefaultProfile(), width, height, true);
}
glws::Drawable *currentDrawable = currentContext->drawable;
assert(currentDrawable);
+ if (currentDrawable->pbuffer) {
+ return;
+ }
+
if (currentDrawable->visible &&
width <= currentDrawable->width &&
height <= currentDrawable->height) {
#define _GLWS_HPP_
+#include <assert.h>
+
#include <vector>
#include <set>
#include <string>
const Visual *visual;
int width;
int height;
+ bool pbuffer;
bool visible;
- Drawable(const Visual *vis, int w, int h) :
+ Drawable(const Visual *vis, int w, int h, bool pb) :
visual(vis),
width(w),
height(h),
+ pbuffer(pb),
visible(false)
{}
virtual void
show(void) {
+ assert(!pbuffer);
visible = true;
}
createVisual(bool doubleBuffer = false, Profile profile = PROFILE_COMPAT);
Drawable *
-createDrawable(const Visual *visual, int width = 32, int height = 32);
+createDrawable(const Visual *visual, int width, int height, bool pbuffer = false);
Context *
createContext(const Visual *visual, Context *shareContext = 0, Profile profile = PROFILE_COMPAT, bool debug = false);
NSWindow *window;
NSOpenGLContext *currentContext;
- CocoaDrawable(const Visual *vis, int w, int h) :
- Drawable(vis, w, h),
+ CocoaDrawable(const Visual *vis, int w, int h, bool pbuffer) :
+ Drawable(vis, w, h, pbuffer),
currentContext(nil)
{
NSOpenGLPixelFormat *pixelFormat = static_cast<const CocoaVisual *>(visual)->pixelFormat;
}
Drawable *
-createDrawable(const Visual *visual, int width, int height)
+createDrawable(const Visual *visual, int width, int height, bool pbuffer)
{
- return new CocoaDrawable(visual, width, height);
+ return new CocoaDrawable(visual, width, height, pbuffer);
}
Context *
EGLSurface surface;
EGLint api;
- EglDrawable(const Visual *vis, int w, int h) :
- Drawable(vis, w, h), api(EGL_OPENGL_ES_API)
+ EglDrawable(const Visual *vis, int w, int h, bool pbuffer) :
+ Drawable(vis, w, h, pbuffer),
+ api(EGL_OPENGL_ES_API)
{
XVisualInfo *visinfo = static_cast<const EglVisual *>(visual)->visinfo;
}
Drawable *
-createDrawable(const Visual *visual, int width, int height)
+createDrawable(const Visual *visual, int width, int height, bool pbuffer)
{
- return new EglDrawable(visual, width, height);
+ return new EglDrawable(visual, width, height, pbuffer);
}
Context *
public:
Window window;
- GlxDrawable(const Visual *vis, int w, int h) :
- Drawable(vis, w, h)
+ GlxDrawable(const Visual *vis, int w, int h, bool pbuffer) :
+ Drawable(vis, w, h, pbuffer)
{
XVisualInfo *visinfo = static_cast<const GlxVisual *>(visual)->visinfo;
}
Drawable *
-createDrawable(const Visual *visual, int width, int height)
+createDrawable(const Visual *visual, int width, int height, bool pbuffer)
{
- return new GlxDrawable(visual, width, height);
+ return new GlxDrawable(visual, width, height, pbuffer);
}
Context *
PIXELFORMATDESCRIPTOR pfd;
int iPixelFormat;
- WglDrawable(const Visual *vis, int width, int height) :
- Drawable(vis, width, height)
+ WglDrawable(const Visual *vis, int width, int height, bool pbuffer) :
+ Drawable(vis, width, height, pbuffer)
{
static bool first = TRUE;
RECT rect;
}
Drawable *
-createDrawable(const Visual *visual, int width, int height)
+createDrawable(const Visual *visual, int width, int height, bool pbuffer)
{
- return new WglDrawable(visual, width, height);
+ return new WglDrawable(visual, width, height, pbuffer);
}
Context *