Tinting sprites in Java2D on the fly?

For high performance you might want to use JOGL. It gives you good access to hardware acceleration, even if you do not need to 3D features.

I asked a similar question a while ago and got a pretty good answer here, although I was doing all of the tinting ahead of time. In any case, you'll probably want to look at BufferedImageOp. Also, the JH Labs site has a ton of useful info on doing image processing in java.

I decided to switch to a framework that allowed more control given Tom Hawtin's answer. JOGL and LWJGL both seem to provide access to a tinting mechanic. I opted for LWJGL, as it overlaps more with my other needs.

I found this Space Invaders Tutorial useful as its a nice rosetta stone between Java2D and JOGL, LWJGL. Here is the method I created for the LWJGL Sprite class. Public void drawTinted(int x, int y, float red, float green, float blue) { GL11.glPushMatrix(); texture.bind(); GL11.

GlTranslatef(x, y, 0); GL11. GlColor3f(red,green,blue); GL11. GlBegin(GL11.

GL_QUADS); { GL11. GlTexCoord2f(0, 0); GL11. GlVertex2f(0, 0); GL11.

GlTexCoord2f(0, texture.getHeight()); GL11. GlVertex2f(0, height); GL11. GlTexCoord2f(texture.getWidth(), texture.getHeight()); GL11.

GlVertex2f(width,height); GL11. GlTexCoord2f(texture.getWidth(), 0); GL11. GlVertex2f(width,0); } GL11.glEnd(); GL11.glPopMatrix(); }.

I am creating a game with an ascii-like map using Java2D on Linux (like a roguelike). By rendering BufferedImages via Graphics2D. DrawImage the terrain is rendered.

I would like to change the hue of each drawn image on the fly, without hurting performance too much. How can I achieve this? I suspect setComposite is part of the puzzle.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions