Blender V2.61 - r43446
Defines | Functions | Variables

bgl.c File Reference

#include <Python.h>
#include "bgl.h"
#include <GL/glew.h>
#include "MEM_guardedalloc.h"
#include "BLI_utildefines.h"

Go to the source code of this file.

Defines

#define BGL_Wrap(nargs, funcname, ret, arg_list)
#define BGLU_Wrap(nargs, funcname, ret, arg_list)
#define MAX_DIMENSIONS   256
#define MethodDef(func)   {"gl"#func, Method_##func, METH_VARARGS, "no string"}
#define MethodDefu(func)   {"glu"#func, Method_##func, METH_VARARGS, "no string"}
#define EXPP_ADDCONST(x)   PyDict_SetItemString(dict, #x, item=PyLong_FromLong((int)x)); Py_DECREF(item)

Functions

static PyObject * Buffer_new (PyTypeObject *type, PyObject *args, PyObject *kwds)
static int Buffer_len (Buffer *self)
static PyObject * Buffer_item (Buffer *self, int i)
static PyObject * Buffer_slice (Buffer *self, int begin, int end)
static int Buffer_ass_item (Buffer *self, int i, PyObject *v)
static int Buffer_ass_slice (Buffer *self, int begin, int end, PyObject *seq)
static PyObject * Buffer_subscript (Buffer *self, PyObject *item)
static int Buffer_ass_subscript (Buffer *self, PyObject *item, PyObject *value)
static void Buffer_dealloc (Buffer *self)
static PyObject * Buffer_repr (Buffer *self)
static PyObject * Buffer_to_list (Buffer *self)
static PyObject * Buffer_to_list_recursive (Buffer *self)
static PyObject * Buffer_dimensions (Buffer *self, void *UNUSED(arg))
int BGL_typeSize (int type)
BufferBGL_MakeBuffer (int type, int ndimensions, int *dimensions, void *initbuffer)
static PyObject * Buffer_new (PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds)
 BGL_Wrap (BGL_Wrap(2, Accum, BGL_Wrap(void,(GLenum, GLfloat))
PyObject * BPyInit_bgl (void)

Variables

static PySequenceMethods Buffer_SeqMethods
static PyMappingMethods Buffer_AsMapping
static PyMethodDef Buffer_methods []
static PyGetSetDef Buffer_getseters []
PyTypeObject BGL_bufferType
static struct PyModuleDef BGL_module_def

Detailed Description

This file is the 'bgl' module which wraps OpenGL functions and constants, allowing script writers to make OpenGL calls in their Python scripts.

Note:
This module is very similar to 'PyOpenGL' which could replace 'bgl' one day.

Definition in file bgl.c.


Define Documentation

#define BGL_Wrap (   nargs,
  funcname,
  ret,
  arg_list 
)
Value:
static PyObject *Method_##funcname (PyObject *UNUSED(self), PyObject *args)   \
{                                                                             \
    arg_def##nargs arg_list;                                                  \
    ret_def_##ret;                                                            \
    if (!PyArg_ParseTuple(args,                                               \
                          arg_str##nargs arg_list,                            \
                          arg_ref##nargs arg_list))                           \
    {                                                                         \
        return NULL;                                                          \
    }                                                                         \
    ret_set_##ret gl##funcname (arg_var##nargs arg_list);                     \
    ret_ret_##ret;                                                            \
}

Definition at line 208 of file bgl.c.

#define BGLU_Wrap (   nargs,
  funcname,
  ret,
  arg_list 
)
Value:
static PyObject *Method_##funcname (PyObject *UNUSED(self), PyObject *args)   \
{                                                                             \
    arg_def##nargs arg_list;                                                  \
    ret_def_##ret;                                                            \
    if (!PyArg_ParseTuple(args,                                               \
                          arg_str##nargs arg_list,                            \
                          arg_ref##nargs arg_list))                           \
    {                                                                         \
        return NULL;                                                          \
    }                                                                         \
    ret_set_##ret glu##funcname (arg_var##nargs arg_list);                    \
    ret_ret_##ret;                                                            \
}

Definition at line 223 of file bgl.c.

#define EXPP_ADDCONST (   x)    PyDict_SetItemString(dict, #x, item=PyLong_FromLong((int)x)); Py_DECREF(item)

Referenced by BPyInit_bgl().

#define MAX_DIMENSIONS   256

Definition at line 288 of file bgl.c.

Referenced by Buffer_new().

#define MethodDef (   func)    {"gl"#func, Method_##func, METH_VARARGS, "no string"}

Referenced by BGL_Wrap().

#define MethodDefu (   func)    {"glu"#func, Method_##func, METH_VARARGS, "no string"}

Referenced by BGL_Wrap().


Function Documentation

Buffer* BGL_MakeBuffer ( int  type,
int  ndimensions,
int *  dimensions,
void *  initbuffer 
) [read]
int BGL_typeSize ( int  type)

Definition at line 239 of file bgl.c.

Referenced by BGL_MakeBuffer(), Buffer_item(), and testBGLBuffer().

BGL_Wrap ( BGL_Wrap(  2,
Accum  ,
BGL_Wrap(  void,
(GLenum, GLfloat)   
)

Definition at line 613 of file bgl.c.

References MethodDef, MethodDefu, and NULL.

PyObject* BPyInit_bgl ( void  )

Definition at line 1296 of file bgl.c.

References EXPP_ADDCONST, and NULL.

static int Buffer_ass_item ( Buffer self,
int  i,
PyObject *  v 
) [static]

Definition at line 435 of file bgl.c.

References Buffer_ass_slice(), Buffer_item(), and _Buffer::dimensions.

Referenced by Buffer_ass_slice(), and Buffer_ass_subscript().

static int Buffer_ass_slice ( Buffer self,
int  begin,
int  end,
PyObject *  seq 
) [static]

Definition at line 472 of file bgl.c.

References Buffer_ass_item(), and err.

Referenced by Buffer_ass_item(), Buffer_ass_subscript(), and Buffer_new().

static int Buffer_ass_subscript ( Buffer self,
PyObject *  item,
PyObject *  value 
) [static]

Definition at line 548 of file bgl.c.

References Buffer_ass_item(), Buffer_ass_slice(), i, and step().

static void Buffer_dealloc ( Buffer self) [static]

Definition at line 581 of file bgl.c.

References MEM_freeN().

static PyObject* Buffer_dimensions ( Buffer self,
void *  UNUSEDarg 
) [static]

Definition at line 114 of file bgl.c.

References i.

static PyObject * Buffer_item ( Buffer self,
int  i 
) [static]
static int Buffer_len ( Buffer self) [static]

Definition at line 368 of file bgl.c.

static PyObject* Buffer_new ( PyTypeObject *  UNUSEDtype,
PyObject *  args,
PyObject *  kwds 
) [static]

Definition at line 289 of file bgl.c.

References BGL_MakeBuffer(), Buffer_ass_slice(), ELEM5, i, init(), MAX_DIMENSIONS, NULL, and STRINGIFY.

static PyObject* Buffer_new ( PyTypeObject *  type,
PyObject *  args,
PyObject *  kwds 
) [static]
static PyObject * Buffer_repr ( Buffer self) [static]

Definition at line 592 of file bgl.c.

References Buffer_to_list_recursive().

static PyObject * Buffer_slice ( Buffer self,
int  begin,
int  end 
) [static]

Definition at line 418 of file bgl.c.

References Buffer_item().

Referenced by Buffer_subscript().

static PyObject * Buffer_subscript ( Buffer self,
PyObject *  item 
) [static]

Definition at line 511 of file bgl.c.

References Buffer_item(), Buffer_slice(), i, NULL, and step().

static PyObject* Buffer_to_list ( Buffer self) [static]

Definition at line 81 of file bgl.c.

References Buffer_item(), i, and len().

Referenced by Buffer_to_list_recursive().

static PyObject* Buffer_to_list_recursive ( Buffer self) [static]

Definition at line 93 of file bgl.c.

References Buffer_item(), Buffer_to_list(), i, and len().

Referenced by Buffer_repr().


Variable Documentation

PyTypeObject BGL_bufferType

Definition at line 138 of file bgl.c.

Referenced by load(), and plot().

struct PyModuleDef BGL_module_def [static]
Initial value:
 {
    PyModuleDef_HEAD_INIT,
    "bgl",  
    NULL,  
    0,  
    BGL_methods,  
    NULL,  
    NULL,  
    NULL,  
    NULL,  
}

Definition at line 1283 of file bgl.c.

PyMappingMethods Buffer_AsMapping [static]
Initial value:
 {
    (lenfunc)Buffer_len,
    (binaryfunc)Buffer_subscript,
    (objobjargproc)Buffer_ass_subscript
}

Definition at line 72 of file bgl.c.

PyGetSetDef Buffer_getseters[] [static]
Initial value:
 {
    {(char *)"dimensions", (getter)Buffer_dimensions, NULL, NULL, NULL},
     {NULL, NULL, NULL, NULL, NULL}
}

Definition at line 132 of file bgl.c.

PyMethodDef Buffer_methods[] [static]
Initial value:
 {
    {"to_list", (PyCFunction)Buffer_to_list_recursive, METH_NOARGS,
     "return the buffer as a list"},
    {NULL, NULL, 0, NULL}
}

Definition at line 126 of file bgl.c.

PySequenceMethods Buffer_SeqMethods [static]
Initial value:
 {
    (lenfunc) Buffer_len,                       
    (binaryfunc) NULL,                          
    (ssizeargfunc) NULL,                        
    (ssizeargfunc) Buffer_item,                 
    (ssizessizeargfunc) NULL,                   
    (ssizeobjargproc) Buffer_ass_item,          
    (ssizessizeobjargproc) NULL,                
    (objobjproc) NULL,                          
    (binaryfunc) NULL,                          
    (ssizeargfunc) NULL,                        
}

Definition at line 58 of file bgl.c.