Java Grahpics2d, Buffered Image, really bad fps when rotating a image10Dpts

Hey, i'm making a spaceship game, and i use buffered .gif that are loaded before they are used.
(The images are only loaded once before anyone says that :D )
However, when i have a reasonably sized image rotating in real time, such as a 533 by 182, at normal scale my fps drops really low, like into the mid teens, and i'm not sure why.
This only seems to happen when the iamge rotates, the fps stays fine when the image is translating.
I use Affine Transforms to do my rotating.
And i'm already using the createCompatibleImage GraphicsConfiguration to help increase performance, but i still get this problem.
I've also noticed if i zoom in realy close (using scaling ffrom affine transform) the same thing happens if i rotate, and my fps drops really low as well.
and the problem with the fps dropping when rotating is alot reduced if i zoom out alot as well.
Anyone got any idea how i can imrpove performance.
I'm buffering images as so:
     public BufferedImage createCompatible(int width, int height, int transparency) {
          GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration() ;
          BufferedImage compatible = gc.createCompatibleImage(width,height,transparency);
          return compatible;
     }and the following code block is the one i use to render the spaceships (Actors)
     public void paint(Graphics2D g){
               AffineTransform at = new AffineTransform();
          at.scale(Sector42Main.UNIVSCALE, Sector42Main.UNIVSCALE);
          at.translate(x
                    -(((Actor)Sector42Main.playeractors.get(FOCUS_ID)).x)
                    +((Stage.WIDTH/2)/Sector42Main.UNIVSCALE)
                    - (((Actor)Sector42Main.playeractors.get(FOCUS_ID)).getWidth()/2) ,
                    y
                    -(((Actor)Sector42Main.playeractors.get(FOCUS_ID)).y)
                    + ((Stage.HEIGHT/2)/Sector42Main.UNIVSCALE)
                    - (((Actor)Sector42Main.playeractors.get(FOCUS_ID)).getHeight()/2));
          at.rotate(r,getWidth()/2,getHeight()/2);
     at.scale(xscale, yscale);
          g.drawImage( spriteCache.getSprite(spriteNames[currentFrame]),at, stage);
     }any help would be really welcome.
thanks.
Message was edited by:
MatthewH

I've found that a lot of game development seems to involve working out exactly what you can get away with in terms of display rather than conforming to a strict model. Sure, this is changing these days, but in terms of a bitmapped sprite just how much difference will each incremement make when projected onto pixels?
I tend to find a little experimentation with these things goes a long way - you might find that rounding your model's angle to a display angle with a much lower resolution (say, every 2 or 5 or 10 degrees) doesn't acutally make any real difference to the game (apart from letting you render frames moire quickly) once a number of sprites are flying about the place.
Still, just one suggestion. Let us all know if you find a another way around it.
Cheers,
John

