Max 5 API Reference
00001 #ifndef JIT_GL_PBUFFER_H 00002 #define JIT_GL_PBUFFER_H 00003 00004 /* 00005 * Copyright 2001-2005 - Cycling '74 00006 * Derek Gerstmann - derek@cycling74.com 00007 * 00008 * Struct and associated methods for maintaining an OpenGL 00009 * pbuffer (offscreen drawable). 00010 * 00011 */ 00012 00013 /****************************************************************************/ 00014 00015 #include "jit.gl.h" 00016 #include "jit.common.h" 00017 #include "jit.gl.pixelformat.h" 00018 00019 /****************************************************************************/ 00020 00021 #ifdef __cplusplus 00022 extern "C" { 00023 #endif 00024 00025 #if C74_PRAGMA_STRUCT_PACKPUSH 00026 #pragma pack(push, 2) 00027 #elif C74_PRAGMA_STRUCT_PACK 00028 #pragma pack(2) 00029 #endif 00030 00031 /****************************************************************************/ 00032 00033 #define JIT_GL_PBUFFER_MODE_DRAW (0) 00034 #define JIT_GL_PBUFFER_MODE_RTT (1) // render to texture 00035 #define JIT_GL_PBUFFER_MODE_CTT (2) // copy to texture 00036 00037 #ifdef MAC_VERSION 00038 typedef AGLPbuffer t_jit_gl_native_pbuffer; 00039 #endif 00040 #ifdef WIN_VERSION 00041 typedef HPBUFFERARB t_jit_gl_native_pbuffer; 00042 #endif 00043 00044 /****************************************************************************/ 00045 00046 typedef struct _jit_gl_pbuffer 00047 { 00048 long initialized; // false if pbuffer has not been initialized 00049 t_symbol *colormode; // colormode 00050 t_symbol *type; // name of datatype 00051 long mode; // update mode 00052 long bound; // flag for whether pbuffer is actively bound 00053 long target; // opengl binding target 00054 long internal; // opengl internal format 00055 long width; // width of pbuffer 00056 long height; // height of pbuffer 00057 long mipmap; // mipmap levels 00058 long share_lists; // flag to share lists, objects, etc 00059 long copy_context; // flag to share existing context 00060 long source; // source to use for offscreen rendering 00061 long buffer; // buffer id (GL_FRONT or GL_BACK) 00062 t_jit_gl_context current; // current rendering context 00063 t_jit_gl_context previous; // previous rendering context 00064 t_jit_gl_native_pbuffer native; // native handle to pbuffer 00065 t_jit_gl_native_pixelformat pixelformat; // native handle to pixel format 00066 long buffertexid; // texture id for rtt/ctt 00067 } t_jit_gl_pbuffer; 00068 00069 t_jit_gl_pbuffer *jit_gl_pbuffer_new(void); 00070 00071 t_jit_err jit_gl_pbuffer_create( 00072 t_jit_gl_pbuffer *x, t_symbol *colormode, t_symbol *datatype, long mode, long width, long height, 00073 long target, long internal, long mipmap, long buffer, 00074 long sharelists, long copycontext, 00075 t_jit_gl_pixelformat *pixelformat); 00076 00077 t_jit_err jit_gl_pbuffer_bind(t_jit_gl_pbuffer *x, t_symbol *s, int argc, t_atom *argv); 00078 t_jit_err jit_gl_pbuffer_unbind(t_jit_gl_pbuffer *x, t_symbol *s, int argc, t_atom *argv); 00079 t_jit_err jit_gl_pbuffer_readpixels(t_jit_gl_pbuffer *x, t_symbol *matrix); 00080 t_jit_err jit_gl_pbuffer_bind_texture(t_jit_gl_pbuffer *x); 00081 t_jit_err jit_gl_pbuffer_unbind_texture(t_jit_gl_pbuffer *x); 00082 t_jit_err jit_gl_pbuffer_destroy_native(t_jit_gl_native_pbuffer x, t_jit_gl_native_drawable device); 00083 t_jit_err jit_gl_pbuffer_destroy(t_jit_gl_pbuffer *x); 00084 t_jit_err jit_gl_pbuffer_reset(t_jit_gl_pbuffer *x); 00085 void jit_gl_pbuffer_free(t_jit_gl_pbuffer *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_PBUFFER
Copyright © 2008, Cycling '74