Results 1 to 12 of 12
Thread: Anti-Aliasing, and other bugs
- 11-18-2011, 12:36 AM #1
Member
- Join Date
- Nov 2011
- Posts
- 28
- Rep Power
- 0
Anti-Aliasing, and other bugs
Hey everybody. So, I finally have a working version of Pong. I have some bugs in it still that need to get worked out, but those are a little more complicated. But, I would like some anti aliasing in this. I have a rounded rectangle for my paddle and an oval for my ball. Rounded edges right now are pretty bad looking, and I was curious if there was a way to fix this.
-
Re: Anti-Aliasing, and other bugs
Potentially there are fixes including using RenderingHints on a Graphics2D object, but we've really no idea how to help as you haven't told us anything about your program such as what graphics and GUI library you're using and the code you're using to render your graphics. Please check my link below on "how to ask smart questions" to see what information would help us help you.
- 11-18-2011, 12:47 AM #3
Member
- Join Date
- Nov 2011
- Posts
- 28
- Rep Power
- 0
Re: Anti-Aliasing, and other bugs
Sorry, new to this forum. The libraries im using are as follows:
Java Code:import java.awt.*; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionListener; import java.awt.image.BufferStrategy; import java.awt.image.MemoryImageSource; import javax.swing.JFrame;
-
Re: Anti-Aliasing, and other bugs
You're still not telling us much. Again, please read the link that I have indicated. Again, look into using RenderingHints on a Graphics2D object. There are plenty of examples of this on this forum (I know as I've posted a few myself).
- 11-18-2011, 01:32 AM #5
Member
- Join Date
- Nov 2011
- Posts
- 28
- Rep Power
- 0
Re: Anti-Aliasing, and other bugs
Well, I'm not sure what else you need to know. Basically have some rounded objects in my program that have jagged edges that I would cleaned up. But, with RenderingHints, I have an issue. I use a Graphics object for everything in this, not a Graphics2D and as far as I know, I have to use a Graphics2D object for RenderingHints. So, I tried to make my Graphics object into a Graphics2D object and it worked for the RenderingHints, but then my BufferStrategy ceased to work.
-
Re: Anti-Aliasing, and other bugs
- 11-18-2011, 03:54 AM #7
Member
- Join Date
- Nov 2011
- Posts
- 28
- Rep Power
- 0
Re: Anti-Aliasing, and other bugs
Im using BufferStrategy to prevent screen flickering
-
Re: Anti-Aliasing, and other bugs
- 11-18-2011, 04:05 AM #9
Member
- Join Date
- Nov 2011
- Posts
- 28
- Rep Power
- 0
-
Re: Anti-Aliasing, and other bugs
Swing JComponents use automatic double buffering which helps greatly to prevent flicker. I'm not sure where you read up on BufferStrategy but it smells somewhat AWT-ish to me.
- 11-18-2011, 04:10 AM #11
Member
- Join Date
- Nov 2011
- Posts
- 28
- Rep Power
- 0
Re: Anti-Aliasing, and other bugs
I do believe it is AWT, I didn't know Swing had automatic double buffering. This helps a lot. So I can just drop the BufferStrategy, switch my graphics to 2D and then I can use anti-aliasing?
-
Re: Anti-Aliasing, and other bugs
Cast your Graphics to Graphics2D since the Graphics object passed into a paint or paintComponent method is actually a Graphics2D object.
Similar Threads
-
anti-bot test
By droidus in forum Java AppletsReplies: 1Last Post: 11-12-2011, 05:44 PM -
Aliasing in methods
By gregoost in forum New To JavaReplies: 9Last Post: 09-06-2011, 11:34 AM -
Name this Anti-pattern
By AdamGibbons in forum Advanced JavaReplies: 6Last Post: 05-09-2011, 04:18 PM -
Anti virus
By gyan916 in forum Advanced JavaReplies: 3Last Post: 08-03-2010, 10:22 AM -
Aliasing In 2d Arraylist
By hatela150 in forum Java 2DReplies: 1Last Post: 12-11-2008, 06:01 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks