JUCE  v5.4.1-191-g0ab5e696f
JUCE API
Looking for a senior C++ dev?
I'm looking for work. Hire me!
juce::OpenGLTexture Class Reference

Creates an openGL texture from an Image. More...

#include <juce_OpenGLTexture.h>

Collaboration diagram for juce::OpenGLTexture:

Public Member Functions

 OpenGLTexture ()
 
 ~OpenGLTexture ()
 
void bind () const
 Binds the texture to the currently active openGL context. More...
 
int getHeight () const noexcept
 
GLuint getTextureID () const noexcept
 Returns the GL texture ID number. More...
 
int getWidth () const noexcept
 
void loadAlpha (const uint8 *pixels, int width, int height)
 Creates an alpha-channel texture from an array of alpha values. More...
 
void loadARGB (const PixelARGB *pixels, int width, int height)
 Creates a texture from a raw array of pixels. More...
 
void loadARGBFlipped (const PixelARGB *pixels, int width, int height)
 Creates a texture from a raw array of pixels. More...
 
void loadImage (const Image &image)
 Creates a texture from the given image. More...
 
void release ()
 Frees the texture, if there is one. More...
 
void unbind () const
 Unbinds the texture to the currently active openGL context. More...
 

Static Public Member Functions

static bool isValidSize (int width, int height)
 Returns true if a texture can be created with the given size. More...
 

Private Member Functions

void create (int w, int h, const void *, GLenum, bool topLeft)
 

Private Attributes

int height
 
OpenGLContextownerContext
 
GLuint textureID
 
int width
 

Detailed Description

Creates an openGL texture from an Image.

{OpenGL}

Constructor & Destructor Documentation

◆ OpenGLTexture()

juce::OpenGLTexture::OpenGLTexture ( )

◆ ~OpenGLTexture()

juce::OpenGLTexture::~OpenGLTexture ( )

Member Function Documentation

◆ bind()

void juce::OpenGLTexture::bind ( ) const

Binds the texture to the currently active openGL context.

◆ create()

void juce::OpenGLTexture::create ( int  w,
int  h,
const void *  ,
GLenum  ,
bool  topLeft 
)
private

◆ getHeight()

int juce::OpenGLTexture::getHeight ( ) const
inlinenoexcept

◆ getTextureID()

GLuint juce::OpenGLTexture::getTextureID ( ) const
inlinenoexcept

Returns the GL texture ID number.

◆ getWidth()

int juce::OpenGLTexture::getWidth ( ) const
inlinenoexcept

◆ isValidSize()

static bool juce::OpenGLTexture::isValidSize ( int  width,
int  height 
)
static

Returns true if a texture can be created with the given size.

Some systems may require that the sizes are powers-of-two.

◆ loadAlpha()

void juce::OpenGLTexture::loadAlpha ( const uint8 pixels,
int  width,
int  height 
)

Creates an alpha-channel texture from an array of alpha values.

If width and height are not powers-of-two, the texture will be created with a larger size, and only the subsection (0, 0, width, height) will be initialised. The data is sent directly to the OpenGL driver without being flipped vertically, so the first pixel will be mapped onto texture coordinate (0, 0).

◆ loadARGB()

void juce::OpenGLTexture::loadARGB ( const PixelARGB pixels,
int  width,
int  height 
)

Creates a texture from a raw array of pixels.

If width and height are not powers-of-two, the texture will be created with a larger size, and only the subsection (0, 0, width, height) will be initialised. The data is sent directly to the OpenGL driver without being flipped vertically, so the first pixel will be mapped onto texture coordinate (0, 0).

◆ loadARGBFlipped()

void juce::OpenGLTexture::loadARGBFlipped ( const PixelARGB pixels,
int  width,
int  height 
)

Creates a texture from a raw array of pixels.

This is like loadARGB, but will vertically flip the data so that the first pixel ends up at texture coordinate (0, 1), and if the width and height are not powers-of-two, it will compensate by using a larger texture size.

◆ loadImage()

void juce::OpenGLTexture::loadImage ( const Image image)

Creates a texture from the given image.

Note that if the image's dimensions aren't a power-of-two, the texture may be created with a larger size.

The image will be arranged so that its top-left corner is at texture coordinate (0, 1).

◆ release()

void juce::OpenGLTexture::release ( )

Frees the texture, if there is one.

◆ unbind()

void juce::OpenGLTexture::unbind ( ) const

Unbinds the texture to the currently active openGL context.

Member Data Documentation

◆ height

int juce::OpenGLTexture::height
private

◆ ownerContext

OpenGLContext* juce::OpenGLTexture::ownerContext
private

◆ textureID

GLuint juce::OpenGLTexture::textureID
private

◆ width

int juce::OpenGLTexture::width
private

The documentation for this class was generated from the following file: