Texturing a cylinder using BufferedImage

Hi,



i need a little bit help with texturing a cylinder with a bufferedimage. To avoid the use of too much geometries i’ve decided to do the following:







Each cylinder (towers) represents a class as part of a java project. I have different representation buildings and one of them is the ModificationTower. Its function is to visualize SVN modifications. For this task a svn log file can be imported which contains all the add/update/… information of a project for each revision from the birth. Now the problem is, that a class can have a hundred or thousands of modifications, so thats why i parse the log file and generate a texture for each building using a bufferedimage. Well that’s not the problem. I now that the cylinders tex coords are distributed 1/3 for top and bottom and 1/3 for the side. The image above shows the current appearance. I now wanna that it looks like that (without these massive interpolation):







For the last image i set the texture scale for each building to its height but the texture will be repeated. Any idea what i can try? The BufferedImages are generated in the following way:



[java]final int WIDTH = 10;

int modHeight = 0;

for (int height : heightValues) {

modHeight += height;

}

BufferedImage img = new BufferedImage(WIDTH, 3 * modHeight, BufferedImage.TYPE_INT_ARGB);

Graphics2D g2d = img.createGraphics();



int currHeight = 0;



ColorRGBA color = colors.get(colors.size() - 1);



g2d.setColor(ColorUtils.colorRGBA2Color(color));

g2d.fillRect(0, 0, WIDTH, modHeight);

currHeight += modHeight;



for (int i = heightValues.size() - 1; i >= 0; i–) {

color = colors.get(i);

int height = heightValues.get(i);

g2d.setColor(ColorUtils.colorRGBA2Color(color));

g2d.fillRect(0, currHeight, WIDTH, height);

currHeight += height;

}



color = colors.get(0);

g2d.setColor(ColorUtils.colorRGBA2Color(color));

g2d.fillRect(0, currHeight, WIDTH, modHeight);



Texture texture = MaterialManager.loadTexture(pImage);

texture.setWrap(WrapAxis.S, WrapMode.Clamp);

texture.setWrap(WrapAxis.T, WrapMode.Repeat);

return texture;[/java]



The texture should repeat around the y-axis and should be applied without clamping in the height.



Thanks

Moe