Maven module :un.engine : engine-opengl-util :
Class : un.impl.opengl.resource.TextureUtils
Extends/Implements : -
Subclasses : -

author  Johann Sorel


Variables : -
Functions : loadTexture, loadTexture, downloadTexture, glFormatToNbSample, isOpaque, createTexture, makeCompatible, toTextureInfo



public int loadTexture (GL gl, Image image, TextureModel info)


Loads a texture using glTexImage2D.
Does not set any parameters, does not bind the texture.
It only check and fix the image pixel data properly.
param  gltype first parameter of glTexImage2D
public void loadTexture (GL gl, Image image, int gltype)


Download a texture from graphics memory and return it as an image.
OpenGL constraints : GL3+
param  gl Opengl content
param  textureId texture id
param  textureType texture type
param  extent texture size
param  glFormat texture color type
param  glSampleType texture sample type
return  Image
public Image downloadTexture (GL gl, int textureId, Extent.Long extent, TextureModel model)

public int glFormatToNbSample (int glFormat)


Check if an image is opaque.
Does not contain any alpha component not 1.
param  image
return  true if image is opaque
public boolean isOpaque (Image image)


OpenGL constraints :
param  gl
param  info
public void createTexture (Extent extent, GL gl, TextureModel info)


All raw models and color models can not be used directly in opengl.
This method will transform the image to match opengl capabilities.
param  image
param  preserveColors
return
public Image makeCompatible (Image image, boolean preserveColors)

public TextureModel toTextureInfo (Image image, boolean preserveColors)