Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

CProgrammer

java and games

This topic is 5180 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

Share this post


Link to post
Share on other sites
Advertisement
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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!