org.deegree.rendering.r3d.opengl.rendering.dem.texturing
Class FragmentTexture

java.lang.Object
  extended by org.deegree.rendering.r3d.opengl.rendering.dem.texturing.FragmentTexture

public class FragmentTexture
extends Object

A TextureTile applied to a RenderMeshFragment, also wraps OpenGL resources (texture coordinates).

Version:
$Revision: 29127 $, $Date: 2011-01-10 16:13:35 +0100 (Mon, 10 Jan 2011) $
Author:
Markus Schneider, last edited by: $Author: aschmitz $

Constructor Summary
FragmentTexture(RenderMeshFragment fragment, TextureTile texture)
           
FragmentTexture(RenderMeshFragment fragment, TextureTile texture, double[] translationVector, PooledByteBuffer buffer)
           
 
Method Summary
 boolean cachingEnabled()
           
 void clearAll(javax.media.opengl.GL gl)
          Clears up all data in this fragment texture, this disables the texture and frees up all OpenGL references, as well as releasing the direct texture coordinates buffer.
 void disable(javax.media.opengl.GL gl)
          Remove the buffer object from the gpu.
 void enable(javax.media.opengl.GL gl)
          Enable this Fragment texture by generating a buffer object in the given context.
 boolean equals(Object other)
           
 void generateTextureCoordinates(PooledByteBuffer directTexCoordBuffer, double[] translationVector)
          Generate the texture coordinates for the current fragment and the current texture.
 int getGLTextureId()
           
 int getGLVertexCoordBufferId()
           
 Integer getId()
           
 double getTextureResolution()
          Returns the resolution of the texture (world units per pixel).
 TextureTile getTextureTile()
           
 int hashCode()
          Implementation as proposed by Joshua Block in Effective Java (Addison-Wesley 2001), which supplies an even distribution and is relatively fast.
 boolean isEnabled()
           
 void unload()
          Unload
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FragmentTexture

public FragmentTexture(RenderMeshFragment fragment,
                       TextureTile texture)
Parameters:
fragment -
texture -

FragmentTexture

public FragmentTexture(RenderMeshFragment fragment,
                       TextureTile texture,
                       double[] translationVector,
                       PooledByteBuffer buffer)
Parameters:
fragment - needed to generate the texture coordinates
texture -
translationVector -
buffer -
Method Detail

generateTextureCoordinates

public void generateTextureCoordinates(PooledByteBuffer directTexCoordBuffer,
                                       double[] translationVector)
Generate the texture coordinates for the current fragment and the current texture. The texture coordinates will be put into the given direct buffer.

Parameters:
directTexCoordBuffer -
translationVector -

getTextureResolution

public double getTextureResolution()
Returns the resolution of the texture (world units per pixel).

Returns:
the resolution of the texture

getTextureTile

public TextureTile getTextureTile()
Returns:
the texture tile.

getGLTextureId

public int getGLTextureId()
Returns:
the opengl texture id.

getGLVertexCoordBufferId

public int getGLVertexCoordBufferId()
Returns:
the GL-id of the buffer object

enable

public void enable(javax.media.opengl.GL gl)
Enable this Fragment texture by generating a buffer object in the given context.

Parameters:
gl - to generate the buffer object to.

disable

public void disable(javax.media.opengl.GL gl)
Remove the buffer object from the gpu.

Parameters:
gl -

unload

public void unload()
Unload


clearAll

public void clearAll(javax.media.opengl.GL gl)
Clears up all data in this fragment texture, this disables the texture and frees up all OpenGL references, as well as releasing the direct texture coordinates buffer.

Parameters:
gl - openGL context to which the texture was bounded to.

isEnabled

public boolean isEnabled()
Returns:
true if this Fragment has a buffer object id and a texture id.

cachingEnabled

public boolean cachingEnabled()
Returns:
true if caching was enabled for this texture.

equals

public boolean equals(Object other)
Overrides:
equals in class Object

hashCode

public int hashCode()
Implementation as proposed by Joshua Block in Effective Java (Addison-Wesley 2001), which supplies an even distribution and is relatively fast. It is created from field f as follows:

Combining the hash code(s) computed above: result = 37 * result + code;

Overrides:
hashCode in class Object
Returns:
(int) ( result >>> 32 ) ^ (int) result;
See Also:
Object.hashCode()

getId

public Integer getId()
Returns:
the id of the fragment


Copyright © 2011. All Rights Reserved.