Class SharedTexture
java.lang.Object
org.jzy3d.plot3d.rendering.textures.SharedTexture
- All Implemented Interfaces:
IGLBindedResource
- Direct Known Subclasses:
BufferedImageTexture
An image stored in a 2D texture, that can be shared by several drawables.
The texture is loaded in GPU through
IPainter at mount, hence works with any native
painter. A texture may be shared by drawables rendered by several charts, hence in several GL
contexts : the texture is loaded once per painter.
Image rows are stored from top to bottom, hence getCoords() gives a top coordinate of 0
and a bottom coordinate of 1.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected TextureCoordsprotected Stringprotected floatprotected floatprotected intTexture name of each painter in which this texture was loaded.protected intprotected intprotected booleanprotected int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidBind this texture to GL_TEXTURE_2D, after loading it if not done yet for this painter.getFile()floatfloatintintgetTextureId(IPainter painter) The texture name in the GL context of this painter, after loading it if not done yet.intintintgetWidth()booleanReturn true if mount(...) has been called at least one timebooleanprotected BufferedImageThe image to store in the texture.voidLoad the texture in the GL context of this painter.protected static ByteBufferrgba(BufferedImage image) RGBA bytes of an image, rows ordered from top to bottom.voidsetTextureMagnificationFilter(int textureMagnificationFilter) Will apply if set before actually loading the texture.voidsetTextureMinificationFilter(int textureMinificationFilter) Will apply if set before actually loading the texture.voidsetUseMipMap(boolean useMipMap) Will apply if set before actually loading the texture.
-
Field Details
-
file
-
coords
-
halfWidth
protected float halfWidth -
halfHeight
protected float halfHeight -
width
protected int width -
height
protected int height -
useMipMap
protected boolean useMipMap -
textureMagnificationFilter
protected int textureMagnificationFilter -
textureMinificationFilter
protected int textureMinificationFilter -
textureIds
-
-
Constructor Details
-
SharedTexture
protected SharedTexture() -
SharedTexture
-
-
Method Details
-
mount
Load the texture in the GL context of this painter. A GL context MUST be current.- Specified by:
mountin interfaceIGLBindedResource
-
bind
Bind this texture to GL_TEXTURE_2D, after loading it if not done yet for this painter. -
getTextureId
The texture name in the GL context of this painter, after loading it if not done yet. -
hasMountedOnce
public boolean hasMountedOnce()Description copied from interface:IGLBindedResourceReturn true if mount(...) has been called at least one time- Specified by:
hasMountedOncein interfaceIGLBindedResource
-
loadImage
The image to store in the texture.- Throws:
IOException
-
rgba
RGBA bytes of an image, rows ordered from top to bottom. -
getFile
-
getCoords
-
getHalfWidth
public float getHalfWidth() -
getHalfHeight
public float getHalfHeight() -
getWidth
public int getWidth() -
getHeight
public int getHeight() -
isUseMipMap
public boolean isUseMipMap() -
setUseMipMap
public void setUseMipMap(boolean useMipMap) Will apply if set before actually loading the texture.- Parameters:
useMipMap-
-
getTextureMagnificationFilter
public int getTextureMagnificationFilter() -
setTextureMagnificationFilter
public void setTextureMagnificationFilter(int textureMagnificationFilter) Will apply if set before actually loading the texture. Possible values documented in https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glTexParameter.xhtml (see parameter GL_TEXTURE_MAG_FILTER) Use -1 to avoid magnification- Parameters:
textureMagnificationFilter-
-
getTextureMinificationFilter
public int getTextureMinificationFilter() -
setTextureMinificationFilter
public void setTextureMinificationFilter(int textureMinificationFilter) Will apply if set before actually loading the texture. Possible values documented in https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glTexParameter.xhtml (see parameter GL_TEXTURE_MIN_FILTER) Use -1 to avoid minification- Parameters:
textureMinificationFilter-
-