Similar Messages

  • Why does it look really bad quality when i plug my 13in macbook pro to my 42in samsung tv?

    i bought this rocketfish hdmi cable to plug my 13in mac pro to my samsung plasma tv so i can watch netflix and youtube..and for some reason the picture quality is really bad. everyone says it looks great in theirs but why not mine? i put it at the highest resolution which is 1080i. Can i get any help??

    it should be 1080p unless your's is only i
    netflix and youtube need to have the best picture turned on for it to look good. Some are in 1080p but other only max out at 240p.
    if you are in mirror mode, you are unable to change the screen size to the tv independently of the mbp.
    What you should try to do is see if you have mirror mode turned on in system preferences> display>arrangement.

  • Images have jagged edges when rotated in Keynote 6.1

    After upgrading to Keynote 6.1, I'm having problems when rotating images that I've imported to my slides. Any time I rotate an image that's not on a 45, 90, 180 angle, the image has jagged edges.
    Here's a screenshot as an example. The image is on 4 degree angle.
    Any ideas?

    Sorry, in haste I forgot to mention this also:
    Use an appropriate slide size, as a minimum resolution I match the slide size (Keynote > Inspector > Setup Slide Size), to the resolution of the display I am using, in my case 1920 x 1200.
    I always resize the images I bring into Keynote with the same pixel resolution as the slide size.

  • Iphone 4S takes really bad pics when using the flash. All the pics have a white haze. Is there a fix to this?

    When I try and click pics in low light with my iphone 4s, the quality is really poor with a white haze on all the pics. The iphone 4 had a similar problem and I upgraded thinking they may have fixed this. We tried taking some pics on NY's eve with the iphone but the result was really poor. Switched to my wife's blackberry and got amazing results. So I guess its a software related issue. If blackberry cameras can give such amazing pics with a flash why cant iphones? Apple please fix.

    @Holman - I only have a bumper on my phone, no screen protector or plastic cover but thanks for stating the obvious.
    @Dave - Posting some pics here which show the white haze when taking pics in low light using flash. I know numerous other iphone 4/4S owners who have the same complaint and also the forum is full of people having similar queries so I guess mine is not a one off case.
    As you can see there is a white haze in both these pics and every other pic I take in low light. Using this phone's camera in a nightclub is almost embarassing when blackberry users see the results.

  • AudioFileOpenURL really bad performance when opening big *.m4a files

    I did some testing for a project of mine and noticed that opening a big .m4a file with AudioFileOpenURL is really slow.
    I tested opening about 25000 audio files.
    All of them, except large mp4 podcasts like the engadget podcast, open really fast.
    There seems to be a direct connection between the size of the file and the time it takes for AudioFileOpenURL to open it.
    Files that are around 3MB have no noticable delay and files around 30MB will take seconds to open.
    While opening AudioFileOpenURL consumes a lot of cpu.
    I tried setting the correct fileTypeHint but that makes no difference at all.
    Is there any explanation for this behaviour?
    I can not continue with my project until i'm able to open all audio files in a reasonable time.
    Maybe somebody has an idea how I can speed this up.

    Certainly a reasonable concern...
    The question at this point is, How are the reports going to be used and deployed once they are in production?
    I'd look at it from that direction.
    For example... They may be able to dump the data directly to another database on a separate server that would insulate the main enterprise server. This would allow the main server to run the necessary queries during off peak hours and would isolate any reporting activity to a "reporting database".
    This would also keep the data secure and encrypted (it would continue to enjoy the security provided by an RDBMS). Text & csv files can be copied, emailed, altered & deleted by anyone who sees them. Placing them in encrypted .zip folders prevents them from being read by external applications.
    <Hope you liked the sales pitch I wrote for you to give to the client... =^)
    If all else fails and you're stuck using the csv files, at least see if they can get it all on one file. Joining the 2 files is killing you performance wise... More so than using 1 massive file.
    Jason

  • I have a 2011 MBP, i7 13 inch.  My MBP has been lagging really badly and eating up bandwidth.  When I go to Activity Monitor, two things seem to be going off - syslogd and mtmd.  Their CPU percentage is really high.

    Even typing this, the computer will lag and the fans are really loud.
    When my partner is playing xbox, he lags really badly and when I turn off my computer, it stops.
    Does anyone know what might be wrong with it?
    Thanks in advance.

    Hi...
    How much free space on the startup disk?
    Right or control click the MacintoshHD icon. Click Get Info. In the Get Info window you will see Capacity and Available. Make sure there's a minimum of 15% free disk space.

  • Gtx 970 bad fps all of a sudden

    my gpu was fine up until yesterday, i thought it was just the hardline beta but i tried battlefield 4 and im still getting really bad fps, i can only get 45 fps when i was getting 90+ on ultra before, what could be the issue.

    Quote from: arronlowley on 10-February-15, 17:59:19
    i was gonna get a new psu anyway, but i dont think thats the problem, firestrike test came back fine when my fps was low, i found someone on the nvidia forum with my exact same problem as me and the driver change worked for them too, i haven't tested it for long enough yet to deffo say its fixed but im about to do that now. also the h55 is enough to cool the i7, under load the max i get is 50 degrees, usually around 44. when i was getting low fps i looked and there was nothing unusual about the temps etc, it was just like the gpu was capped at 60 fps but dipping to 55 but after changing the drivers it shot back up.
    Could have been a malfunction in driver then. Which is kind of weird since I'm using the driver 347.25 and have no problems with my fps. (GTX 970 Gaming 4G)
    Probably just bad/corrupt installation.

  • Bad resolution when I save for web

    Just got Illustrator CC and its really bad resolution when I try to save for web on my new MacBook pro Retina (Don't know if it got anything to do with it)

    if you draw something using paths in illustrator and save it as AI or PDF, it will maintain those paths and draw its appearance (strokes etc) to whatever resolution you screen is at (or whatever you print it at). if you save something for web, it will convert those appearances into pixels. if you zoom in on those pixels, all they can do is get larger and make your image appear more blocky. when you save for web, you want the resolution of what you're saving to be the same as the resolution it will be used at. if you save an image at 100x100 pixels and then view it at that size on screen, it will look as good as you screen is capable of showing. if you enlarge it, it won't.

  • Lenovo Y50-70 bad FPS/perfomance

    I did get this Laptop on my Birthday about a half year ago and now on the summer and on the spring i did see when im not have the loadder connected i geting REALLY BAD fps but when im have it in i getting it like it should im really dispointed around it and battery life to that is only about a hour or 2 makes me really dispointed so if any one can help me i would be really happy and i having a cooling fan.

    When you say loader do you mean strömförsörjning? If so, the NVIDIA card only works while the computer is plugged in due to the battery's lack of ability to provide enough power. Sadly there's nothing to be done about that .  Också du kan skriva i svenska till mig i en privat meddelande om du vil. Ledsen min grammatik är dålig, jag talar bara en lite svenska xD.

  • Couln't  save a buffered image as BMP with java 1.4

    Dear friends,
    I tried to save a buffered image as BMP with java 1.4. When I run the program ,it executes sucessfully, but no image wasn't created. When I tried the same code with java 1.5 got the right result.
    This is the code I have written.
    public static void saveBMPFile(BufferedImage bufferredImage, String fileName) throws Exception{
              // TODO Auto-generated method stub
              try {
                   Iterator iter =
                        ImageIO.getImageWritersByMIMEType("image/bmp");
              // Get first writer
                   if (iter.hasNext()) {
                        ImageWriter writer = (ImageWriter) iter.next();
                        ImageWriteParam iwp = writer.getDefaultWriteParam();
                        iwp.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
                        iwp.setCompressionType("BI_RGB");                    
                        FileImageOutputStream fios = new FileImageOutputStream(new File(fileName));
                        writer.setOutput(fios);
                        IIOImage image = new IIOImage(bufferredImage, null, null);
                        writer.write(null, image, iwp);
                        bufferredImage.flush();
                        fios.flush();
                        fios.close();
         } catch (Exception e) {                 
         throw e;
    please help me to find its solution.
    thanks & regards
    K P Jyothish

    Please use code tags http://forum.java.sun.com/help.jspa?sec=formatting
    I can see no else for "if (iter.hasNext()) {", so if no encode is found, no error message would be displayed.

  • Image quality really bad on exporting

    after creatingt the webpage i export the file into HTML and images. But what i see is that the images are of really bad quality. How can i rectify this problem. Any help is much appreciated.
    thanks in advance.

    Before exporting, click on the preview button at the top of the document window, and then open the optimize panel. With the Optimize panel open, click on the slices over each of the images to try out the different image formats and compression settings. When you are satisfied with the way they will look when exported, choose File > Export.

  • Image darker when saved than on-screen buffered image

    Hi,
    Here is my little application. I am trying to simulate an rgb screen look based on image data. ie, the new image is an exaggerated tv look of the original image.
    When I try to encode/save a jpeg from my buffered image, the saved image is darker (colours also seem to be different) than what i see in my application frame. I like what I see in the JFrame and would like to have that saved. I am just an artist hack so excuse the cobbled together code. I have also included the original image, the image as it is saved, and an image as a rough approximation of the image in the JFrame.
    In the code you will see I have tried different ways to encode the image (commented out)
    Any ideas about this issue or how to make this program more sound please let me know.
    the code:
    http://zukanter.com/javaImageTest/displayImageRGBBuffer.java
    the orignal loaded into the appp:
    http://zukanter.com/javaImageTest/myPic.jpg
    the saved image:
    http://zukanter.com/javaImageTest/_003.jpeg
    the image as it is in the application window:
    http://zukanter.com/javaImageTest/_003Screen.jpg

    Hi
    My 2c.
    I`ve had a quick look at your code and the output and I`m assuming that the vertical RGB lines are what you intended.
    Jpeg works in blocks, and averages pixel valiues across them.
    If introducing those primaries into the graphic and then compressing it makes it darker that`s likely the result of the primary colours being averaged by the compression algorithm.
    You should look at resizing the image first, drawing it onto an offscreen buffer, then doing an overlay (alpha channel) with the primary colors instead, IMHO.
    regards

  • When I burn a dvd, it's really bad quality in black & white

    When I burn a dvd, it's really bad quality in black & white.

    What program are you using to burn the DVD? What is the original DVD content (another DVD disk or movie files -- what's their format?)?

  • CS4; detecting correct FPS when importing an image sequence

    Here's the problem: I'm rendering a sequence in a serie of targa images at 24 fps in 3dsmax. When importing into premiere pro it always sets it to 29.97 fps. I can use the interpret footage to change it back to 24 fps, but when you have multiple videos everyday it quickly becomes a time waster.
    Is there a way to do it automatically?
    Thanks,

    Because Premiere changed from having Project Settings in CS3 to Sequence Settings in CS4 and because there is no setting to set the default frame rate for image sequences, there is simply no way to do what you want.
    Project Settings used to govern the default frame rate for Sequences and for image sequences.   In CS4, that's not the case.
    It seems Adobe forgot about users who use image sequences on a regular basis.

  • My photos looks really bad when I try to recompose for a collage?

    why my photos look really bad when I try to use a recompose tool for put in a blank layer?
    Photoshop Elements

    Look under "More like this" on the right of this page, specifically "Re: no photo selected"; the discussion there may be of help.

Maybe you are looking for

  • How to unfreeze a MacBook Pro brand new

    My MacBook Pro froze up on me and will not unfreeze. Spinning ball, force quit will not work will not shut download, now it is on sign in page with spinning ball help

  • Problem beim Export aus PP CS4 - Video Kaputt

    Hey Leute! Ich habe folgendes Problem: Ich arbeite an einem Projekt in Premiere Pro CS4, mit Aufnahmen aus einer EOS 7D runtercodiert von 1080p h264 auf 720p h264. Das nur mal vorweg Ich habe so bereits einige Projekte bewältigt und erfolgreich in h2

  • Aperture with referenced library on a terastation

    I was experiencing a problem similar (or identical) to the one discussed in this post (http://discussions.apple.com/message.jspa?messageID=6695612&tstart=0) and made some head-way on debugging it. Since I have a few more data points, I'm creating a t

  • I am trying to purchase a refurbished iPod Touch 5

    I am trying to purchase a refurbished iPod on the online Apple Store and I can't figure out how to have it shipped to an Apple retail store. It says that it is available to be delivered to a store so why can't I even place my order?

  • Crystal Reports 2011 getting An unhandled win32 exception occurred in crw32

    I am using Crystal reports 2011 with windows XP. I am getting the error message "An unhandled win32 exception occurred in crw32.exe"  I have seen the resolution for this at ""Unhandled win32 exception occurred in crw32.exe [2920]."" but this does not