Text2D, Text3D in Xith3D?

Hi all. I’ve attempted to port my Java3D app to Xith3D. It’s great to find a familar scenegraph API in Xith3D. Please keep hammer away at this.

I don’t see anything like the Java3D Text2D nor Text3D classes for getting text easily into an app. As someone who hasn’t done much JOGL programming, nor OpenGL programming, I can’t see as easy a way to do this.

Does Xith3D plan to include these Text classes? Or, can someone point me to an easy means to get text into my app?

Thanks,
-Andrew

Text2D is a part of com.sun.j3d.utils.geometry package, and source for it should be somewhere in src of Java3D SDK, so it should be easy to port it to Xith3D, and neither OpenGL nor JOGL skills required to do so.

Regarding Text3D, this is not implemented for a moment, but [as for me] there are plans to do so. Anyway, any help in this area would be great.

Yuri

Thanks for the suggestion. The Text2D port looked simple, but my attempt at it renders garbled text into Xith3D, oops, and I can’t say why.

The original Text2D class contains the following comment about the width and height of the BufferedImage:

// Need to make width/height powers of 2 because of Java3d texture
// size restrictions
int pow = 1;
for (int i = 1; i < 32; ++i) {
pow *= 2;
if (width <= pow)
break;
}
width = Math.max (width, pow);

  pow = 1;
  for (int i = 1; i < 32; ++i) {
      pow *= 2;
      if (height <= pow)
        break;
  }
  height = Math.max (height, pow);

Anyone know how this applies in Xith3D? My attempts at tinkering with it didnt’ work.

Thanks,
-Andrew

Yes, generally width and height of the images (used for textures) have to be power of 2, unless we will implement support for non-pow-2 OpenGL extension support [which is optional].

Yuri

P.S. And you should use the latest version of Xith3D from CVS because of it contains important fix for small images of sizes < 2x2

Is there a precise list of:

  • what Xith3D will contain?
  • what has been (or is currently) developed?
  • what left to be developed?

It may be useful for people (which are not tagged as developers) who wants to bring their little help to build Xith3D.
They can check the list, develop their piece (ex: Text2D) and submit their code to a developer who check it, test it and integrate it into Xith3D.

Just a thought :wink:

DJ

Yes, agree - such list will be great to have.

How do you think it should look - as a comparison to Java3D, list of features or … ?

I was thinking about comparison to Java3D once, but there are some features that do not exist in Java3D [as well as some that will never be implemented]. (BTW, I never started with this…)

Also I think if we make such a list, we should also make tests/demos for all the features listed.

Yuri

Also the sticky topic “Xith3D features” was created exacly for these purposes.

Quite true but we have no view of what is currently developed, and what has to be developed.
The list may look like the one in “Xith3D features” but with columns like:

  • Name of the feature
  • Stat:
    • TD: to Develop,
    • IP: Development in progress + Name of the persons working on it,
    • FN: Development finshed
  • Test: Name of the test case where the feature is tested
  • Bugs: list of the issues to be resolved for this feature

Anyway, something like that ;D

I know it’s quite of work behind to keep it updated but it will be great :wink:

DJ

Yuri, you did a great job in the past weeks. Unfortunately we can’t edit David’s feature list to add your own changes (and possibly your ToDo list). I suggest to either move the feature list to question 12 (currently) of the xith.org FAQ or to create a new section “feature list” in the docs section of xith.org.

[quote]- Name of the feature

  • Stat:
    • TD: to Develop,
    • IP: Development in progress + Name of the persons working on it,
    • FN: Development finshed
  • Test: Name of the test case where the feature is tested
  • Bugs: list of the issues to be resolved for this feature
    [/quote]
    Then maybe this should be in Issues database under specific component, such as Xith3D core [just thinking - don’t treat as final idea]?

Also if someone will summarize my comments to CVS updates, it will I guess also help a lot (I always make very clear statement what has been changed and provide a test demonstrating new/changed feature).

Yuri

If you havn’t already - subscribe to the CVS mailing list. Then you can watch what classes change and read Yuri’s comments which are always very clear (thanks Yuri!).

Will.

Back to the thread topic:

I can confirm that the Text2D class of Java3D is not directly usable. It seems to display the text several times and has strange artefacts. I just wanted to display the framerate on the screen without using Swing.

Yes this is on the todo list. I tried porting sun’s stuff too… yucky! The best way to do this (and how I will probably do it) is to use a combination of suboverlay and billboard to keep it oriented.

Text2D is different from overlays in that it is embedded in the scene and gets smaller with distance.

BTW to put an FPS counter on the screen just use the overlay system that Xith3D has.

That’s what I did in the end. I prepared a tutorial which contains an fps counter, which you can plug in your app by writing just one line. It uses UIWindow and will be in the Getting Started Guide soon.

There’s a small documentation bug in UIOverlay: The explanation for this class is below “public class UIOverlay {”, but should be above. Hope you can quickly fix this.

I didn’t work directly with UIOverlay, but shouldn’t it implement the UIOverlayInterface?

Btw. Good to see you back in the forum. :slight_smile:

Did anything ever come of this? Has anyone successfully done 2D text without the UIOverlay system? I want to display the names of objects in the 3d world at various distances and locations around the object. Something like this would be helpful.

Currently you use could a rectangle with a texture on it as a workaround.

The texture can be made by using Javas 2d features but make sure it becomes not bigger than 256x256 to support all graphics cards.

…or even 128x128 (at least for VIA CLE266 on Linux in some modes)…

But there is always a possibility to split texture and geometry to smaller pieces, so you overcome this limitation.

Yuri

I am writing a few text-related classes. They are not terminated, but if you really need it badly I can give it to you. Maybe this can also serve as a starting point to implementing Text2D, although I am not familiar with that particular feature of Java3D.
There is no problem for me to give you that code, but as I planned to eventually give it to Xith3D when it gets decent (my code, not xith ;o), I think we should find a way to collaboratively improve it until it can be integrated into Xith.
What do you, and core Xith developpers, think?

I had considered what is recommended above (drawing textures with 2d and billboarding them) but the Billboard class isn’t fully implemented because Behaviours aren’t in place yet. So there are a number of components I will have to derive to make this work. If you have code, I’m sure we’d all appreciate having a look at it and possibly contributing to its improvement. Perhaps post a URL for download?

Has anyone successfully implemented text3d then?

any help woud be cool,

pedro