Max 5 API Reference
00001 #ifndef JIT_GL_READBACK_H 00002 #define JIT_GL_READBACK_H 00003 00004 /* 00005 * Copyright 2001-2005 - Cycling '74 00006 * Derek Gerstmann - derek@cycling74.com 00007 * 00008 * Struct and associated methods for an offscreen framebuffer 00009 * capable of writing raster information into another buffer 00010 * object, either textures or renderbuffers. 00011 */ 00012 00013 /****************************************************************************/ 00014 00015 #include "jit.gl.h" 00016 #include "jit.common.h" 00017 #include "jit.gl.fbo.h" 00018 #include "jit.gl.pbuffer.h" 00019 #include "jit.gl.texture.h" 00020 #include "jit.gl.renderbuffer.h" 00021 00022 /****************************************************************************/ 00023 00024 #ifdef __cplusplus 00025 extern "C" { 00026 #endif 00027 00028 #if C74_PRAGMA_STRUCT_PACKPUSH 00029 #pragma pack(push, 2) 00030 #elif C74_PRAGMA_STRUCT_PACK 00031 #pragma pack(2) 00032 #endif 00033 00034 /****************************************************************************/ 00035 00036 #define JIT_GL_READBACK_MODE_FBO (1) 00037 #define JIT_GL_READBACK_MODE_PBUFFER_RTT (2) 00038 #define JIT_GL_READBACK_MODE_PBUFFER_CTT (3) 00039 00040 extern t_symbol *ps_jit_gl_readback_fbo; 00041 extern t_symbol *ps_jit_gl_readback_rtt; 00042 extern t_symbol *ps_jit_gl_readback_ctt; 00043 00044 /****************************************************************************/ 00045 00046 typedef struct _jit_gl_readback 00047 { 00048 t_jit_object jitob; // readback object 00049 long mode; // either FBO or PBUFFER 00050 GLint width; // width 00051 GLint height; // height 00052 GLint depth; // size of depth buffer 00053 GLint stencil; // stencil buffer flag (on/off) 00054 GLint drawbuffer; // previous draw buffer 00055 void* matrix; // matrix for readback to host mem 00056 t_jit_gl_fbo *fbo; // framebuffer object interface 00057 t_jit_gl_pbuffer *pbuffer; // pbuffer object interface 00058 t_jit_gl_renderbuffer *depthbuffer; // renderbuffer object for optional depth buffer w/fbo 00059 t_jit_gl_renderbuffer *stencilbuffer; // renderbuffer object for optional stencil buffer w/fbo 00060 GLenum attachment; // attachment point if mode is FBO 00061 long ownsfbo; // flag is set if FBO was locally created 00062 GLint oldviewport[4]; // cache old viewport for capture 00063 } t_jit_gl_readback; 00064 00065 /****************************************************************************/ 00066 00067 // creation / deletion 00068 void jit_gl_readback_init(); 00069 t_jit_gl_readback *jit_gl_readback_new(void); 00070 void jit_gl_readback_free(t_jit_gl_readback *x); 00071 00072 // usage methods 00073 t_jit_err jit_gl_readback_create(t_jit_gl_readback *x, long mode, GLint width, GLint height, GLint depth, GLint stencil); 00074 t_jit_err jit_gl_readback_create_with_fbo(t_jit_gl_readback *x, long mode, GLint width, GLint height, void *fbocontext, GLenum attachment); 00075 t_jit_err jit_gl_readback_attach_texture(t_jit_gl_readback *x, GLenum attachment, t_jit_gl_texture *texture, GLint miplevel, GLint zslice); 00076 t_jit_err jit_gl_readback_detach_texture(t_jit_gl_readback *x, GLenum attachment); 00077 t_jit_err jit_gl_readback_bind(t_jit_gl_readback *x); 00078 t_jit_err jit_gl_readback_unbind(t_jit_gl_readback *x); 00079 t_jit_err jit_gl_readback_readpixels(t_jit_gl_readback *x, t_symbol *matrix); 00080 t_jit_err jit_gl_readback_bind_attachment(t_jit_gl_readback *x, long attachment); // attachment not used for now 00081 t_jit_err jit_gl_readback_unbind_attachment(t_jit_gl_readback *x, long attachment); // attachment not used for now 00082 t_jit_err jit_gl_readback_update(t_jit_gl_readback *x); 00083 t_jit_err jit_gl_readback_check_status(t_jit_gl_readback *x); 00084 t_jit_err jit_gl_readback_destroy(t_jit_gl_readback *x); 00085 t_jit_err jit_gl_readback_reset(t_jit_gl_readback *x); 00086 00087 /****************************************************************************/ 00088 00089 #if C74_PRAGMA_STRUCT_PACKPUSH 00090 #pragma pack(pop) 00091 #elif C74_PRAGMA_STRUCT_PACK 00092 #pragma pack() 00093 #endif 00094 00095 #ifdef __cplusplus 00096 } 00097 #endif 00098 00099 /****************************************************************************/ 00100 00101 #endif // JIT_GL_READBACK_H
Copyright © 2008, Cycling '74