🔒 Locked
java and games
Advertisement
Original Post
Basically I just got into java game programming coming from C/C++ and DirectX.
I was just wondering if someone could answer the following question:
Is the 'Graphics'-Object enough performance wise or should I use Graphics2d although I dont need the extra functionality.
-CProgrammer
[edited by - CProgrammer on April 15, 2004 5:12:36 AM]
Oh and another question.
Anybody got a short tutorial on alphablending with java.
-CProgrammer
Anybody got a short tutorial on alphablending with java.
-CProgrammer
No, no, no, no, no!!
The java.awt.Graphics object is SLOW, I mean way too slow.
Graphics2d is also way too slow.
You better write your own Graphics class, based on the java.awt.image.memoryImageSource or java.awt.image.BufferedImage class.
(however, if you just make a simple 2D game, or you wish to draw clipped concave polygons, java.awt.Graphics will do fine).
You can afphablend with Graphics2d. Use the constructor for color:
Color someAlphaColor=new Color(int red, int green, int blue, int alpha);
Graphics2d.setColor(someAlphaColor);
[edited by - Koroljov on April 15, 2004 10:07:42 AM]
[edited by - koroljov on April 15, 2004 10:11:20 AM]
The java.awt.Graphics object is SLOW, I mean way too slow.
Graphics2d is also way too slow.
You better write your own Graphics class, based on the java.awt.image.memoryImageSource or java.awt.image.BufferedImage class.
(however, if you just make a simple 2D game, or you wish to draw clipped concave polygons, java.awt.Graphics will do fine).
You can afphablend with Graphics2d. Use the constructor for color:
Color someAlphaColor=new Color(int red, int green, int blue, int alpha);
Graphics2d.setColor(someAlphaColor);
[edited by - Koroljov on April 15, 2004 10:07:42 AM]
[edited by - koroljov on April 15, 2004 10:11:20 AM]
Koroljov: Thank you so much Koroljov. Thats what I needed to know.
-CProgrammer
-CProgrammer
Hm it doesnt seem to be working. I need somehting like a color key to make my sprites usable.
-CProgrammer
-CProgrammer
If you don''t need Graphics2D-object don''t use it, it ain''t any faster than Graphics.
Considered using OpenGL? It nicely handles things like rotation, scaling and alpha blending of your sprites.
btw. Most of the Java2D stuff is getting hardware-accelerated by the release of 1.5.
Considered using OpenGL? It nicely handles things like rotation, scaling and alpha blending of your sprites.
btw. Most of the Java2D stuff is getting hardware-accelerated by the release of 1.5.
Oh and here''s a nice color tutorial:
[url]http://remon.mojomedia.at/tutorials/tutorial-1-2-1.html[/url]
[url]http://remon.mojomedia.at/tutorials/tutorial-1-2-1.html[/url]
Sure I''ve used OpenGL before. But consider my original post, I just switched to learning java. Now I didn''t know Opengl can be used with java. Nevertheless even if it can I''d prefer to do java wihout it first.
I think i''m not being clear as to what I want. I dont want blending or fading techniques. I want to be able to have sprites on a background. So basically say I have an image of a man with a white backround, then the white background has to be cut away.
With C/C++ DirectX8 I did this by using tga''s as textures and then alphablending. Earlier with DirectDraw I used ColorKeys. What I can use in java to achieve the desired effect?
-CProgrammer
I think i''m not being clear as to what I want. I dont want blending or fading techniques. I want to be able to have sprites on a background. So basically say I have an image of a man with a white backround, then the white background has to be cut away.
With C/C++ DirectX8 I did this by using tga''s as textures and then alphablending. Earlier with DirectDraw I used ColorKeys. What I can use in java to achieve the desired effect?
-CProgrammer
Huh, seems saving the gif with transparency does it for java.
Thanks anyway for all the lins they''ll come in handy as well.
-CProgrammer
Thanks anyway for all the lins they''ll come in handy as well.
-CProgrammer
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement