ImageIO, Timers, Transparency and a Rant

Hi all,
<BEGIN RANT>
After years of writing games and programming next-gen consoles, I foolishly decided to write a few online java games. Like many, I chose Java because it is very similar to c++ and accessible cross-platform on web pages by the masses with no extra downloads required (btw, I'm not using j3d for this reason). Instead I've found it to be nothing but a burden.
Today's gripes are below. If I sound like I'm having a rant, well, adter fighting it all this week, I am!. Any help/suggestions/discussions are most appreciated. I'm currently using j2sdk 1.4.1_02.
1) why can't I enable hardware accleration (currently transparency sucks on the framerate) without requiring permissions? What exactly am I going to do with it to make it a security risk?
2) Why doesn't Java (without j3d or any other extensions) support the high-resolution timer? Such a basic issue that has been plaguing these forums for years. It seems i can't even do a work around as using JNI requires permissions and an external module on the users machine so I can't do this from an APPLET without signing and installing something. Sure, I could just about use 15ms on w2k and make win98 users suffer 20fps with the 50ms res timer. I tried (and succeeded) using my own timers but that means I can't sleep (as sleep>0 will sleep for at least the timer resolution) so my cpu usage is on 99%. And it destroyed my win98 machine :-)
3) Has anyone had problems with ImageIO.read in an applet? I find that occasionally when reading an image from my web server, it reads it twice (I guess it found an error and re-requests it) and corrupts the image. At first I thought it was my php corrupting the image, but it does it on direct accesses as well. Toolkit.createImage does not seem to have this problem (but then I have to wait for it to load (currently i construct a cursor with the image which seems to sort it) and then paste it to BufferedImage rather than the inaccessible image type returned by toolkit). Toolkit does however have the advantage that I can use extensionless image files and prevent caching though which ImageIO.read seems unable to handle (it usually loses the palette of gifs etc without the extension hint). My web server is apache 2.0.45 on Win2K btw.
These issues concern APPLETS. If i wanted to write an application, I would use C++ and OpenGL with very little extra work required for each specific platform (I'd only support PC, Mac and x86 based linux anyway). The point is that i want it embedded on a web page, and I don't want the user to have to install anything other than the Java VM.
What about the rest of you?
What are your experiences with Java? Good? Bad?
Do you guys think there is any future for it?
Does Java 1.5 have anything to offer?
IF it comes down to it, and I NEED to sign my code and INSTALL code then I will just abandon Java altogether and just stick to windoze users (It will take a fraction of the development time and be far less painful for me to use ActiveX or .net).
Oh, and if you're just going to reply and say something like "I think Java's the bestest thing ever, it's so much better and cooler than C++ and all my friends think so too. Cos my teacher says so" then don't waste my time.
If you have games experience and know what you're on about then I'd love to hear your views.
<END RANT>
Cheers
-Simon

Hi Paul,
Thanks for your views.
Badly because it provides the security protections it
says it does?No, I mostly appreciate the security but some things seem a little too secure. For example, I want to use hardware acceleration for my translucencies but Java won't let me....
You can always ask users to change the permissions
your applet runs under, I guess, assuming the browser
support it. But at that point, why not just write
your game in C++ and tell people to download it and
run it normally?
If you're trying to write a Quake clone in java and
distribute it as an applet...don't bother.The point is that I don't want to do this. I want ppl to have to visit the web site to play the game without having to grant permissions or install anything or agree to run signed code (not just for advertising purposes but also as some of the games will be multiplayer). This is why I'm using Java and not activeX or .net.
I am perfectly capable of writing any genre of game to be cross platform in C++ (if I use OpenGL then I only need a thin platform-specific wrapper and I just compile it for my required targets - PC, Mac, x86 Linux), and I really don't see the point in attempting it as a Java application. The games I'm currently doing for my website in Java are simple 2d games suitable as applets. The main problem I'm having is that I need to sleep to free up the cpu, but the low-res timer resolution means that I can only run at 20fps on win98 when sleeping. Yes it runs ok, but by no means as smooth as I'd like.
I think java may be used in action gaming once it's
embedded into an environment that really supports it
(e.g., as a well-supported programming environment for
PlayStation 2) (and somehow I doubt that OpenGL
bindings for java will work as a gaming environment,
although that's just a hunch), and it's fine for
non-action games.Yes it can do the job, but the fact is that Java is and always will be slower than code compiled directly for the target CPU so this means my entire audience need to have higher spec machines to run it than I'd like. I would not write anything that is too CPU intensive in Java as there are also still a lot of low spec machines out there running win98 which I (unlike most ppl on these forums) am still willing to support.
Cheers
-Si

Similar Messages

  • Problem with adjusting both transparency and color of an object

    I am writing a program where when an object is picked, both it's transparency and color will be altered (the object will become opaque, and its color will turn to a predefined "selected" color), while the previously selected object will return to its original transparency and color. I am able to get this to work, except that objects that were picked two or more picks ago will remain in the selected color, albeit in their original transparency. This problem only seems to occur when transparency is factored in. The picking/color & transparency altering code is as follows.
    public class PickingListener extends MouseAdapter {
         private PickCanvas pickCanvas;
         private TextDisplay overlay;
         private Primitive p;
         private Primitive lastP;
         private ColoringAttributes origColor;
         private TransparencyAttributes origTransparency;
         public PickingListener(PickCanvas pickCanvasArg, TextDisplay overlayArg) {
              pickCanvas = pickCanvasArg;
              overlay = overlayArg;
         public void mouseClicked(MouseEvent e) {
              pickCanvas.setShapeLocation(e);
              PickResult result = pickCanvas.pickClosest();
              if (result == null) {
                   System.out.println("Nothing picked");
              } else {
                   p = (Primitive) result.getNode(PickResult.PRIMITIVE);
                   if (p != null) {
                        setSelectedColor();
                        overlay.setPickedBarInfo((BarInformation) p.getUserData());
                   else
                        System.out.println("null");
         private void setSelectedColor() {
              ColoringAttributes barCA = new ColoringAttributes();
              TransparencyAttributes barTransp = new TransparencyAttributes(TransparencyAttributes.NICEST, 0.0f);
              barCA.setColor(ColorConstants.SELECTED);
              if (lastP != null) {
                   lastP.getAppearance().setColoringAttributes(origColor);
                   lastP.getAppearance().setTransparencyAttributes(origTransparency);
              origColor = p.getAppearance().getColoringAttributes();
              origTransparency = p.getAppearance().getTransparencyAttributes();
              p.getAppearance().setColoringAttributes(barCA);
              p.getAppearance().setTransparencyAttributes(barTransp);
              lastP = p;
    }Capabilities to alter the primitive's color and transparency are all set.
         barAppearance.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_READ);
              barAppearance.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_WRITE);
              barAppearance.setCapability(Appearance.ALLOW_TRANSPARENCY_ATTRIBUTES_WRITE);          barAppearance.setCapability(Appearance.ALLOW_TRANSPARENCY_ATTRIBUTES_READ);
    ColoringAttributes barCA = new ColoringAttributes();
    barCA.setCapability(ColoringAttributes.ALLOW_COLOR_WRITE);
    barCA.setCapability(ColoringAttributes.ALLOW_COLOR_READ);)
    Any insight as to why this would occur would be greatly appreciated.
    -Adrian Benton

    A Behavior is the preferred way to make changes in a scenegraph. Here is an example from a previous post that changes the appearance of a shape when it collides with another shape.
    The javadoc for javax.media.j3d.Behavior appears to refer to the issue you have.
    Transparencies are confusing, different display adapters deal with them differently. Suggest you search the forum at
    http://forums.java.net/jive/forum.jspa?forumID=70
    for more detailed information.
    regards
    class CollisionDetector extends Behavior {
      private static final Color3f highlightColor = new Color3f(0.0f, 1.0f, 0.0f);
      private static final ColoringAttributes highlight = new ColoringAttributes(
          highlightColor, ColoringAttributes.SHADE_GOURAUD);
      private boolean inCollision = false;
      private Shape3D shape;
      private ColoringAttributes shapeColoring;
      private Appearance shapeAppearance;
      private WakeupOnCollisionEntry wEnter;
      private WakeupOnCollisionExit wExit;
      public CollisionDetector(Shape3D s) {
        shape = s;
        shapeAppearance = shape.getAppearance();
        shapeColoring = shapeAppearance.getColoringAttributes();
        inCollision = false;
      public void initialize() {
        wEnter = new WakeupOnCollisionEntry(shape);
        wExit = new WakeupOnCollisionExit(shape);
        wakeupOn(wEnter);
      public void processStimulus(Enumeration criteria) {
        inCollision = !inCollision;
        if (inCollision) {
          shapeAppearance.setColoringAttributes(highlight);
          wakeupOn(wExit);
        } else {
          shapeAppearance.setColoringAttributes(shapeColoring);
          wakeupOn(wEnter);
    }

  • Before Firefox 16 I was able to have full transparency and see through to my desktop. Now I am unable to do this but want it back, can I still do this and how?

    Depending on my theme and style I was able to force Firefox to be transparent and work with Aero to show through to my desktop or other windows behind the browser. I really liked this ability, however, sometime after Firefox 16 this stopped working and I have been looking for a solution ever since. I am currently on the the release version of Firefox.
    Does Firefox not allow this anymore or is there a way I can code this feature back using Styles or modifying one of the files in Firefox?

    Attached screen shot with Firefox version...Everything you see should be transparent.
    You might be seeing I have an old version as I have a few privacy apps running.
    I just attempted another reset and copied my old profile data back in.
    I've attempted in the past, disabling and removing extensions and apps one by one.
    Could my Styles code be incorrect?

  • Transparency and flattening

    I'm using AI CS3 on PC. I've been given an EPS file that was apparently created in AI 11 on Mac. It has no preview (at least not that will show up on PC).
    I opened the file in AI to save it with a preview. When I do a Save As, AI says:
    "When spot colors are used with transparency, changing them to process colors outside of Illustrator can generate unexpected results."
    Does this mean I need to change all of the spot colors in the file to CMYK? The file has been used as-is in the past apparently with no repercussions.
    Then AI says:
    "The document contains artwork that requires flattening."
    What should I do? I find the whole business of transparency and flattening confusing.
    I COULD just use the original EPS file as-is, but I really hate not having a preview.
    FWIW, the EPS will be used in an existing Quark file.
    TIA,
    Marlene

    The first message is just a warning. If you intend to keep the spot color(s) on press, there should be no conversion to process involved. If there is going to be a conversion down the line, you're better off dealing with it within Illustrator. That's what the warning is trying to tell you.
    My guess with the second message is that it has to do with the improved transparency flattening options in newer versions of Illustrator. The document uses transparency, and that means flattening is required (because PostScript does not support transparency).
    I would just let Illustrator do its thing and save out your new EPS with the Windows-compatible preview. If the file was used in the past without problems, you probably don't have to do anything within Illustrator. However, if you see a lot of transparency features in use, you might want to flatten more aggressively, even if that means further tipping the balance away from vector toward raster and ending up with a larger file.
    The preview really won't tell you much (other than position) once in Quark, so make sure you output a proof -- at least to Adobe PDF. Check to make sure each spot color in your Illustrator file goes to its own 'plate' out of Quark.
    Recommended reading: http://www.layersmagazine.com/illustrator-render-photoshop.html

  • Transparency and color blend space: fail!

    Hi there. I keep trying to export my pdf, to no avail.
    I get an error that pops up that says there is an error with my transparency and color blend space.
    HOWEVER, all my images are set to CMYK (it says so in the links panel) and my transparency blend space is also set to CMYK. I have no errors in my preflight panel. When I ignore the message and continue to export, the image looks completely different and not the way I want it to show up.
    Please let me know how I can fix this error! Thanks so much!

    Document CMYK is the assigned profile in Edit>Assign Profiles.... Working CMYK is Color Settings...>Working Spaces>CMYK. If there's no profile assigned, document and working are the same. So in this case Document CMYK is Coated FOGRA27 and Working CMYK is US Web Coated SWOP—the assigned FOGRA is color managing the document's native CMYK colors not the working US SWOP

  • Firefox 4 Menu Bar - When I hover over or select a menu bar item, the menu bar sub-menu becomes transparent and unreadable. Is this a known issue that can be corrected with an update or is it functionality that is not designed to work with this version?

    Firefox 4 Menu Bar - When I hover over or select a menu bar item, the menu bar sub-menu becomes transparent and unreadable. Is this a known issue that can be corrected with an update or is it functionality that is not designed to work with this version?

    If this happens on monitor 2 of 2, this problem has been solved here:
    http://support.mozilla.com/en-US/questions/794823#answer-157988
    Go to "Firefox"--> "Options" --> "Advanced"
    Then un-check "Use hardware acceleration when available"
    While not verified, I believe this problem is due to an SLI configuration where the focus is on monitor 1. (I.e acceleration is available, but only on monitor 1.)

  • Can we join the transparent and pooled tables?

    hi friends,
    i have a doubt that is when we want to get the data from transparent and pooled tables it is not possible to join the tables.
    so should we go with nested select statements or is there any way to get the data? with better performance
    if i go with nested select statements it takes a lot time thats y i need a better way
    for example i want the data from BKPF and BSEG based on BELNR
    please send me how can we get it
    regards
    jagadish

    hi rob
    thanks for response
    see the below code once
    SELECT * FROM bkpf
              WHERE gjahr = p_gjahr
              AND ( monat BETWEEN lv_1st_mth AND gw_prev_monat ).
    *- Selection with cost center
          IF  gw_kostl NE SPACE.
                 s_kostl = s_kostl+3(10).
                 SELECT * FROM bseg
                      WHERE bukrs = bkpf-bukrs
                      AND   belnr = bkpf-belnr
                      AND   gjahr = bkpf-gjahr
                      AND   kokrs = p_kokrs
                      AND   kostl IN s_kostl
                      AND   buzei = '001'
                      AND   lstar <> ' '.
                 MOVE bseg-lstar TO itab2-lstar .
                 MOVE bkpf-bukrs TO itab2-bukrs.
                 MOVE bkpf-belnr TO itab2-belnr.
                 MOVE bkpf-gjahr TO itab2-gjahr.
                 MOVE bkpf-monat TO itab2-monat.
                 MOVE bkpf-budat TO itab2-budat.
                 MOVE bseg-kokrs TO itab2-kokrs.
                 MOVE bseg-buzei TO itab2-buzei.
                MOVE bseg-wrbtr TO itab2-wrbtr.
    *Changed----
                 IF bseg-shkzg = 'H'.
                   lv_wrbtrcd = 0 - bseg-wrbtr.
                   itab2-wrbtr = lv_wrbtrcd.
                 ELSEIF bseg-shkzg = 'S'.
                   MOVE bseg-wrbtr TO itab2-wrbtr.
                 ENDIF.
                 MOVE bseg-fdwbt TO itab2-fdwbt.
                 MOVE bseg-sgtxt TO itab2-sgtxt.
                 MOVE bseg-kostl TO itab2-kostl.
                 APPEND itab2.
                 ENDSELECT.
          ELSE.
                 s_kostl = p_estat+0(4).
                 SELECT * FROM bseg
                      WHERE bukrs = bkpf-bukrs
                      AND   belnr = bkpf-belnr
                      AND   gjahr = bkpf-gjahr
                      AND   kokrs = p_kokrs
                      AND   kostl IN s_kostl
                      AND   buzei = '001'
                      AND   lstar <> ' '.
                 IF bseg-kostl+0(4) = s_kostl.
                     MOVE bseg-lstar TO itab2-lstar.
                     MOVE bkpf-bukrs TO itab2-bukrs.
                     MOVE bkpf-belnr TO itab2-belnr.
                     MOVE bkpf-gjahr TO itab2-gjahr.
                     MOVE bkpf-monat TO itab2-monat.
                     MOVE bkpf-budat TO itab2-budat.
                     MOVE bseg-kokrs TO itab2-kokrs.
                     MOVE bseg-buzei TO itab2-buzei.
                    MOVE bseg-wrbtr TO itab2-wrbtr.
    *Changed----
                 IF bseg-shkzg = 'H'.
                   lv_wrbtrcd = 0 - bseg-wrbtr.
                   itab2-wrbtr = lv_wrbtrcd.
                 ELSEIF bseg-shkzg = 'S'.
                   MOVE bseg-wrbtr TO itab2-wrbtr.
                 ENDIF.
                     MOVE bseg-fdwbt TO itab2-fdwbt.
                     MOVE bseg-sgtxt TO itab2-sgtxt.
                     MOVE bseg-kostl TO itab2-kostl.
                     APPEND itab2.
                 ENDIF.
                 ENDSELECT.
          ENDIF.
          ENDSELECT.
    regards
    jagadish

  • Pull down menus are transparent and empty squres where maybe a pix should be. What's happening with that?? Thx..Dave

    The entire webpage seems empty and colorless. When I roll over a square or something that is empty, I get the "hand" as if there is something in there that I should click on. All the pull down menus are transparent and hard to read against the background. I tried the same web site on IE and everything is good. It seems as if half of the Browser is loaded. The updates had no affect. My email site is a drab and dreary place that I use the Mac email instead. I remember on my old HP with Firefox it was great. And so was Thunderbird. What can I do??
    Thx....Dave

    What happens if you use a theme which changes all the background colours, so that no system colours are used?

  • Image in photoshop transparent and not showing image selected.

    My images are appearing in Photoshop as 'transparent' and not as the image selected. This is following a major fault created by hardware supplied to me which caused me to have to re-format my computer.

    Microcord,
    Did you try posting something via e-mail? All I see is a blank reply in the thread.
    Sometimes, e-mail/ attachments sent via e-mail never reach the forum. Please login to http://forums.adobe.com and respond to your post.
    -ST

  • Difference between transparent and replicated partitions

    whats the difference between transparent and replicated partitions in EAL. currently we have created essbase cube via transparent partition in eal. performance of obiee reports on essbase cube is very bad. now somebody suggested to create essbase cube via replicated partition in EAL. what difference would it make. one guy said replicated partition would make it more slow. i am confused. please explain.

    Transparent Partition does not occupy or create extra memory Space in the Destination Application , it just shows the Data from Source to the Destination cube . This partition is completely dependent on Existence of Source Data . While , in replicated Partition you can use a copy of source data in the Destination cube.
    FYI : Hyperion Essbase 11.1.1.0 &amp;#8211; Partitioning and its use cases &amp;#8211; Transparent, Replicated and Linked part…

  • How can i customize maverick dock in the bottom to be transparent and 2D

    macbookpro, late 2011 with os x mavericks:
    i tried to get the dock in the bottom transparent and in 2D, which in ML worked fine with the small program MIRAGE. this program does not appear to work in mavericks and can also not be updated from version 1.0.1. dock left or right side are no options for me. i also tried the terminal command somebody posted, makes no difference. has anyone a solution?

    It appears that this feature was removed, the Dock you are refering to was called the 'no-glass' Dock. It was used for the left & right Dock attachments styles, but the 'defaults write' would set it to work on the bottom too.
    I'd suggest you notify Apple in the hopes they add it (or similar) back to the possible options, I prefer it too & will miss it.
    http://www.apple.com/feedback/
    (The command was: defaults write com.apple.dock no-glass -boolean YES)

  • Consolidate transparency and blue screen?

    Hi- I have a transparent movie with an object in the center that then has a window open up revealing a blue screen. In the blue screen I want to place one image and in the backround (behind the transparency) I want to place another image. The problem I'm running into is that once the blue screen appears, it takes precedence over the transparency and my backround image dissapears. I can either have the backround image show through the transparency or the image show in the blue screen, but not both. I've tried nesting in layers, doesn't seem to make a difference. Anyone have any ideas?
    Thanks!
    Robert

    It sounds like you've not yet keyed out the blue screen. Is that right?

  • Less transparency and less design

    Hi there guys,
    Before installing ios7, I would like to read and save the various terms of service that I have to accept: 1) iOS 2) iCloud 3) Game center 4) privacy.
    If I choose "send an e-mail", I receive the privacy policy only . Why? Is it a mistake or an Apple decision?
    I also try finding these terms on the web. On the Italian apple site there is no references should be made to that use. There is a link to the USA site, where there are conditions of service of iOS7, in english of course, but not the others.
    Not finding this information, I asked a colleague who had already installed iOS7.
    I was lucky, because the design is really ugly!
    Less transparency and less design. is it a coincidence or a trend?
    what do you think about?
    Ciao a tutti,
    Prima di installare ios7, vorrei leggere e conservare i vari terms of service che devo accettare: 1) iOS 2) iCloud 3) Game center 4) privacy.
    ma se scelgo "invia per e-mail", mi viene spedita solo l'informativa sulla privacy. perchè? è un errore o una decisione Apple?
    Non trovandole le ho anche cercate su web. sul sito Apple Italia non ci sono e si rimanda a quello usa. su quello USA c'è solo il tos di iOS7.
    Non trovando queste informazioni, ho chiesto a un collega che aveva già installato iOS7. Sono stato fortunato, perchè il design è veramente brutto!
    Minore trasparenza e minor design. è un caso o una tendenza?
    Che ne pensate?

    What's your Transparency Blend Space set to?

  • When i open a pdf it is transparent and i can see my desktop wallpaper behind it making it hard to read

    when i try to open a PDF it is transparent and i can see the wallpaper behind it this makes it very hard to read

    Try to disable hardware acceleration in Firefox.
    *Tools > Options > Advanced > General > Browsing: "Use hardware acceleration when available"
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes
    *https://hacks.mozilla.org/2010/09/hardware-acceleration/
    Try to disable transparency in Windows.
    Right click in a free space on your desktop.<br />
    Left click on Personalization.<br />
    There are four options at the bottom of the screen, choose "Window Color and Appearance".<br />
    Select a border color<br />
    Uncheck: "Enable transparency"
    * http://www.howtogeek.com/howto/7955/how-to-fix-no-aero-transparency-in-windows-7/

  • [svn] 2707: Added optional "transparency" and "fillColor" parameters to GraphicElement.getBitmapData().

    Revision: 2707
    Author: [email protected]
    Date: 2008-08-01 11:37:59 -0700 (Fri, 01 Aug 2008)
    Log Message:
    Added optional "transparency" and "fillColor" parameters to GraphicElement.getBitmapData().
    Reviewer: Evtim
    Doc: n/a
    Bugs: n/a
    QE: yes
    Modified Paths:
    flex/sdk/trunk/frameworks/projects/flex4/src/flex/graphics/graphicsClasses/GraphicElement .as

Maybe you are looking for

  • I miss my calendar list of events!! How can I get my list back?

    Really? Why did they do away with that? Now the search button is really a search button. I relied on the list to see my week at a glance. Now, I only see one day at the bottom and it's hard to see. Help!

  • Problem with lead assignment rule

    Hi, I defined a new lead assignment rule group for my company. I defined two assignment rules according to the billing country value. I work on a demo version of Siebel on demand. The rule is active. If the value is USA the owner is employee A, if th

  • Auto nat vs manual nat

    Some how I have ended up with multiple network objects for the same network example obj-192.168.1.0 obj-192.168.1.0-1 obj-192.168.1.0-2 All are for the same network but have different nat statements. When I look at my NAT statements I have a bunch of

  • Does Photoshop Elements 12 Support the MWG Face Region Metadata Standard?

    I'm looking at the trial version of PhotoShop Elements 12. I see that it is possible to use the Organizer to automatically recognize faces and to manually define Face Regions in images. These then appear as People Tags in the Organizer. However, if I

  • Utilisation de l'extraction de fichiers (photoshop CC 2014) dans un droplet ?

    Bonjour à tous, je viens de réaliser une vidéo sur l'extraction de fichier avec Photoshop CC 2014. Je serais heureux d'avoir vos retours sur cette utilisation de l'extraction des fichiers que j'ai couplée avec l'exportation de fichiers de lightroom a