summaryrefslogtreecommitdiff
path: root/tests/OffscreenContext.mm
diff options
context:
space:
mode:
Diffstat (limited to 'tests/OffscreenContext.mm')
-rw-r--r--tests/OffscreenContext.mm34
1 files changed, 30 insertions, 4 deletions
diff --git a/tests/OffscreenContext.mm b/tests/OffscreenContext.mm
index 90af712..eb2f777 100644
--- a/tests/OffscreenContext.mm
+++ b/tests/OffscreenContext.mm
@@ -1,16 +1,19 @@
#include "OffscreenContext.h"
#include "imageutils.h"
-#include "fboutils.h"
+#include "fbo.h"
#import <AppKit/AppKit.h> // for NSOpenGL...
+
+#define REPORTGLERROR(task) { GLenum tGLErr = glGetError(); if (tGLErr != GL_NO_ERROR) { std::cout << "OpenGL error " << tGLErr << " while " << task << "\n"; } }
+
struct OffscreenContext
{
NSOpenGLContext *openGLContext;
NSAutoreleasePool *pool;
int width;
int height;
- GLuint fbo;
+ fbo_t *fbo;
};
@@ -42,15 +45,38 @@ OffscreenContext *create_offscreen_context(int w, int h)
}
[ctx->openGLContext makeCurrentContext];
+
+ glewInit();
+#ifdef DEBUG
+ cout << "GLEW version " << glewGetString(GLEW_VERSION) << "\n";
+ cout << (const char *)glGetString(GL_RENDERER) << "(" << (const char *)glGetString(GL_VENDOR) << ")\n"
+ << "OpenGL version " << (const char *)glGetString(GL_VERSION) << "\n";
+ cout << "Extensions: " << (const char *)glGetString(GL_EXTENSIONS) << "\n";
+
+
+ if (GLEW_ARB_framebuffer_object) {
+ cout << "ARB_FBO supported\n";
+ }
+ if (GLEW_EXT_framebuffer_object) {
+ cout << "EXT_FBO supported\n";
+ }
+ if (GLEW_EXT_packed_depth_stencil) {
+ cout << "EXT_packed_depth_stencil\n";
+ }
+#endif
- ctx->fbo = fbo_create(w, h);
+ ctx->fbo = fbo_new();
+ if (!fbo_init(ctx->fbo, w, h)) {
+ return NULL;
+ }
return ctx;
}
bool teardown_offscreen_context(OffscreenContext *ctx)
{
- fbo_unbind();
+ fbo_unbind(ctx->fbo);
+ fbo_delete(ctx->fbo);
/*
* Cleanup
contact: Jan Huwald // Impressum