2D text views over a 3D shell

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

2D text views over a 3D shell

prometeus57
Hi,

I need to annotate a bunch of 3D objects in a 3D shell with text,
specifically their names. The simplest way I can think of to do that is
to programmatically create StaticText views within my 3D shell's view.
Unfortunately, that brings me to a dead halt because I can't figure out
how to programmatically access the 3D shell's view. It's not like it's
a class anywhere, it's some kind of "resource" that doesn't seem to be
accessible from the class hierarchy browser. Any advice? Any
hare-brained ideas?

Richard


Reply | Threaded
Open this post in threaded view
|

Re: 2D text views over a 3D shell

Christopher J. Demers
<[hidden email]> wrote in message
news:[hidden email]...

> Hi,
>
> I need to annotate a bunch of 3D objects in a 3D shell with text,
> specifically their names. The simplest way I can think of to do that is
> to programmatically create StaticText views within my 3D shell's view.
> Unfortunately, that brings me to a dead halt because I can't figure out
> how to programmatically access the 3D shell's view. It's not like it's
> a class anywhere, it's some kind of "resource" that doesn't seem to be
> accessible from the class hierarchy browser. Any advice? Any
> hare-brained ideas?

What is the 3D shell?  Are you using DirectX, or OpenGL, or some third party
rendering system?  Depending upon the way the shell works superimposing
StaticText views may not handle refreshes well.  There is almost certainly a
way to render text in whatever is rendering the 3D objects.

You might try using the Visual Object Finder to look at the view (it is a
toolbar button that looks like a magnifying glass looking at a beach ball).
Click the button and then click on your view.  You can then inspect the view
to find out what it is.  The view can be programmatically accessed a number
of ways.  If you have a presenter behind it you can sent it the view
message, if it is a named sub view you can access it via: view viewNamed:
'viewName'.

Chris


Reply | Threaded
Open this post in threaded view
|

Re: 2D text views over a 3D shell

prometeus57
> > I need to annotate a bunch of 3D objects in a 3D shell with text,
> > specifically their names. The simplest way I can think of to do that is
> > to programmatically create StaticText views within my 3D shell's view.
> > Unfortunately, that brings me to a dead halt because I can't figure out
> > how to programmatically access the 3D shell's view. It's not like it's
> > a class anywhere, it's some kind of "resource" that doesn't seem to be
> > accessible from the class hierarchy browser. Any advice? Any
> > hare-brained ideas?
>
> What is the 3D shell?  Are you using DirectX, or OpenGL, or some third party
> rendering system?  Depending upon the way the shell works superimposing
> StaticText views may not handle refreshes well.  There is almost certainly a
> way to render text in whatever is rendering the 3D objects.

I'm using ST3D which works over OpenGL, which means that I am not using
OpenGL directly and have no intention to.

There is no way to render text in ST3D, nevermind 2D text. There is no
class that mentions text and none of the applications or examples use
any text, whether 2D or 3D. It is an incredibly primitive 3D engine,
but I don't know of any others in Smalltalk. If you do know of another
high-level retained-mode 3D engine, preferably in Smalltalk, then I'd
be grateful to hear it.

So while I'm aware that refreshes would be a bitch using StaticText,
and how, it still seems the right way to go given what I know.

> You might try using the Visual Object Finder to look at the view (it is a
> toolbar button that looks like a magnifying glass looking at a beach ball).
> Click the button and then click on your view.  You can then inspect the view
> to find out what it is.  The view can be programmatically accessed a number
> of ways.  If you have a presenter behind it you can sent it the view
> message, if it is a named sub view you can access it via: view viewNamed:
> 'viewName'.

Alright, that's more like it. But what I really need to do is

* create views
* make them subviews of another view
* make sure they're rendered
* move around their positions onscreen
* destroy them

And I need to do *ALL* of this programmatically. Note that it's the
position one that's the most problematic, but I should be able to find
out by investigating.

Thank you for your reply Christopher,

Richard K


Reply | Threaded
Open this post in threaded view
|

Re: 2D text views over a 3D shell

Christopher J. Demers
<[hidden email]> wrote in message
news:[hidden email]...
> I'm using ST3D which works over OpenGL, which means that I am not using
> OpenGL directly and have no intention to.
>
> There is no way to render text in ST3D, nevermind 2D text. There is no
> class that mentions text and none of the applications or examples use
> any text, whether 2D or 3D. It is an incredibly primitive 3D engine,
> but I don't know of any others in Smalltalk. If you do know of another
> high-level retained-mode 3D engine, preferably in Smalltalk, then I'd
> be grateful to hear it.

I believe that Squeak has some nifty 3D features.  I think the 3D frame work
is called Alice.  It may be worth a look.  Direct3D may also be of interest
to you but you would need to generate the wrappers for the ActiveX
components your self.

> So while I'm aware that refreshes would be a bitch using StaticText,
> and how, it still seems the right way to go given what I know.

Trying to superimpose a static text label over an OpenGL view _may_ not work
at all.  I think that OpenGL in Windows is implemented via DirectX, and I
believe that DirectX can open special views that may not allow StaticText
views to be visible.  I suggest an experiment to see if it will work before
investing a lot of time.

>
> Alright, that's more like it. But what I really need to do is
>
> * create views
> * make them subviews of another view
> * make sure they're rendered
> * move around their positions onscreen
> * destroy them

Here is a very quick and dirty example:
=========
"Open a shell and place 5 StaticText views."
shell := Shell show.
1 to: 5 do: [:eachIndex |
    st := StaticText new.
    shell view addSubView: st name: 'stTest', eachIndex displayString.
    st text: 'Test' , eachIndex displayString.
    st extent: (st canvas textExtent: st text).
    st position: 50@50 + (eachIndex * 30) ].

"Destroy the last one"
st destroy.
=========

Good luck,
Chris


Reply | Threaded
Open this post in threaded view
|

Re: 2D text views over a 3D shell

Aaron Wieland-3
In reply to this post by prometeus57
[hidden email] wrote:
> [...] If you do know of another
 > high-level retained-mode 3D engine, preferably in Smalltalk, then I'd
> be grateful to hear it.

I recommend TV3D (http://truevision3d.com/home.php).  Although it isn't
implemented in Smalltalk, I had little trouble using it in Dolphin once
the ActiveX Component Wizard had generated the requisite wrappers.  I
stopped using it after translating several basic tutorials, but it is a
very powerful engine.  Also, you can use it for free until you're ready
to deploy a commercial app.

Cheers,
-- Aaron