View previous topic - View next topic |
Author |
Message |
Ninkazu Demon Hunter
Joined: 08 Aug 2002 Posts: 945 Location: Location:
|
|
Back to top |
|
|
Happy JonA's American snack pack
Joined: 03 Aug 2002 Posts: 200
|
Posted: Tue Oct 14, 2003 6:09 am Post subject: |
[quote] |
|
Comments would be fantastic.
|
|
Back to top |
|
|
Ninkazu Demon Hunter
Joined: 08 Aug 2002 Posts: 945 Location: Location:
|
Posted: Tue Oct 14, 2003 8:29 pm Post subject: |
[quote] |
|
All I need is a way to speed up drawing. You don't need to know what the rest does.
|
|
Back to top |
|
|
Happy JonA's American snack pack
Joined: 03 Aug 2002 Posts: 200
|
Posted: Tue Oct 14, 2003 9:17 pm Post subject: |
[quote] |
|
Sorry. I assumed you wanted me to help.
Since I have no idea what your code does I can only assume you mean pixel drawing, as it seems you're using [url=http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Graphics.html#fillRect(int,%20int,%20int,%20int)]fillRect() [/url] for drawing pixels (and I only gather that from the fact that there's a few "fillRect(x,y,1,1)"'s in there (In essence, drawing pixel sized rectangles). For speed, I'd recommend you stay clear of that method. It's nasty and rather naive. Although it's been awhile since I've done anything in Java, I'm pretty sure the following links will get you pointed in the right direction:
http://java.sun.com/j2se/1.4.2/docs/api/
And, in particular:
http://java.sun.com/j2se/1.4.2/docs/api/java/awt/image/DataBuffer.html
http://java.sun.com/j2se/1.4.2/docs/api/java/awt/image/Raster.html
http://java.sun.com/j2se/1.4.2/docs/api/java/awt/image/WritableRaster.html
|
|
Back to top |
|
|
Ninkazu Demon Hunter
Joined: 08 Aug 2002 Posts: 945 Location: Location:
|
Posted: Tue Oct 14, 2003 10:31 pm Post subject: |
[quote] |
|
Ugh, I can't any sense of this :'(
|
|
Back to top |
|
|
janus Mage
Joined: 29 Jun 2002 Posts: 464 Location: Issaquah, WA
|
Posted: Wed Oct 15, 2003 4:26 am Post subject: |
[quote] |
|
Ninkazu wrote: | Ugh, I can't any sense of this :'( |
The joy of Java!
|
|
Back to top |
|
|
Ninkazu Demon Hunter
Joined: 08 Aug 2002 Posts: 945 Location: Location:
|
Posted: Wed Oct 15, 2003 11:13 am Post subject: |
[quote] |
|
Reload the above relblob1.html and you'll see that I got it going faster. Not as fast as I want it, but I'll try to fix that after school if I have time.
Speaking of which.... gotta run!
|
|
Back to top |
|
|
Bjorn Demon Hunter
Joined: 29 May 2002 Posts: 1425 Location: Germany
|
Posted: Wed Oct 15, 2003 12:44 pm Post subject: |
[quote] |
|
When trying your URL (or www.venosoft.com), I get the following error:
(111) Connection refused
Might be an issue with the proxy of Trinity (my current university), but I haven't encountered this problem before. _________________ If we could navigate in the physical world by hyperlinks, we wouldn't bother with walking, driving, flying... so why should we do it in a virtual world? - KDE User Interface Guidelines
|
|
Back to top |
|
|
Ninkazu Demon Hunter
Joined: 08 Aug 2002 Posts: 945 Location: Location:
|
Posted: Wed Oct 15, 2003 8:23 pm Post subject: |
[quote] |
|
Could be a server hiccup.
|
|
Back to top |
|
|
BigManJones Scholar
Joined: 22 Mar 2003 Posts: 196
|
Posted: Thu Oct 16, 2003 2:47 am Post subject: |
[quote] |
|
1. you don't need to create a new Graphics every loop; move your paintapp() into paint() and call repaint() from your main loop. repaint calls paint.
2. You create new instances of a whole lot of variables all thru the code; like the two stacks in the qsort(). This is a cardinal sin in Java realtime programming. NEVER create objects or let objects go out of reference in your main loop. You are inviting the GC to kick in which can take 100+ millisecs ie thats a very noticable pause.
3. Thread.sleep() gives erratic timing on all platforms but linux. On win98/ME its unbearable and on WinXP it gives erratic frame rates. There is a wiki on javagaming .org with code for a self correcting timer thread class that works real well.
4. To increase your framerate overall you'll need to drop the fillRect altogether and use a MemoryImageSource or a BufferedImage.
|
|
Back to top |
|
|
Ninkazu Demon Hunter
Joined: 08 Aug 2002 Posts: 945 Location: Location:
|
Posted: Thu Oct 16, 2003 11:05 am Post subject: |
[quote] |
|
Thanks, I'll do that after my finals today.
|
|
Back to top |
|
|