2011-11-05 08:40:07 +00:00
|
|
|
/*
|
2009-06-17 20:33:34 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2009-06-17 20:33:34 +00:00
|
|
|
*
|
|
|
|
* Contributor(s): Willian P. Germano
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
2011-10-23 17:52:20 +00:00
|
|
|
*/
|
2009-06-17 20:33:34 +00:00
|
|
|
|
2011-02-27 20:10:08 +00:00
|
|
|
/** \file blender/python/generic/bgl.h
|
|
|
|
* \ingroup pygen
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2009-06-17 20:33:34 +00:00
|
|
|
/* This is the Blender.BGL part of opy_draw.c, from the old bpython/intern
|
|
|
|
* dir, with minor changes to adapt it to the new Python implementation.
|
|
|
|
* The BGL submodule "wraps" OpenGL functions and constants, allowing script
|
|
|
|
* writers to make OpenGL calls in their Python scripts for Blender. The
|
|
|
|
* more important original comments are marked with an @ symbol. */
|
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#ifndef __BGL_H__
|
|
|
|
#define __BGL_H__
|
2009-06-17 20:33:34 +00:00
|
|
|
|
2010-10-29 22:59:39 +00:00
|
|
|
PyObject *BPyInit_bgl(void);
|
2009-06-17 20:33:34 +00:00
|
|
|
|
VideoTexture: improvements to image data access API.
- Use BGL buffer instead of string for image data.
- Add buffer interface to image source.
- Allow customization of pixel format.
- Add valid property to check if the image data is available.
The image property of all Image source objects will now
return a BGL 'buffer' object. Previously it was returning
a string, which was not working at all with Python 3.1.
The BGL buffer type allows sequence access to bytes and
is directly usable in BGL OpenGL wrapper functions.
The buffer is formated as a 1 dimensional array of bytes
with 4 bytes per pixel in RGBA order.
BGL buffers will also be accepted in the ImageBuff load()
and plot() functions.
It is possible to customize the pixel format by using
the VideoTexture.imageToArray(image, mode) function:
the first argument is a Image source object, the second
optional argument is a format string using the R, G, B,
A, 0 and 1 characters. For example "BGR" means that each
pixel will be 3 bytes, corresponding to the Blue, Green
and Red channel in that order. Use 0 for a fixed hex 00
value, 1 for hex FF. The default mode is "RGBA".
All Image source objects now support the buffer interface
which allows to create memoryview objects for direct access
to the image internal buffer without memory copy. The buffer
format is one dimensional array of bytes with 4 bytes per
pixel in RGBA order. The buffer is writable, which allows
custom modifications of the image data.
v = memoryview(source)
A bug in the Python 3.1 buffer API will cause a crash if
the memoryview object cannot be created. Therefore, you
must always check first that an image data is available
before creating a memoryview object. Use the new valid
attribute for that:
if source.valid:
v = memoryview(source)
...
Note: the BGL buffer object itself does not yet support
the buffer interface.
Note: the valid attribute makes sense only if you use
image source in conjunction with texture object like this:
# refresh texture but keep image data in memory
texture.refresh(False)
if texture.source.valid:
v = memoryview(texture.source)
# process image
...
# invalidate image for next texture refresh
texture.source.refresh()
Limitation: While memoryview objects exist, the image cannot be
resized. Resizing occurs with ImageViewport objects when the
viewport size is changed or with ImageFFmpeg when a new image
is reloaded for example. Any attempt to resize will cause a
runtime error. Delete the memoryview objects is you want to
resize an image source object.
2010-02-21 22:20:00 +00:00
|
|
|
/*@ Create a buffer object */
|
|
|
|
/*@ dimensions is an array of ndimensions integers representing the size of each dimension */
|
|
|
|
/*@ initbuffer if not NULL holds a contiguous buffer with the correct format from which the buffer will be initialized */
|
2012-03-16 21:39:56 +00:00
|
|
|
struct _Buffer *BGL_MakeBuffer(int type, int ndimensions, int *dimensions, void *initbuffer);
|
VideoTexture: improvements to image data access API.
- Use BGL buffer instead of string for image data.
- Add buffer interface to image source.
- Allow customization of pixel format.
- Add valid property to check if the image data is available.
The image property of all Image source objects will now
return a BGL 'buffer' object. Previously it was returning
a string, which was not working at all with Python 3.1.
The BGL buffer type allows sequence access to bytes and
is directly usable in BGL OpenGL wrapper functions.
The buffer is formated as a 1 dimensional array of bytes
with 4 bytes per pixel in RGBA order.
BGL buffers will also be accepted in the ImageBuff load()
and plot() functions.
It is possible to customize the pixel format by using
the VideoTexture.imageToArray(image, mode) function:
the first argument is a Image source object, the second
optional argument is a format string using the R, G, B,
A, 0 and 1 characters. For example "BGR" means that each
pixel will be 3 bytes, corresponding to the Blue, Green
and Red channel in that order. Use 0 for a fixed hex 00
value, 1 for hex FF. The default mode is "RGBA".
All Image source objects now support the buffer interface
which allows to create memoryview objects for direct access
to the image internal buffer without memory copy. The buffer
format is one dimensional array of bytes with 4 bytes per
pixel in RGBA order. The buffer is writable, which allows
custom modifications of the image data.
v = memoryview(source)
A bug in the Python 3.1 buffer API will cause a crash if
the memoryview object cannot be created. Therefore, you
must always check first that an image data is available
before creating a memoryview object. Use the new valid
attribute for that:
if source.valid:
v = memoryview(source)
...
Note: the BGL buffer object itself does not yet support
the buffer interface.
Note: the valid attribute makes sense only if you use
image source in conjunction with texture object like this:
# refresh texture but keep image data in memory
texture.refresh(False)
if texture.source.valid:
v = memoryview(texture.source)
# process image
...
# invalidate image for next texture refresh
texture.source.refresh()
Limitation: While memoryview objects exist, the image cannot be
resized. Resizing occurs with ImageViewport objects when the
viewport size is changed or with ImageFFmpeg when a new image
is reloaded for example. Any attempt to resize will cause a
runtime error. Delete the memoryview objects is you want to
resize an image source object.
2010-02-21 22:20:00 +00:00
|
|
|
/*@ Return the size of buffer element, type must be one of GL_BYTE, GL_SHORT, GL_INT, GL_FLOAT or GL_DOUBLE */
|
|
|
|
/*@ returns -1 otherwise */
|
2012-03-16 21:39:56 +00:00
|
|
|
int BGL_typeSize(int type);
|
VideoTexture: improvements to image data access API.
- Use BGL buffer instead of string for image data.
- Add buffer interface to image source.
- Allow customization of pixel format.
- Add valid property to check if the image data is available.
The image property of all Image source objects will now
return a BGL 'buffer' object. Previously it was returning
a string, which was not working at all with Python 3.1.
The BGL buffer type allows sequence access to bytes and
is directly usable in BGL OpenGL wrapper functions.
The buffer is formated as a 1 dimensional array of bytes
with 4 bytes per pixel in RGBA order.
BGL buffers will also be accepted in the ImageBuff load()
and plot() functions.
It is possible to customize the pixel format by using
the VideoTexture.imageToArray(image, mode) function:
the first argument is a Image source object, the second
optional argument is a format string using the R, G, B,
A, 0 and 1 characters. For example "BGR" means that each
pixel will be 3 bytes, corresponding to the Blue, Green
and Red channel in that order. Use 0 for a fixed hex 00
value, 1 for hex FF. The default mode is "RGBA".
All Image source objects now support the buffer interface
which allows to create memoryview objects for direct access
to the image internal buffer without memory copy. The buffer
format is one dimensional array of bytes with 4 bytes per
pixel in RGBA order. The buffer is writable, which allows
custom modifications of the image data.
v = memoryview(source)
A bug in the Python 3.1 buffer API will cause a crash if
the memoryview object cannot be created. Therefore, you
must always check first that an image data is available
before creating a memoryview object. Use the new valid
attribute for that:
if source.valid:
v = memoryview(source)
...
Note: the BGL buffer object itself does not yet support
the buffer interface.
Note: the valid attribute makes sense only if you use
image source in conjunction with texture object like this:
# refresh texture but keep image data in memory
texture.refresh(False)
if texture.source.valid:
v = memoryview(texture.source)
# process image
...
# invalidate image for next texture refresh
texture.source.refresh()
Limitation: While memoryview objects exist, the image cannot be
resized. Resizing occurs with ImageViewport objects when the
viewport size is changed or with ImageFFmpeg when a new image
is reloaded for example. Any attempt to resize will cause a
runtime error. Delete the memoryview objects is you want to
resize an image source object.
2010-02-21 22:20:00 +00:00
|
|
|
|
2009-06-17 20:33:34 +00:00
|
|
|
/*@ Buffer Object */
|
|
|
|
/*@ For Python access to OpenGL functions requiring a pointer. */
|
|
|
|
typedef struct _Buffer {
|
|
|
|
PyObject_VAR_HEAD
|
2011-06-02 08:29:16 +00:00
|
|
|
PyObject *parent;
|
2009-06-17 20:33:34 +00:00
|
|
|
|
|
|
|
int type; /* GL_BYTE, GL_SHORT, GL_INT, GL_FLOAT */
|
|
|
|
int ndimensions;
|
|
|
|
int *dimensions;
|
|
|
|
|
|
|
|
union {
|
|
|
|
char *asbyte;
|
|
|
|
short *asshort;
|
|
|
|
int *asint;
|
|
|
|
float *asfloat;
|
|
|
|
double *asdouble;
|
|
|
|
|
|
|
|
void *asvoid;
|
|
|
|
} buf;
|
|
|
|
} Buffer;
|
|
|
|
|
VideoTexture: improvements to image data access API.
- Use BGL buffer instead of string for image data.
- Add buffer interface to image source.
- Allow customization of pixel format.
- Add valid property to check if the image data is available.
The image property of all Image source objects will now
return a BGL 'buffer' object. Previously it was returning
a string, which was not working at all with Python 3.1.
The BGL buffer type allows sequence access to bytes and
is directly usable in BGL OpenGL wrapper functions.
The buffer is formated as a 1 dimensional array of bytes
with 4 bytes per pixel in RGBA order.
BGL buffers will also be accepted in the ImageBuff load()
and plot() functions.
It is possible to customize the pixel format by using
the VideoTexture.imageToArray(image, mode) function:
the first argument is a Image source object, the second
optional argument is a format string using the R, G, B,
A, 0 and 1 characters. For example "BGR" means that each
pixel will be 3 bytes, corresponding to the Blue, Green
and Red channel in that order. Use 0 for a fixed hex 00
value, 1 for hex FF. The default mode is "RGBA".
All Image source objects now support the buffer interface
which allows to create memoryview objects for direct access
to the image internal buffer without memory copy. The buffer
format is one dimensional array of bytes with 4 bytes per
pixel in RGBA order. The buffer is writable, which allows
custom modifications of the image data.
v = memoryview(source)
A bug in the Python 3.1 buffer API will cause a crash if
the memoryview object cannot be created. Therefore, you
must always check first that an image data is available
before creating a memoryview object. Use the new valid
attribute for that:
if source.valid:
v = memoryview(source)
...
Note: the BGL buffer object itself does not yet support
the buffer interface.
Note: the valid attribute makes sense only if you use
image source in conjunction with texture object like this:
# refresh texture but keep image data in memory
texture.refresh(False)
if texture.source.valid:
v = memoryview(texture.source)
# process image
...
# invalidate image for next texture refresh
texture.source.refresh()
Limitation: While memoryview objects exist, the image cannot be
resized. Resizing occurs with ImageViewport objects when the
viewport size is changed or with ImageFFmpeg when a new image
is reloaded for example. Any attempt to resize will cause a
runtime error. Delete the memoryview objects is you want to
resize an image source object.
2010-02-21 22:20:00 +00:00
|
|
|
/*@ The type object */
|
|
|
|
extern PyTypeObject BGL_bufferType;
|
2009-06-17 20:33:34 +00:00
|
|
|
|
|
|
|
/*@ By golly George! It looks like fancy pants macro time!!! */
|
|
|
|
|
2012-03-03 20:36:09 +00:00
|
|
|
#if 0 /* unused so far */
|
2009-06-17 20:33:34 +00:00
|
|
|
#define int_str "i"
|
|
|
|
#define int_var(number) bgl_int##number
|
|
|
|
#define int_ref(number) &bgl_int##number
|
|
|
|
#define int_def(number) int int_var(number)
|
|
|
|
|
|
|
|
#define float_str "f"
|
|
|
|
#define float_var(number) bgl_float##number
|
|
|
|
#define float_ref(number) &bgl_float##number
|
|
|
|
#define float_def(number) float float_var(number)
|
2012-03-03 20:36:09 +00:00
|
|
|
#endif
|
2009-06-17 20:33:34 +00:00
|
|
|
|
|
|
|
/* TYPE_str is the string to pass to Py_ArgParse (for the format) */
|
|
|
|
/* TYPE_var is the name to pass to the GL function */
|
|
|
|
/* TYPE_ref is the pointer to pass to Py_ArgParse (to store in) */
|
|
|
|
/* TYPE_def is the C initialization of the variable */
|
|
|
|
|
|
|
|
#define void_str ""
|
|
|
|
#define void_var(num)
|
|
|
|
#define void_ref(num) &bgl_var##num
|
|
|
|
#define void_def(num) char bgl_var##num
|
|
|
|
|
|
|
|
#define buffer_str "O!"
|
|
|
|
#define buffer_var(number) (bgl_buffer##number)->buf.asvoid
|
VideoTexture: improvements to image data access API.
- Use BGL buffer instead of string for image data.
- Add buffer interface to image source.
- Allow customization of pixel format.
- Add valid property to check if the image data is available.
The image property of all Image source objects will now
return a BGL 'buffer' object. Previously it was returning
a string, which was not working at all with Python 3.1.
The BGL buffer type allows sequence access to bytes and
is directly usable in BGL OpenGL wrapper functions.
The buffer is formated as a 1 dimensional array of bytes
with 4 bytes per pixel in RGBA order.
BGL buffers will also be accepted in the ImageBuff load()
and plot() functions.
It is possible to customize the pixel format by using
the VideoTexture.imageToArray(image, mode) function:
the first argument is a Image source object, the second
optional argument is a format string using the R, G, B,
A, 0 and 1 characters. For example "BGR" means that each
pixel will be 3 bytes, corresponding to the Blue, Green
and Red channel in that order. Use 0 for a fixed hex 00
value, 1 for hex FF. The default mode is "RGBA".
All Image source objects now support the buffer interface
which allows to create memoryview objects for direct access
to the image internal buffer without memory copy. The buffer
format is one dimensional array of bytes with 4 bytes per
pixel in RGBA order. The buffer is writable, which allows
custom modifications of the image data.
v = memoryview(source)
A bug in the Python 3.1 buffer API will cause a crash if
the memoryview object cannot be created. Therefore, you
must always check first that an image data is available
before creating a memoryview object. Use the new valid
attribute for that:
if source.valid:
v = memoryview(source)
...
Note: the BGL buffer object itself does not yet support
the buffer interface.
Note: the valid attribute makes sense only if you use
image source in conjunction with texture object like this:
# refresh texture but keep image data in memory
texture.refresh(False)
if texture.source.valid:
v = memoryview(texture.source)
# process image
...
# invalidate image for next texture refresh
texture.source.refresh()
Limitation: While memoryview objects exist, the image cannot be
resized. Resizing occurs with ImageViewport objects when the
viewport size is changed or with ImageFFmpeg when a new image
is reloaded for example. Any attempt to resize will cause a
runtime error. Delete the memoryview objects is you want to
resize an image source object.
2010-02-21 22:20:00 +00:00
|
|
|
#define buffer_ref(number) &BGL_bufferType, &bgl_buffer##number
|
2009-06-17 20:33:34 +00:00
|
|
|
#define buffer_def(number) Buffer *bgl_buffer##number
|
|
|
|
|
|
|
|
/* GL Pointer fields, handled by buffer type */
|
2012-05-09 02:42:30 +00:00
|
|
|
/* GLdoubleP, GLfloatP, GLintP, GLuintP, GLshortP, GLsizeiP, GLcharP */
|
2009-06-17 20:33:34 +00:00
|
|
|
|
|
|
|
#define GLbooleanP_str "O!"
|
|
|
|
#define GLbooleanP_var(number) (bgl_buffer##number)->buf.asvoid
|
VideoTexture: improvements to image data access API.
- Use BGL buffer instead of string for image data.
- Add buffer interface to image source.
- Allow customization of pixel format.
- Add valid property to check if the image data is available.
The image property of all Image source objects will now
return a BGL 'buffer' object. Previously it was returning
a string, which was not working at all with Python 3.1.
The BGL buffer type allows sequence access to bytes and
is directly usable in BGL OpenGL wrapper functions.
The buffer is formated as a 1 dimensional array of bytes
with 4 bytes per pixel in RGBA order.
BGL buffers will also be accepted in the ImageBuff load()
and plot() functions.
It is possible to customize the pixel format by using
the VideoTexture.imageToArray(image, mode) function:
the first argument is a Image source object, the second
optional argument is a format string using the R, G, B,
A, 0 and 1 characters. For example "BGR" means that each
pixel will be 3 bytes, corresponding to the Blue, Green
and Red channel in that order. Use 0 for a fixed hex 00
value, 1 for hex FF. The default mode is "RGBA".
All Image source objects now support the buffer interface
which allows to create memoryview objects for direct access
to the image internal buffer without memory copy. The buffer
format is one dimensional array of bytes with 4 bytes per
pixel in RGBA order. The buffer is writable, which allows
custom modifications of the image data.
v = memoryview(source)
A bug in the Python 3.1 buffer API will cause a crash if
the memoryview object cannot be created. Therefore, you
must always check first that an image data is available
before creating a memoryview object. Use the new valid
attribute for that:
if source.valid:
v = memoryview(source)
...
Note: the BGL buffer object itself does not yet support
the buffer interface.
Note: the valid attribute makes sense only if you use
image source in conjunction with texture object like this:
# refresh texture but keep image data in memory
texture.refresh(False)
if texture.source.valid:
v = memoryview(texture.source)
# process image
...
# invalidate image for next texture refresh
texture.source.refresh()
Limitation: While memoryview objects exist, the image cannot be
resized. Resizing occurs with ImageViewport objects when the
viewport size is changed or with ImageFFmpeg when a new image
is reloaded for example. Any attempt to resize will cause a
runtime error. Delete the memoryview objects is you want to
resize an image source object.
2010-02-21 22:20:00 +00:00
|
|
|
#define GLbooleanP_ref(number) &BGL_bufferType, &bgl_buffer##number
|
2009-06-17 20:33:34 +00:00
|
|
|
#define GLbooleanP_def(number) Buffer *bgl_buffer##number
|
|
|
|
|
|
|
|
#define GLbyteP_str "O!"
|
|
|
|
#define GLbyteP_var(number) (bgl_buffer##number)->buf.asvoid
|
VideoTexture: improvements to image data access API.
- Use BGL buffer instead of string for image data.
- Add buffer interface to image source.
- Allow customization of pixel format.
- Add valid property to check if the image data is available.
The image property of all Image source objects will now
return a BGL 'buffer' object. Previously it was returning
a string, which was not working at all with Python 3.1.
The BGL buffer type allows sequence access to bytes and
is directly usable in BGL OpenGL wrapper functions.
The buffer is formated as a 1 dimensional array of bytes
with 4 bytes per pixel in RGBA order.
BGL buffers will also be accepted in the ImageBuff load()
and plot() functions.
It is possible to customize the pixel format by using
the VideoTexture.imageToArray(image, mode) function:
the first argument is a Image source object, the second
optional argument is a format string using the R, G, B,
A, 0 and 1 characters. For example "BGR" means that each
pixel will be 3 bytes, corresponding to the Blue, Green
and Red channel in that order. Use 0 for a fixed hex 00
value, 1 for hex FF. The default mode is "RGBA".
All Image source objects now support the buffer interface
which allows to create memoryview objects for direct access
to the image internal buffer without memory copy. The buffer
format is one dimensional array of bytes with 4 bytes per
pixel in RGBA order. The buffer is writable, which allows
custom modifications of the image data.
v = memoryview(source)
A bug in the Python 3.1 buffer API will cause a crash if
the memoryview object cannot be created. Therefore, you
must always check first that an image data is available
before creating a memoryview object. Use the new valid
attribute for that:
if source.valid:
v = memoryview(source)
...
Note: the BGL buffer object itself does not yet support
the buffer interface.
Note: the valid attribute makes sense only if you use
image source in conjunction with texture object like this:
# refresh texture but keep image data in memory
texture.refresh(False)
if texture.source.valid:
v = memoryview(texture.source)
# process image
...
# invalidate image for next texture refresh
texture.source.refresh()
Limitation: While memoryview objects exist, the image cannot be
resized. Resizing occurs with ImageViewport objects when the
viewport size is changed or with ImageFFmpeg when a new image
is reloaded for example. Any attempt to resize will cause a
runtime error. Delete the memoryview objects is you want to
resize an image source object.
2010-02-21 22:20:00 +00:00
|
|
|
#define GLbyteP_ref(number) &BGL_bufferType, &bgl_buffer##number
|
2009-06-17 20:33:34 +00:00
|
|
|
#define GLbyteP_def(number) Buffer *bgl_buffer##number
|
|
|
|
|
|
|
|
#define GLubyteP_str "O!"
|
|
|
|
#define GLubyteP_var(number) (bgl_buffer##number)->buf.asvoid
|
VideoTexture: improvements to image data access API.
- Use BGL buffer instead of string for image data.
- Add buffer interface to image source.
- Allow customization of pixel format.
- Add valid property to check if the image data is available.
The image property of all Image source objects will now
return a BGL 'buffer' object. Previously it was returning
a string, which was not working at all with Python 3.1.
The BGL buffer type allows sequence access to bytes and
is directly usable in BGL OpenGL wrapper functions.
The buffer is formated as a 1 dimensional array of bytes
with 4 bytes per pixel in RGBA order.
BGL buffers will also be accepted in the ImageBuff load()
and plot() functions.
It is possible to customize the pixel format by using
the VideoTexture.imageToArray(image, mode) function:
the first argument is a Image source object, the second
optional argument is a format string using the R, G, B,
A, 0 and 1 characters. For example "BGR" means that each
pixel will be 3 bytes, corresponding to the Blue, Green
and Red channel in that order. Use 0 for a fixed hex 00
value, 1 for hex FF. The default mode is "RGBA".
All Image source objects now support the buffer interface
which allows to create memoryview objects for direct access
to the image internal buffer without memory copy. The buffer
format is one dimensional array of bytes with 4 bytes per
pixel in RGBA order. The buffer is writable, which allows
custom modifications of the image data.
v = memoryview(source)
A bug in the Python 3.1 buffer API will cause a crash if
the memoryview object cannot be created. Therefore, you
must always check first that an image data is available
before creating a memoryview object. Use the new valid
attribute for that:
if source.valid:
v = memoryview(source)
...
Note: the BGL buffer object itself does not yet support
the buffer interface.
Note: the valid attribute makes sense only if you use
image source in conjunction with texture object like this:
# refresh texture but keep image data in memory
texture.refresh(False)
if texture.source.valid:
v = memoryview(texture.source)
# process image
...
# invalidate image for next texture refresh
texture.source.refresh()
Limitation: While memoryview objects exist, the image cannot be
resized. Resizing occurs with ImageViewport objects when the
viewport size is changed or with ImageFFmpeg when a new image
is reloaded for example. Any attempt to resize will cause a
runtime error. Delete the memoryview objects is you want to
resize an image source object.
2010-02-21 22:20:00 +00:00
|
|
|
#define GLubyteP_ref(number) &BGL_bufferType, &bgl_buffer##number
|
2009-06-17 20:33:34 +00:00
|
|
|
#define GLubyteP_def(number) Buffer *bgl_buffer##number
|
|
|
|
|
|
|
|
#define GLintP_str "O!"
|
|
|
|
#define GLintP_var(number) (bgl_buffer##number)->buf.asvoid
|
VideoTexture: improvements to image data access API.
- Use BGL buffer instead of string for image data.
- Add buffer interface to image source.
- Allow customization of pixel format.
- Add valid property to check if the image data is available.
The image property of all Image source objects will now
return a BGL 'buffer' object. Previously it was returning
a string, which was not working at all with Python 3.1.
The BGL buffer type allows sequence access to bytes and
is directly usable in BGL OpenGL wrapper functions.
The buffer is formated as a 1 dimensional array of bytes
with 4 bytes per pixel in RGBA order.
BGL buffers will also be accepted in the ImageBuff load()
and plot() functions.
It is possible to customize the pixel format by using
the VideoTexture.imageToArray(image, mode) function:
the first argument is a Image source object, the second
optional argument is a format string using the R, G, B,
A, 0 and 1 characters. For example "BGR" means that each
pixel will be 3 bytes, corresponding to the Blue, Green
and Red channel in that order. Use 0 for a fixed hex 00
value, 1 for hex FF. The default mode is "RGBA".
All Image source objects now support the buffer interface
which allows to create memoryview objects for direct access
to the image internal buffer without memory copy. The buffer
format is one dimensional array of bytes with 4 bytes per
pixel in RGBA order. The buffer is writable, which allows
custom modifications of the image data.
v = memoryview(source)
A bug in the Python 3.1 buffer API will cause a crash if
the memoryview object cannot be created. Therefore, you
must always check first that an image data is available
before creating a memoryview object. Use the new valid
attribute for that:
if source.valid:
v = memoryview(source)
...
Note: the BGL buffer object itself does not yet support
the buffer interface.
Note: the valid attribute makes sense only if you use
image source in conjunction with texture object like this:
# refresh texture but keep image data in memory
texture.refresh(False)
if texture.source.valid:
v = memoryview(texture.source)
# process image
...
# invalidate image for next texture refresh
texture.source.refresh()
Limitation: While memoryview objects exist, the image cannot be
resized. Resizing occurs with ImageViewport objects when the
viewport size is changed or with ImageFFmpeg when a new image
is reloaded for example. Any attempt to resize will cause a
runtime error. Delete the memoryview objects is you want to
resize an image source object.
2010-02-21 22:20:00 +00:00
|
|
|
#define GLintP_ref(number) &BGL_bufferType, &bgl_buffer##number
|
2009-06-17 20:33:34 +00:00
|
|
|
#define GLintP_def(number) Buffer *bgl_buffer##number
|
|
|
|
|
|
|
|
#define GLuintP_str "O!"
|
|
|
|
#define GLuintP_var(number) (bgl_buffer##number)->buf.asvoid
|
VideoTexture: improvements to image data access API.
- Use BGL buffer instead of string for image data.
- Add buffer interface to image source.
- Allow customization of pixel format.
- Add valid property to check if the image data is available.
The image property of all Image source objects will now
return a BGL 'buffer' object. Previously it was returning
a string, which was not working at all with Python 3.1.
The BGL buffer type allows sequence access to bytes and
is directly usable in BGL OpenGL wrapper functions.
The buffer is formated as a 1 dimensional array of bytes
with 4 bytes per pixel in RGBA order.
BGL buffers will also be accepted in the ImageBuff load()
and plot() functions.
It is possible to customize the pixel format by using
the VideoTexture.imageToArray(image, mode) function:
the first argument is a Image source object, the second
optional argument is a format string using the R, G, B,
A, 0 and 1 characters. For example "BGR" means that each
pixel will be 3 bytes, corresponding to the Blue, Green
and Red channel in that order. Use 0 for a fixed hex 00
value, 1 for hex FF. The default mode is "RGBA".
All Image source objects now support the buffer interface
which allows to create memoryview objects for direct access
to the image internal buffer without memory copy. The buffer
format is one dimensional array of bytes with 4 bytes per
pixel in RGBA order. The buffer is writable, which allows
custom modifications of the image data.
v = memoryview(source)
A bug in the Python 3.1 buffer API will cause a crash if
the memoryview object cannot be created. Therefore, you
must always check first that an image data is available
before creating a memoryview object. Use the new valid
attribute for that:
if source.valid:
v = memoryview(source)
...
Note: the BGL buffer object itself does not yet support
the buffer interface.
Note: the valid attribute makes sense only if you use
image source in conjunction with texture object like this:
# refresh texture but keep image data in memory
texture.refresh(False)
if texture.source.valid:
v = memoryview(texture.source)
# process image
...
# invalidate image for next texture refresh
texture.source.refresh()
Limitation: While memoryview objects exist, the image cannot be
resized. Resizing occurs with ImageViewport objects when the
viewport size is changed or with ImageFFmpeg when a new image
is reloaded for example. Any attempt to resize will cause a
runtime error. Delete the memoryview objects is you want to
resize an image source object.
2010-02-21 22:20:00 +00:00
|
|
|
#define GLuintP_ref(number) &BGL_bufferType, &bgl_buffer##number
|
2009-06-17 20:33:34 +00:00
|
|
|
#define GLuintP_def(number) Buffer *bgl_buffer##number
|
|
|
|
|
|
|
|
#define GLshortP_str "O!"
|
|
|
|
#define GLshortP_var(number) (bgl_buffer##number)->buf.asvoid
|
VideoTexture: improvements to image data access API.
- Use BGL buffer instead of string for image data.
- Add buffer interface to image source.
- Allow customization of pixel format.
- Add valid property to check if the image data is available.
The image property of all Image source objects will now
return a BGL 'buffer' object. Previously it was returning
a string, which was not working at all with Python 3.1.
The BGL buffer type allows sequence access to bytes and
is directly usable in BGL OpenGL wrapper functions.
The buffer is formated as a 1 dimensional array of bytes
with 4 bytes per pixel in RGBA order.
BGL buffers will also be accepted in the ImageBuff load()
and plot() functions.
It is possible to customize the pixel format by using
the VideoTexture.imageToArray(image, mode) function:
the first argument is a Image source object, the second
optional argument is a format string using the R, G, B,
A, 0 and 1 characters. For example "BGR" means that each
pixel will be 3 bytes, corresponding to the Blue, Green
and Red channel in that order. Use 0 for a fixed hex 00
value, 1 for hex FF. The default mode is "RGBA".
All Image source objects now support the buffer interface
which allows to create memoryview objects for direct access
to the image internal buffer without memory copy. The buffer
format is one dimensional array of bytes with 4 bytes per
pixel in RGBA order. The buffer is writable, which allows
custom modifications of the image data.
v = memoryview(source)
A bug in the Python 3.1 buffer API will cause a crash if
the memoryview object cannot be created. Therefore, you
must always check first that an image data is available
before creating a memoryview object. Use the new valid
attribute for that:
if source.valid:
v = memoryview(source)
...
Note: the BGL buffer object itself does not yet support
the buffer interface.
Note: the valid attribute makes sense only if you use
image source in conjunction with texture object like this:
# refresh texture but keep image data in memory
texture.refresh(False)
if texture.source.valid:
v = memoryview(texture.source)
# process image
...
# invalidate image for next texture refresh
texture.source.refresh()
Limitation: While memoryview objects exist, the image cannot be
resized. Resizing occurs with ImageViewport objects when the
viewport size is changed or with ImageFFmpeg when a new image
is reloaded for example. Any attempt to resize will cause a
runtime error. Delete the memoryview objects is you want to
resize an image source object.
2010-02-21 22:20:00 +00:00
|
|
|
#define GLshortP_ref(number) &BGL_bufferType, &bgl_buffer##number
|
2009-06-17 20:33:34 +00:00
|
|
|
#define GLshortP_def(number) Buffer *bgl_buffer##number
|
|
|
|
|
|
|
|
#define GLushortP_str "O!"
|
|
|
|
#define GLushortP_var(number) (bgl_buffer##number)->buf.asvoid
|
VideoTexture: improvements to image data access API.
- Use BGL buffer instead of string for image data.
- Add buffer interface to image source.
- Allow customization of pixel format.
- Add valid property to check if the image data is available.
The image property of all Image source objects will now
return a BGL 'buffer' object. Previously it was returning
a string, which was not working at all with Python 3.1.
The BGL buffer type allows sequence access to bytes and
is directly usable in BGL OpenGL wrapper functions.
The buffer is formated as a 1 dimensional array of bytes
with 4 bytes per pixel in RGBA order.
BGL buffers will also be accepted in the ImageBuff load()
and plot() functions.
It is possible to customize the pixel format by using
the VideoTexture.imageToArray(image, mode) function:
the first argument is a Image source object, the second
optional argument is a format string using the R, G, B,
A, 0 and 1 characters. For example "BGR" means that each
pixel will be 3 bytes, corresponding to the Blue, Green
and Red channel in that order. Use 0 for a fixed hex 00
value, 1 for hex FF. The default mode is "RGBA".
All Image source objects now support the buffer interface
which allows to create memoryview objects for direct access
to the image internal buffer without memory copy. The buffer
format is one dimensional array of bytes with 4 bytes per
pixel in RGBA order. The buffer is writable, which allows
custom modifications of the image data.
v = memoryview(source)
A bug in the Python 3.1 buffer API will cause a crash if
the memoryview object cannot be created. Therefore, you
must always check first that an image data is available
before creating a memoryview object. Use the new valid
attribute for that:
if source.valid:
v = memoryview(source)
...
Note: the BGL buffer object itself does not yet support
the buffer interface.
Note: the valid attribute makes sense only if you use
image source in conjunction with texture object like this:
# refresh texture but keep image data in memory
texture.refresh(False)
if texture.source.valid:
v = memoryview(texture.source)
# process image
...
# invalidate image for next texture refresh
texture.source.refresh()
Limitation: While memoryview objects exist, the image cannot be
resized. Resizing occurs with ImageViewport objects when the
viewport size is changed or with ImageFFmpeg when a new image
is reloaded for example. Any attempt to resize will cause a
runtime error. Delete the memoryview objects is you want to
resize an image source object.
2010-02-21 22:20:00 +00:00
|
|
|
#define GLushortP_ref(number) &BGL_bufferType, &bgl_buffer##number
|
2009-06-17 20:33:34 +00:00
|
|
|
#define GLushortP_def(number) Buffer *bgl_buffer##number
|
|
|
|
|
|
|
|
#define GLfloatP_str "O!"
|
|
|
|
#define GLfloatP_var(number) (bgl_buffer##number)->buf.asvoid
|
VideoTexture: improvements to image data access API.
- Use BGL buffer instead of string for image data.
- Add buffer interface to image source.
- Allow customization of pixel format.
- Add valid property to check if the image data is available.
The image property of all Image source objects will now
return a BGL 'buffer' object. Previously it was returning
a string, which was not working at all with Python 3.1.
The BGL buffer type allows sequence access to bytes and
is directly usable in BGL OpenGL wrapper functions.
The buffer is formated as a 1 dimensional array of bytes
with 4 bytes per pixel in RGBA order.
BGL buffers will also be accepted in the ImageBuff load()
and plot() functions.
It is possible to customize the pixel format by using
the VideoTexture.imageToArray(image, mode) function:
the first argument is a Image source object, the second
optional argument is a format string using the R, G, B,
A, 0 and 1 characters. For example "BGR" means that each
pixel will be 3 bytes, corresponding to the Blue, Green
and Red channel in that order. Use 0 for a fixed hex 00
value, 1 for hex FF. The default mode is "RGBA".
All Image source objects now support the buffer interface
which allows to create memoryview objects for direct access
to the image internal buffer without memory copy. The buffer
format is one dimensional array of bytes with 4 bytes per
pixel in RGBA order. The buffer is writable, which allows
custom modifications of the image data.
v = memoryview(source)
A bug in the Python 3.1 buffer API will cause a crash if
the memoryview object cannot be created. Therefore, you
must always check first that an image data is available
before creating a memoryview object. Use the new valid
attribute for that:
if source.valid:
v = memoryview(source)
...
Note: the BGL buffer object itself does not yet support
the buffer interface.
Note: the valid attribute makes sense only if you use
image source in conjunction with texture object like this:
# refresh texture but keep image data in memory
texture.refresh(False)
if texture.source.valid:
v = memoryview(texture.source)
# process image
...
# invalidate image for next texture refresh
texture.source.refresh()
Limitation: While memoryview objects exist, the image cannot be
resized. Resizing occurs with ImageViewport objects when the
viewport size is changed or with ImageFFmpeg when a new image
is reloaded for example. Any attempt to resize will cause a
runtime error. Delete the memoryview objects is you want to
resize an image source object.
2010-02-21 22:20:00 +00:00
|
|
|
#define GLfloatP_ref(number) &BGL_bufferType, &bgl_buffer##number
|
2009-06-17 20:33:34 +00:00
|
|
|
#define GLfloatP_def(number) Buffer *bgl_buffer##number
|
|
|
|
|
|
|
|
#define GLdoubleP_str "O!"
|
|
|
|
#define GLdoubleP_var(number) (bgl_buffer##number)->buf.asvoid
|
VideoTexture: improvements to image data access API.
- Use BGL buffer instead of string for image data.
- Add buffer interface to image source.
- Allow customization of pixel format.
- Add valid property to check if the image data is available.
The image property of all Image source objects will now
return a BGL 'buffer' object. Previously it was returning
a string, which was not working at all with Python 3.1.
The BGL buffer type allows sequence access to bytes and
is directly usable in BGL OpenGL wrapper functions.
The buffer is formated as a 1 dimensional array of bytes
with 4 bytes per pixel in RGBA order.
BGL buffers will also be accepted in the ImageBuff load()
and plot() functions.
It is possible to customize the pixel format by using
the VideoTexture.imageToArray(image, mode) function:
the first argument is a Image source object, the second
optional argument is a format string using the R, G, B,
A, 0 and 1 characters. For example "BGR" means that each
pixel will be 3 bytes, corresponding to the Blue, Green
and Red channel in that order. Use 0 for a fixed hex 00
value, 1 for hex FF. The default mode is "RGBA".
All Image source objects now support the buffer interface
which allows to create memoryview objects for direct access
to the image internal buffer without memory copy. The buffer
format is one dimensional array of bytes with 4 bytes per
pixel in RGBA order. The buffer is writable, which allows
custom modifications of the image data.
v = memoryview(source)
A bug in the Python 3.1 buffer API will cause a crash if
the memoryview object cannot be created. Therefore, you
must always check first that an image data is available
before creating a memoryview object. Use the new valid
attribute for that:
if source.valid:
v = memoryview(source)
...
Note: the BGL buffer object itself does not yet support
the buffer interface.
Note: the valid attribute makes sense only if you use
image source in conjunction with texture object like this:
# refresh texture but keep image data in memory
texture.refresh(False)
if texture.source.valid:
v = memoryview(texture.source)
# process image
...
# invalidate image for next texture refresh
texture.source.refresh()
Limitation: While memoryview objects exist, the image cannot be
resized. Resizing occurs with ImageViewport objects when the
viewport size is changed or with ImageFFmpeg when a new image
is reloaded for example. Any attempt to resize will cause a
runtime error. Delete the memoryview objects is you want to
resize an image source object.
2010-02-21 22:20:00 +00:00
|
|
|
#define GLdoubleP_ref(number) &BGL_bufferType, &bgl_buffer##number
|
2009-06-17 20:33:34 +00:00
|
|
|
#define GLdoubleP_def(number) Buffer *bgl_buffer##number
|
|
|
|
|
|
|
|
#define GLclampfP_str "O!"
|
|
|
|
#define GLclampfP_var(number) (bgl_buffer##number)->buf.asvoid
|
VideoTexture: improvements to image data access API.
- Use BGL buffer instead of string for image data.
- Add buffer interface to image source.
- Allow customization of pixel format.
- Add valid property to check if the image data is available.
The image property of all Image source objects will now
return a BGL 'buffer' object. Previously it was returning
a string, which was not working at all with Python 3.1.
The BGL buffer type allows sequence access to bytes and
is directly usable in BGL OpenGL wrapper functions.
The buffer is formated as a 1 dimensional array of bytes
with 4 bytes per pixel in RGBA order.
BGL buffers will also be accepted in the ImageBuff load()
and plot() functions.
It is possible to customize the pixel format by using
the VideoTexture.imageToArray(image, mode) function:
the first argument is a Image source object, the second
optional argument is a format string using the R, G, B,
A, 0 and 1 characters. For example "BGR" means that each
pixel will be 3 bytes, corresponding to the Blue, Green
and Red channel in that order. Use 0 for a fixed hex 00
value, 1 for hex FF. The default mode is "RGBA".
All Image source objects now support the buffer interface
which allows to create memoryview objects for direct access
to the image internal buffer without memory copy. The buffer
format is one dimensional array of bytes with 4 bytes per
pixel in RGBA order. The buffer is writable, which allows
custom modifications of the image data.
v = memoryview(source)
A bug in the Python 3.1 buffer API will cause a crash if
the memoryview object cannot be created. Therefore, you
must always check first that an image data is available
before creating a memoryview object. Use the new valid
attribute for that:
if source.valid:
v = memoryview(source)
...
Note: the BGL buffer object itself does not yet support
the buffer interface.
Note: the valid attribute makes sense only if you use
image source in conjunction with texture object like this:
# refresh texture but keep image data in memory
texture.refresh(False)
if texture.source.valid:
v = memoryview(texture.source)
# process image
...
# invalidate image for next texture refresh
texture.source.refresh()
Limitation: While memoryview objects exist, the image cannot be
resized. Resizing occurs with ImageViewport objects when the
viewport size is changed or with ImageFFmpeg when a new image
is reloaded for example. Any attempt to resize will cause a
runtime error. Delete the memoryview objects is you want to
resize an image source object.
2010-02-21 22:20:00 +00:00
|
|
|
#define GLclampfP_ref(number) &BGL_bufferType, &bgl_buffer##number
|
2009-06-17 20:33:34 +00:00
|
|
|
#define GLclampfP_def(number) Buffer *bgl_buffer##number
|
|
|
|
|
|
|
|
#define GLvoidP_str "O!"
|
|
|
|
#define GLvoidP_var(number) (bgl_buffer##number)->buf.asvoid
|
VideoTexture: improvements to image data access API.
- Use BGL buffer instead of string for image data.
- Add buffer interface to image source.
- Allow customization of pixel format.
- Add valid property to check if the image data is available.
The image property of all Image source objects will now
return a BGL 'buffer' object. Previously it was returning
a string, which was not working at all with Python 3.1.
The BGL buffer type allows sequence access to bytes and
is directly usable in BGL OpenGL wrapper functions.
The buffer is formated as a 1 dimensional array of bytes
with 4 bytes per pixel in RGBA order.
BGL buffers will also be accepted in the ImageBuff load()
and plot() functions.
It is possible to customize the pixel format by using
the VideoTexture.imageToArray(image, mode) function:
the first argument is a Image source object, the second
optional argument is a format string using the R, G, B,
A, 0 and 1 characters. For example "BGR" means that each
pixel will be 3 bytes, corresponding to the Blue, Green
and Red channel in that order. Use 0 for a fixed hex 00
value, 1 for hex FF. The default mode is "RGBA".
All Image source objects now support the buffer interface
which allows to create memoryview objects for direct access
to the image internal buffer without memory copy. The buffer
format is one dimensional array of bytes with 4 bytes per
pixel in RGBA order. The buffer is writable, which allows
custom modifications of the image data.
v = memoryview(source)
A bug in the Python 3.1 buffer API will cause a crash if
the memoryview object cannot be created. Therefore, you
must always check first that an image data is available
before creating a memoryview object. Use the new valid
attribute for that:
if source.valid:
v = memoryview(source)
...
Note: the BGL buffer object itself does not yet support
the buffer interface.
Note: the valid attribute makes sense only if you use
image source in conjunction with texture object like this:
# refresh texture but keep image data in memory
texture.refresh(False)
if texture.source.valid:
v = memoryview(texture.source)
# process image
...
# invalidate image for next texture refresh
texture.source.refresh()
Limitation: While memoryview objects exist, the image cannot be
resized. Resizing occurs with ImageViewport objects when the
viewport size is changed or with ImageFFmpeg when a new image
is reloaded for example. Any attempt to resize will cause a
runtime error. Delete the memoryview objects is you want to
resize an image source object.
2010-02-21 22:20:00 +00:00
|
|
|
#define GLvoidP_ref(number) &BGL_bufferType, &bgl_buffer##number
|
2009-06-17 20:33:34 +00:00
|
|
|
#define GLvoidP_def(number) Buffer *bgl_buffer##number
|
|
|
|
|
2012-05-09 02:42:30 +00:00
|
|
|
#define GLsizeiP_str "O!"
|
|
|
|
#define GLsizeiP_var(number) (bgl_buffer##number)->buf.asvoid
|
|
|
|
#define GLsizeiP_ref(number) &BGL_bufferType, &bgl_buffer##number
|
|
|
|
#define GLsizeiP_def(number) Buffer *bgl_buffer##number
|
|
|
|
|
|
|
|
#define GLcharP_str "O!"
|
|
|
|
#define GLcharP_var(number) (bgl_buffer##number)->buf.asvoid
|
|
|
|
#define GLcharP_ref(number) &BGL_bufferType, &bgl_buffer##number
|
|
|
|
#define GLcharP_def(number) Buffer *bgl_buffer##number
|
|
|
|
|
2009-06-17 20:33:34 +00:00
|
|
|
#define buffer_str "O!"
|
|
|
|
#define buffer_var(number) (bgl_buffer##number)->buf.asvoid
|
VideoTexture: improvements to image data access API.
- Use BGL buffer instead of string for image data.
- Add buffer interface to image source.
- Allow customization of pixel format.
- Add valid property to check if the image data is available.
The image property of all Image source objects will now
return a BGL 'buffer' object. Previously it was returning
a string, which was not working at all with Python 3.1.
The BGL buffer type allows sequence access to bytes and
is directly usable in BGL OpenGL wrapper functions.
The buffer is formated as a 1 dimensional array of bytes
with 4 bytes per pixel in RGBA order.
BGL buffers will also be accepted in the ImageBuff load()
and plot() functions.
It is possible to customize the pixel format by using
the VideoTexture.imageToArray(image, mode) function:
the first argument is a Image source object, the second
optional argument is a format string using the R, G, B,
A, 0 and 1 characters. For example "BGR" means that each
pixel will be 3 bytes, corresponding to the Blue, Green
and Red channel in that order. Use 0 for a fixed hex 00
value, 1 for hex FF. The default mode is "RGBA".
All Image source objects now support the buffer interface
which allows to create memoryview objects for direct access
to the image internal buffer without memory copy. The buffer
format is one dimensional array of bytes with 4 bytes per
pixel in RGBA order. The buffer is writable, which allows
custom modifications of the image data.
v = memoryview(source)
A bug in the Python 3.1 buffer API will cause a crash if
the memoryview object cannot be created. Therefore, you
must always check first that an image data is available
before creating a memoryview object. Use the new valid
attribute for that:
if source.valid:
v = memoryview(source)
...
Note: the BGL buffer object itself does not yet support
the buffer interface.
Note: the valid attribute makes sense only if you use
image source in conjunction with texture object like this:
# refresh texture but keep image data in memory
texture.refresh(False)
if texture.source.valid:
v = memoryview(texture.source)
# process image
...
# invalidate image for next texture refresh
texture.source.refresh()
Limitation: While memoryview objects exist, the image cannot be
resized. Resizing occurs with ImageViewport objects when the
viewport size is changed or with ImageFFmpeg when a new image
is reloaded for example. Any attempt to resize will cause a
runtime error. Delete the memoryview objects is you want to
resize an image source object.
2010-02-21 22:20:00 +00:00
|
|
|
#define buffer_ref(number) &BGL_bufferType, &bgl_buffer##number
|
2009-06-17 20:33:34 +00:00
|
|
|
#define buffer_def(number) Buffer *bgl_buffer##number
|
|
|
|
|
|
|
|
/*@The standard GL typedefs are used as prototypes, we can't
|
|
|
|
* use the GL type directly because Py_ArgParse expects normal
|
|
|
|
* C types.
|
|
|
|
*
|
|
|
|
* Py_ArgParse doesn't grok writing into unsigned variables,
|
|
|
|
* so we use signed everything (even stuff that should be unsigned.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* typedef unsigned int GLenum; */
|
|
|
|
#define GLenum_str "i"
|
|
|
|
#define GLenum_var(num) bgl_var##num
|
|
|
|
#define GLenum_ref(num) &bgl_var##num
|
|
|
|
#define GLenum_def(num) /* unsigned */ int GLenum_var(num)
|
|
|
|
|
|
|
|
/* typedef unsigned int GLboolean; */
|
|
|
|
#define GLboolean_str "b"
|
|
|
|
#define GLboolean_var(num) bgl_var##num
|
|
|
|
#define GLboolean_ref(num) &bgl_var##num
|
|
|
|
#define GLboolean_def(num) /* unsigned */ char GLboolean_var(num)
|
|
|
|
|
|
|
|
/* typedef unsigned int GLbitfield; */
|
|
|
|
#define GLbitfield_str "i"
|
|
|
|
#define GLbitfield_var(num) bgl_var##num
|
|
|
|
#define GLbitfield_ref(num) &bgl_var##num
|
|
|
|
#define GLbitfield_def(num) /* unsigned */ int GLbitfield_var(num)
|
|
|
|
|
|
|
|
/* typedef signed char GLbyte; */
|
|
|
|
#define GLbyte_str "b"
|
|
|
|
#define GLbyte_var(num) bgl_var##num
|
|
|
|
#define GLbyte_ref(num) &bgl_var##num
|
|
|
|
#define GLbyte_def(num) signed char GLbyte_var(num)
|
|
|
|
|
|
|
|
/* typedef short GLshort; */
|
|
|
|
#define GLshort_str "h"
|
|
|
|
#define GLshort_var(num) bgl_var##num
|
|
|
|
#define GLshort_ref(num) &bgl_var##num
|
|
|
|
#define GLshort_def(num) short GLshort_var(num)
|
|
|
|
|
|
|
|
/* typedef int GLint; */
|
|
|
|
#define GLint_str "i"
|
|
|
|
#define GLint_var(num) bgl_var##num
|
|
|
|
#define GLint_ref(num) &bgl_var##num
|
|
|
|
#define GLint_def(num) int GLint_var(num)
|
|
|
|
|
|
|
|
/* typedef int GLsizei; */
|
|
|
|
#define GLsizei_str "i"
|
|
|
|
#define GLsizei_var(num) bgl_var##num
|
|
|
|
#define GLsizei_ref(num) &bgl_var##num
|
|
|
|
#define GLsizei_def(num) int GLsizei_var(num)
|
|
|
|
|
|
|
|
/* typedef unsigned char GLubyte; */
|
2010-11-21 05:35:29 +00:00
|
|
|
#define GLubyte_str "B"
|
2009-06-17 20:33:34 +00:00
|
|
|
#define GLubyte_var(num) bgl_var##num
|
|
|
|
#define GLubyte_ref(num) &bgl_var##num
|
|
|
|
#define GLubyte_def(num) /* unsigned */ char GLubyte_var(num)
|
|
|
|
|
|
|
|
/* typedef unsigned short GLushort; */
|
2010-11-21 05:35:29 +00:00
|
|
|
#define GLushort_str "H"
|
2009-06-17 20:33:34 +00:00
|
|
|
#define GLushort_var(num) bgl_var##num
|
|
|
|
#define GLushort_ref(num) &bgl_var##num
|
|
|
|
#define GLushort_def(num) /* unsigned */ short GLushort_var(num)
|
|
|
|
|
|
|
|
/* typedef unsigned int GLuint; */
|
2010-11-21 05:35:29 +00:00
|
|
|
#define GLuint_str "I"
|
2009-06-17 20:33:34 +00:00
|
|
|
#define GLuint_var(num) bgl_var##num
|
|
|
|
#define GLuint_ref(num) &bgl_var##num
|
|
|
|
#define GLuint_def(num) /* unsigned */ int GLuint_var(num)
|
|
|
|
|
|
|
|
/* typedef float GLfloat; */
|
|
|
|
#define GLfloat_str "f"
|
|
|
|
#define GLfloat_var(num) bgl_var##num
|
|
|
|
#define GLfloat_ref(num) &bgl_var##num
|
|
|
|
#define GLfloat_def(num) float GLfloat_var(num)
|
|
|
|
|
2012-05-09 02:42:30 +00:00
|
|
|
/* typedef char *GLstring; */
|
|
|
|
#define GLstring_str "s"
|
|
|
|
#define GLstring_var(number) bgl_var##number
|
|
|
|
#define GLstring_ref(number) &bgl_var##number
|
|
|
|
#define GLstring_def(number) char *GLstring_var(number)
|
|
|
|
|
2009-06-17 20:33:34 +00:00
|
|
|
/* typedef float GLclampf; */
|
|
|
|
#define GLclampf_str "f"
|
|
|
|
#define GLclampf_var(num) bgl_var##num
|
|
|
|
#define GLclampf_ref(num) &bgl_var##num
|
|
|
|
#define GLclampf_def(num) float GLclampf_var(num)
|
|
|
|
|
|
|
|
/* typedef double GLdouble; */
|
|
|
|
#define GLdouble_str "d"
|
|
|
|
#define GLdouble_var(num) bgl_var##num
|
|
|
|
#define GLdouble_ref(num) &bgl_var##num
|
|
|
|
#define GLdouble_def(num) double GLdouble_var(num)
|
|
|
|
|
|
|
|
/* typedef double GLclampd; */
|
|
|
|
#define GLclampd_str "d"
|
|
|
|
#define GLclampd_var(num) bgl_var##num
|
|
|
|
#define GLclampd_ref(num) &bgl_var##num
|
|
|
|
#define GLclampd_def(num) double GLclampd_var(num)
|
|
|
|
|
|
|
|
/* typedef void GLvoid; */
|
|
|
|
/* #define GLvoid_str "" */
|
|
|
|
/* #define GLvoid_var(num) bgl_var##num */
|
|
|
|
/* #define GLvoid_ref(num) &bgl_var##num */
|
|
|
|
/* #define GLvoid_def(num) char bgl_var##num */
|
|
|
|
|
|
|
|
#define arg_def1(a1) a1##_def(1)
|
|
|
|
#define arg_def2(a1, a2) arg_def1(a1); a2##_def(2)
|
|
|
|
#define arg_def3(a1, a2, a3) arg_def2(a1, a2); a3##_def(3)
|
|
|
|
#define arg_def4(a1, a2, a3, a4) arg_def3(a1, a2, a3); a4##_def(4)
|
|
|
|
#define arg_def5(a1, a2, a3, a4, a5) arg_def4(a1, a2, a3, a4); a5##_def(5)
|
|
|
|
#define arg_def6(a1, a2, a3, a4, a5, a6)arg_def5(a1, a2, a3, a4, a5); a6##_def(6)
|
|
|
|
#define arg_def7(a1, a2, a3, a4, a5, a6, a7)arg_def6(a1, a2, a3, a4, a5, a6); a7##_def(7)
|
|
|
|
#define arg_def8(a1, a2, a3, a4, a5, a6, a7, a8)arg_def7(a1, a2, a3, a4, a5, a6, a7); a8##_def(8)
|
|
|
|
#define arg_def9(a1, a2, a3, a4, a5, a6, a7, a8, a9)arg_def8(a1, a2, a3, a4, a5, a6, a7, a8); a9##_def(9)
|
|
|
|
#define arg_def10(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)arg_def9(a1, a2, a3, a4, a5, a6, a7, a8, a9); a10##_def(10)
|
|
|
|
|
|
|
|
#define arg_var1(a1) a1##_var(1)
|
|
|
|
#define arg_var2(a1, a2) arg_var1(a1), a2##_var(2)
|
|
|
|
#define arg_var3(a1, a2, a3) arg_var2(a1, a2), a3##_var(3)
|
|
|
|
#define arg_var4(a1, a2, a3, a4) arg_var3(a1, a2, a3), a4##_var(4)
|
|
|
|
#define arg_var5(a1, a2, a3, a4, a5) arg_var4(a1, a2, a3, a4), a5##_var(5)
|
|
|
|
#define arg_var6(a1, a2, a3, a4, a5, a6)arg_var5(a1, a2, a3, a4, a5), a6##_var(6)
|
|
|
|
#define arg_var7(a1, a2, a3, a4, a5, a6, a7)arg_var6(a1, a2, a3, a4, a5, a6), a7##_var(7)
|
|
|
|
#define arg_var8(a1, a2, a3, a4, a5, a6, a7, a8)arg_var7(a1, a2, a3, a4, a5, a6, a7), a8##_var(8)
|
|
|
|
#define arg_var9(a1, a2, a3, a4, a5, a6, a7, a8, a9)arg_var8(a1, a2, a3, a4, a5, a6, a7, a8), a9##_var(9)
|
|
|
|
#define arg_var10(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)arg_var9(a1, a2, a3, a4, a5, a6, a7, a8, a9), a10##_var(10)
|
|
|
|
|
|
|
|
#define arg_ref1(a1) a1##_ref(1)
|
|
|
|
#define arg_ref2(a1, a2) arg_ref1(a1), a2##_ref(2)
|
|
|
|
#define arg_ref3(a1, a2, a3) arg_ref2(a1, a2), a3##_ref(3)
|
|
|
|
#define arg_ref4(a1, a2, a3, a4) arg_ref3(a1, a2, a3), a4##_ref(4)
|
|
|
|
#define arg_ref5(a1, a2, a3, a4, a5) arg_ref4(a1, a2, a3, a4), a5##_ref(5)
|
|
|
|
#define arg_ref6(a1, a2, a3, a4, a5, a6)arg_ref5(a1, a2, a3, a4, a5), a6##_ref(6)
|
|
|
|
#define arg_ref7(a1, a2, a3, a4, a5, a6, a7)arg_ref6(a1, a2, a3, a4, a5, a6), a7##_ref(7)
|
|
|
|
#define arg_ref8(a1, a2, a3, a4, a5, a6, a7, a8)arg_ref7(a1, a2, a3, a4, a5, a6, a7), a8##_ref(8)
|
|
|
|
#define arg_ref9(a1, a2, a3, a4, a5, a6, a7, a8, a9)arg_ref8(a1, a2, a3, a4, a5, a6, a7, a8), a9##_ref(9)
|
|
|
|
#define arg_ref10(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)arg_ref9(a1, a2, a3, a4, a5, a6, a7, a8, a9), a10##_ref(10)
|
|
|
|
|
|
|
|
#define arg_str1(a1) a1##_str
|
|
|
|
#define arg_str2(a1, a2) arg_str1(a1) a2##_str
|
|
|
|
#define arg_str3(a1, a2, a3) arg_str2(a1, a2) a3##_str
|
|
|
|
#define arg_str4(a1, a2, a3, a4) arg_str3(a1, a2, a3) a4##_str
|
|
|
|
#define arg_str5(a1, a2, a3, a4, a5) arg_str4(a1, a2, a3, a4) a5##_str
|
|
|
|
#define arg_str6(a1, a2, a3, a4, a5, a6)arg_str5(a1, a2, a3, a4, a5) a6##_str
|
|
|
|
#define arg_str7(a1, a2, a3, a4, a5, a6, a7)arg_str6(a1, a2, a3, a4, a5, a6) a7##_str
|
|
|
|
#define arg_str8(a1, a2, a3, a4, a5, a6, a7, a8)arg_str7(a1, a2, a3, a4, a5, a6, a7) a8##_str
|
|
|
|
#define arg_str9(a1, a2, a3, a4, a5, a6, a7, a8, a9)arg_str8(a1, a2, a3, a4, a5, a6, a7, a8) a9##_str
|
|
|
|
#define arg_str10(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)arg_str9(a1, a2, a3, a4, a5, a6, a7, a8, a9) a10##_str
|
|
|
|
|
|
|
|
#define ret_def_void
|
|
|
|
#define ret_set_void
|
2009-08-14 17:16:16 +00:00
|
|
|
#define ret_ret_void return Py_INCREF(Py_None), Py_None
|
2009-06-17 20:33:34 +00:00
|
|
|
|
|
|
|
#define ret_def_GLint int ret_int
|
2012-03-16 21:39:56 +00:00
|
|
|
#define ret_set_GLint ret_int =
|
2009-08-14 17:16:16 +00:00
|
|
|
#define ret_ret_GLint return PyLong_FromLong(ret_int)
|
2009-06-17 20:33:34 +00:00
|
|
|
|
|
|
|
#define ret_def_GLuint unsigned int ret_uint
|
2012-03-16 21:39:56 +00:00
|
|
|
#define ret_set_GLuint ret_uint =
|
2009-08-14 17:16:16 +00:00
|
|
|
#define ret_ret_GLuint return PyLong_FromLong((long) ret_uint)
|
2009-06-17 20:33:34 +00:00
|
|
|
|
|
|
|
#define ret_def_GLenum unsigned int ret_uint
|
2012-03-16 21:39:56 +00:00
|
|
|
#define ret_set_GLenum ret_uint =
|
2009-08-14 17:16:16 +00:00
|
|
|
#define ret_ret_GLenum return PyLong_FromLong((long) ret_uint)
|
2009-06-17 20:33:34 +00:00
|
|
|
|
|
|
|
#define ret_def_GLboolean unsigned char ret_bool
|
2012-03-16 21:39:56 +00:00
|
|
|
#define ret_set_GLboolean ret_bool =
|
2009-08-14 17:16:16 +00:00
|
|
|
#define ret_ret_GLboolean return PyLong_FromLong((long) ret_bool)
|
2009-06-17 20:33:34 +00:00
|
|
|
|
2012-03-28 01:06:43 +00:00
|
|
|
#define ret_def_GLstring const unsigned char *ret_str
|
2012-03-16 21:39:56 +00:00
|
|
|
#define ret_set_GLstring ret_str =
|
2009-06-17 20:33:34 +00:00
|
|
|
|
2011-11-05 05:44:52 +00:00
|
|
|
#define ret_ret_GLstring \
|
|
|
|
if (ret_str) { \
|
|
|
|
return PyUnicode_FromString((const char *)ret_str); \
|
|
|
|
} \
|
|
|
|
else { \
|
|
|
|
PyErr_SetString(PyExc_AttributeError, "could not get opengl string"); \
|
|
|
|
return NULL; \
|
|
|
|
} \
|
2009-06-17 20:33:34 +00:00
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#endif /* __BGL_H__ */
|