|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.gljava.opengl.TextureFactory
public class TextureFactory
Factory for easy loading of Textures.
Field Summary | |
---|---|
(package private) java.awt.image.ColorModel |
glAlphaColorModel
Colour model including alpha for the GL image |
(package private) java.awt.image.ColorModel |
glColorModel
colour model for the GL image |
(package private) static TextureFactory |
instance
Factory instance |
(package private) java.util.HashMap |
textureCache
Cache of loaded Textures |
(package private) java.nio.IntBuffer |
textureIDBuffer
buffer for texture ID's |
Constructor Summary | |
---|---|
TextureFactory()
Creates a new TextureFactory instance. |
Method Summary | |
---|---|
(package private) java.nio.ByteBuffer |
convertImageData(java.awt.image.BufferedImage bufferedImage,
Texture texture)
Convert the buffered image to byte buffer with the data in appropriate format to pass to opengl |
(package private) int |
createTextureID(GL gl)
Create a new texture ID |
(package private) int |
getClosestGreaterPowerOf2(int target)
Get the closest greater power of 2 |
static TextureFactory |
getFactory()
initialization |
(package private) java.awt.image.BufferedImage |
loadImage(java.lang.String path)
Describe loadImage method here. |
(package private) java.awt.image.BufferedImage |
loadImage(java.net.URL url)
Describe loadImage method here. |
(package private) java.awt.image.BufferedImage |
loadImageResource(java.lang.String resourceName)
Describe loadImageResource method here. |
Texture |
loadSubTexture2D(GL gl,
java.awt.image.BufferedImage bufferedImage,
int target,
int dstPixelFormat,
int minFilter,
int magFilter,
int xOffset,
int yOffset,
int width,
int height)
Describe loadSubTexture method here. |
Texture |
loadSubTexture2D(GL gl,
java.lang.String path,
int xOffset,
int yOffset,
int width,
int height)
|
Texture |
loadTexture(GL gl,
java.awt.image.BufferedImage bufferedImage,
int target,
int dstPixelFormat,
int minFilter,
int magFilter)
Describe loadTexture method here. |
Texture |
loadTexture(GL gl,
java.lang.String path)
Load a Texture from the filesystem |
Texture |
loadTexture(GL gl,
java.net.URL url)
Load a Texture from the given URL |
Texture |
loadTextureResource(GL gl,
java.lang.String resourceName)
Load a Texture as a resource with the given name |
Texture |
loadTextureResource(GL gl,
java.lang.String resourceName,
int target,
int dstPixelFormat,
int minFilter,
int magFilter)
Load a Texture as a resource with the given name |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static TextureFactory instance
java.util.HashMap textureCache
java.awt.image.ColorModel glAlphaColorModel
java.awt.image.ColorModel glColorModel
java.nio.IntBuffer textureIDBuffer
Constructor Detail |
---|
public TextureFactory()
TextureFactory
instance.
Method Detail |
---|
public static TextureFactory getFactory()
int createTextureID(GL gl)
public Texture loadTexture(GL gl, java.lang.String path) throws java.io.IOException
gl
- a GL
valuepath
- The path on the filesystem to the Texture
Texture
value
java.io.IOException
- if an error occurspublic Texture loadSubTexture2D(GL gl, java.lang.String path, int xOffset, int yOffset, int width, int height) throws java.io.IOException
java.io.IOException
public Texture loadTexture(GL gl, java.net.URL url) throws java.io.IOException
gl
- a GL
valueurl
- an URL
value
Texture
value
java.io.IOException
- if an error occurspublic Texture loadTextureResource(GL gl, java.lang.String resourceName) throws java.io.IOException
gl
- a GL
valueresourceName
- a String
value
Texture
value
java.io.IOException
- if an error occurspublic Texture loadTextureResource(GL gl, java.lang.String resourceName, int target, int dstPixelFormat, int minFilter, int magFilter) throws java.io.IOException
gl
- a GL
valueresourceName
- a String
valuetarget
- an int
valuedstPixelFormat
- an int
valueminFilter
- an int
valuemagFilter
- an int
value
Texture
value
java.io.IOException
- if an error occurspublic Texture loadTexture(GL gl, java.awt.image.BufferedImage bufferedImage, int target, int dstPixelFormat, int minFilter, int magFilter) throws java.io.IOException
loadTexture
method here.
gl
- a GL
valueimage
- a BufferedImage
valuetarget
- an int
valuedstPixelFormat
- an int
valueminFilter
- an int
valuemagFilter
- an int
value
Texture
value
java.io.IOException
- if an error occurspublic Texture loadSubTexture2D(GL gl, java.awt.image.BufferedImage bufferedImage, int target, int dstPixelFormat, int minFilter, int magFilter, int xOffset, int yOffset, int width, int height) throws java.io.IOException
loadSubTexture
method here.
gl
- a GL
valuebufferedImage
- a BufferedImage
valuetarget
- an int
valuedstPixelFormat
- an int
valueminFilter
- an int
valuemagFilter
- an int
valuewidth
- an int
valueheight
- an int
value
Texture
value
java.io.IOException
- if an error occursjava.nio.ByteBuffer convertImageData(java.awt.image.BufferedImage bufferedImage, Texture texture)
bufferedImage
- The image to convert to a texturetexture
- The texture to store the data into
final int getClosestGreaterPowerOf2(int target)
target
- The target number
java.awt.image.BufferedImage loadImage(java.lang.String path) throws java.io.IOException
loadImage
method here.
path
- a String
value
BufferedImage
value
java.io.IOException
- if an error occursjava.awt.image.BufferedImage loadImage(java.net.URL url) throws java.io.IOException
loadImage
method here.
url
- an URL
value
BufferedImage
value
java.io.IOException
- if an error occursjava.awt.image.BufferedImage loadImageResource(java.lang.String resourceName) throws java.io.IOException
loadImageResource
method here.
url
- an URL
value
BufferedImage
value
java.io.IOException
- if an error occurs
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |