Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - mbowen89

Pages: 1 [2]
16
Support / Re: Overlapping overlays, using transparency...help!?
« on: November 21, 2012, 10:57:57 pm »
Is it just me or can I not see a .getObject3D call for overlays? I know it's in the doc, but not showing up for me.

rpm_gauge.getObject3D....

I put the RPM gauges and needle in another world but it's still finicky... hmm

---
Edit:

This seems to be working now, hopefully it will last! :)

Code: [Select]
TextureManager.getInstance().addTexture("rpm_gauge", new Texture(res.openRawResource(R.raw.rpm_gauge_128), true));
rpm_gauge = new Overlay(overlay_world, 0, 0, 128, 128, "rpm_gauge");
rpm_gauge.setDepth(10);
rpm_gauge.setTransparency(255);
TextureManager.getInstance().addTexture("rpm_gauge_needle", new Texture(res.openRawResource(R.raw.rpm_gauge_needle_128), true));
rpm_gauge_needle = new Overlay(overlay_world, 0, 0, 128, 128, "rpm_gauge_needle");
rpm_gauge_needle.setDepth(5);
rpm_gauge_needle.setTransparency(255);

17
Support / Re: Overlapping overlays, using transparency...help!?
« on: November 20, 2012, 08:15:59 pm »
Ok, and that's why I wouldn't mind using blitting, because I wouldn't have to worry about all of this, correct? But the reason why using overlays is nice, is because I can make the gauge, and then place needle on top of gauge as another overlay, and rotate it. Whereas I cannot rotate a blit, unfortunately...

So do you think I am going about this the right way? Right now it is going to be a big problem where the scene is coming in front of the overlay in "cockpit" view. I'd use blitting but I can't rotate. Any ideas?

For example, how did you draw your mini map that rotates showing direction, etc for you RPG? Are you blitting that so it won't crash with the scene? But if you blit, how do you rotate?

18
Support / Re: Overlapping overlays, using transparency...help!?
« on: November 20, 2012, 07:59:42 pm »
I added some other overlays with transparency, and they work great since I'm not trying to overlap them, however they still like to flicker. I changed their depth to 2 and that seemed to help them, though the needle still flickered.

Is this actually moving them 2 units from camera? I don't know the right terminology. What if the camera get within 2 units of something?

Edit: Made gauge depth 3, needle depth 2 and no more flicker. Sweet!

Still confused why overlay creation order trumps depth... :(

When I put the camera into the driver seat position, the overlays go partially behind part of the object frame... that's why I hate that I have to move them out so far :(

Any idea?

19
Support / Re: Overlapping overlays, using transparency...help!?
« on: November 20, 2012, 07:09:42 pm »
This code makes the gauge transparent (good) but makes the needle disappear:
Code: [Select]
                                TextureManager.getInstance().addTexture("rpm_gauge", new Texture(getResources().openRawResource(R.raw.rpm_gauge_128), true));
rpm_gauge = new Overlay(world, 0, 0, 128, 128, "rpm_gauge");
rpm_gauge.setDepth(1.5f);
rpm_gauge.setTransparency(255);
TextureManager.getInstance().addTexture("rpm_gauge_needle", new Texture(getResources().openRawResource(R.raw.rpm_gauge_needle_128), true));
rpm_gauge_needle = new Overlay(world, 0, 0, 128, 128, "rpm_gauge_needle");
rpm_gauge_needle.setDepth(1f);
rpm_gauge_needle.setTransparency(255);

This code makes the needle appear, but it flickers as vehicle and camera move down track:

Code: [Select]
TextureManager.getInstance().addTexture("rpm_gauge_needle", new Texture(getResources().openRawResource(R.raw.rpm_gauge_needle_128), true));
rpm_gauge_needle = new Overlay(world, 0, 0, 128, 128, "rpm_gauge_needle");
rpm_gauge_needle.setDepth(1f);
rpm_gauge_needle.setTransparency(255);
TextureManager.getInstance().addTexture("rpm_gauge", new Texture(getResources().openRawResource(R.raw.rpm_gauge_128), true));
rpm_gauge = new Overlay(world, 0, 0, 128, 128, "rpm_gauge");
rpm_gauge.setDepth(1.5f);
rpm_gauge.setTransparency(255);

20
Support / Overlapping overlays, using transparency...help!?
« on: November 20, 2012, 04:51:44 pm »
Ok, so I have tried to read up on everything I could do with this, and tried a lot of stuff but can't seem to nail this... please help.

Basically I want to create some gauges as a HUD, so for example an RPM gauge.

I made it in GIMP as a 128x128 square for example, with transparent background. I made the round gauge centered, and I also made a needle centered on transparent background, check these two images out:

Gauge:
Needle:

So if I make two overlays, both at 0,0... they overlap perfectly, I can rotate the needle overlap to correlate with RPM, awesome. BUT, I get a black background of a square instead of transparency... ok so I do rpm_gauge.setTransparency(100); for example, and the black goes away and is transparent. I do the same for needle. BUT when I set the transparency on the main gauge, the needle also disappears with it. Here is the code that does that:

Code: [Select]
                                TextureManager.getInstance().addTexture("rpm_gauge", new Texture(getResources().openRawResource(R.raw.rpm_gauge_128), true));
rpm_gauge = new Overlay(world, 0, 0, 128, 128, "rpm_gauge");
rpm_gauge.setDepth(1.1f);
rpm_gauge.setTransparency(255);
TextureManager.getInstance().addTexture("rpm_gauge_needle", new Texture(getResources().openRawResource(R.raw.rpm_gauge_needle_128), true));
rpm_gauge_needle = new Overlay(world, 0, 0, 128, 128, "rpm_gauge_needle");
rpm_gauge_needle.setDepth(1f);
rpm_gauge_needle.setTransparency(255);

If I comment out: rpm_gauge.setTransparency(255);, the needle reappears but the gauge has black for transparent areas. I've tried using different transparency values for both, changed depth, etc... am I doing something wrong?

Thanks

---------
Edit:

Ok, so I reversed the order in which I create the overlays (needle first), and of course it works now... somewhat. The needle likes to flicker quite a bit, and disappeared one time as well until I made it rotate by increasing RPM again. I'm actually doing this with a boost and speed gauge as well. Hopefully I can get a better working solution? Thanks :)

Pages: 1 [2]