Vuo  0.5.2
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Typedefs | Functions

Description

An image residing in GPU memory (GL Texture Object).

Classes

struct  _VuoImage
 An image residing in GPU memory (GL Texture Object). More...
 

Typedefs

typedef struct _VuoImageVuoImage
 An image residing in GPU memory (GL Texture Object).
 
typedef void(* VuoImage_freeCallback )(VuoImage imageToFree)
 A callback to be implemented if non-Vuo code needs to retain ownership of the GL texture (instead of the default behavior where VuoImage takes ownership of the texture).
 

Functions

VuoImage VuoImage_get (const char *imageURL)
 Retrieves the image at the specified imageURL, and creates a VuoImage from it.
 
void VuoImage_free (void *texture)
 Decrements the retain count of the OpenGL Texture Object associated with the specified VuoImage, and frees the texture VuoImage struct.
 
VuoImage VuoImage_make (unsigned int glTextureName, unsigned long int pixelsWide, unsigned long int pixelsHigh)
 Returns a new VuoImage structure representing the specified glTextureName.
 
VuoImage VuoImage_makeClientOwned (unsigned int glTextureName, unsigned long int pixelsWide, unsigned long int pixelsHigh, VuoImage_freeCallback freeCallback, void *freeCallbackContext)
 Returns a new VuoImage structure representing the specified glTextureName.
 
VuoImage VuoImage_valueFromJson (json_object *js)
 Decodes the JSON object js to create a new value.
 
json_object * VuoImage_jsonFromValue (const VuoImage value)
 Encodes value as a JSON object.
 
json_object * VuoImage_interprocessJsonFromValue (const VuoImage value)
 Returns a JSON object containing an interprocess handle for the specified texture.
 
char * VuoImage_summaryFromValue (const VuoImage value)
 A brief summary of the contents of this texture.
 
VuoImage VuoImage_valueFromString (const char *str)
 Automatically generated function.
 
char * VuoImage_stringFromValue (const VuoImage value)
 Automatically generated function.
 
char * VuoImage_interprocessStringFromValue (const VuoImage value)
 Automatically generated function.
 

Class Documentation

struct _VuoImage
Class Members
VuoImage_freeCallback freeCallback A callback to be implemented if non-Vuo code needs to retain ownership of the GL texture. See VuoImage_makeClientOwned.
void * freeCallbackContext User data for freeCallback. See VuoImage_makeClientOwned.
unsigned int glTextureName The unique OpenGL texture identifier.
unsigned long int glTextureTarget Always GL_TEXTURE_2D, unless converting from an IOSurface.
unsigned long int pixelsHigh The vertical size of the image, in pixels.
unsigned long int pixelsWide The horizontal size of the image, in pixels.

Typedef Documentation

typedef struct _VuoImage* VuoImage

An image residing in GPU memory (GL Texture Object).

The struct is typedef'd to a pointer so that VuoImages are reference-counted, enabling us to automatically delete the GL Texture Object when the last reference is released.

typedef void(* VuoImage_freeCallback)(VuoImage imageToFree)

A callback to be implemented if non-Vuo code needs to retain ownership of the GL texture (instead of the default behavior where VuoImage takes ownership of the texture).

See Also
VuoImage_makeClientOwned

Function Documentation

void VuoImage_free ( void *  texture)

Decrements the retain count of the OpenGL Texture Object associated with the specified VuoImage, and frees the texture VuoImage struct.

VuoImage VuoImage_get ( const char *  imageURL)

Retrieves the image at the specified imageURL, and creates a VuoImage from it.

Automatically activates and deactivates a GL Context (if it makes it that far in the loading process).

struct json_object * VuoImage_interprocessJsonFromValue ( const VuoImage  value)
read

Returns a JSON object containing an interprocess handle for the specified texture.

Automatically activates and deactivates a GL Context.

char* VuoImage_interprocessStringFromValue ( const VuoImage  value)

Automatically generated function.

struct json_object * VuoImage_jsonFromValue ( const VuoImage  value)
read

Encodes value as a JSON object.

VuoImage VuoImage_make ( unsigned int  glTextureName,
unsigned long int  pixelsWide,
unsigned long int  pixelsHigh 
)

Returns a new VuoImage structure representing the specified glTextureName.

The texture must be of type GL_TEXTURE_2D.

The VuoImage takes ownership of glTextureName, and will call glDeleteTextures() on it when it's no longer needed.

VuoImage is intended to be immutable — do not modify the contents of the glTextureName after passing it to this function.

VuoImage VuoImage_makeClientOwned ( unsigned int  glTextureName,
unsigned long int  pixelsWide,
unsigned long int  pixelsHigh,
VuoImage_freeCallback  freeCallback,
void *  freeCallbackContext 
)

Returns a new VuoImage structure representing the specified glTextureName.

The texture must be of type GL_TEXTURE_2D.

When the VuoImage is no longer needed, freeCallback is called. The freeCallback may then activate a GL context and delete the texture, or send it back to a texture pool.

freeCallbackContext is optional data passed to freeCallback via the VuoImage struct. Use NULL if you don't need to provide additional data to the callback.

VuoImage is intended to be immutable — do not modify the contents of the glTextureName between passing it to this function and when freeCallback is called.

char* VuoImage_stringFromValue ( const VuoImage  value)

Automatically generated function.

char * VuoImage_summaryFromValue ( const VuoImage  value)

A brief summary of the contents of this texture.

Example:
GL Texture (ID 42)
640x480
VuoImage VuoImage_valueFromJson ( json_object *  js)

Decodes the JSON object js to create a new value.

Automatically activates and deactivates a GL Context (if needed to dereference an IOSurface).

Returns
If js contains valid data, returns a pointer to the VuoImage. If not, returns NULL.
Parameters
jsA JSON object containing a GL Texture Name or IOSurfaceID, and the texture's width and height in pixels.
Example:
{
"glTextureName": 42,
"pixelsWide": 640,
"pixelsHigh": 480
}
Example:
{
"ioSurface": 42,
"pixelsWide": 640,
"pixelsHigh": 480
}
VuoImage VuoImage_valueFromString ( const char *  str)

Automatically generated function.