Making GLMorphic plugin work in Pharo

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

Making GLMorphic plugin work in Pharo

melkyades
Hi, this is my first mail to the list so hello everybody.

I've been trying to make GLMorphic work on pharo and got some useful results. I investigated the plugin that was needed to integrate into the VM and noticed it was really small, so I thought why make this in C if you can implement it directly in smalltalk. Shortly after that I came up with a translation of it (through FFI) so that you can use it with the VM as is.
The code isn't something I'd call good, but it works fine (only windows, sorry).


If you want to try it, you should do

ScriptLoader loadFFI.

and then download the GLMorphic-JEP version of GLMorphic package from squeaksource (after GLMorphic-sig? ). I also made some modifications to FFI-Examples, so you may also have to dowonload FF-Examples-JEP from squeakfoundation.org. I'm new to monticello so it wouldn't be strange if nothing got uploaded correctly.

Some things work and most looks messed up, specially fonts... try

World fullDrawOn: GLDisplayScreen testCanvas.

and you'll see.

Let me know what you think.

Bye!

--
Javier Pimás
Ciudad de Buenos Aires

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Making GLMorphic plugin work in Pharo

Mariano Martinez Peck


2009/7/27 Javier Pimás <[hidden email]>
Hi, this is my first mail to the list so hello everybody.

I've been trying to make GLMorphic work on pharo and got some useful results. I investigated the plugin that was needed to integrate into the VM and noticed it was really small, so I thought why make this in C if you can implement it directly in smalltalk. Shortly after that I came up with a translation of it (through FFI) so that you can use it with the VM as is.
The code isn't something I'd call good, but it works fine (only windows, sorry).


If you want to try it, you should do

ScriptLoader loadFFI.

and then download the GLMorphic-JEP version of GLMorphic package from squeaksource (after GLMorphic-sig? ). I also made some modifications to FFI-Examples, so you may also have to dowonload FF-Examples-JEP from squeakfoundation.org. I'm new to monticello so it wouldn't be strange if nothing got uploaded correctly.

Some things work and most looks messed up, specially fonts... try

World fullDrawOn: GLDisplayScreen testCanvas.

and you'll see.

Let me know what you think.

Hi! Congratulations and welcome! I test it but I got the attached PharoDebug.log

 

Bye!

--
Javier Pimás
Ciudad de Buenos Aires

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

PharoDebug.log (41K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Making GLMorphic plugin work in Pharo

Igor Stasenko
In reply to this post by melkyades
2009/7/27 Javier Pimás <[hidden email]>:

> Hi, this is my first mail to the list so hello everybody.
>
> I've been trying to make GLMorphic work on pharo and got some useful
> results. I investigated the plugin that was needed to integrate into the VM
> and noticed it was really small, so I thought why make this in C if you can
> implement it directly in smalltalk. Shortly after that I came up with a
> translation of it (through FFI) so that you can use it with the VM as is.
> The code isn't something I'd call good, but it works fine (only windows,
> sorry).
>

Yes, you could implement it purely using FFI, but there's few things,
why i decided to make a plugin instead:
- you can't access the squeak window handle directly, there is no
primitive. Accessing the window handle, as it shown in Win32/FFI
examples , using activeWindow() function, is not what i like to be
depend on.
As well as filling the boring PIXELFORMATDESCRIPTION fields is not
very easy in smalltalk... :)

But anyways, if you did it, it is good, because now, it could work w/o
additional plugin.
An initialization & windowing stuff can be ported onto another
platforms with a bit of pain, but the rest should work as usual
because its OpenGL :)

>
> If you want to try it, you should do
>
> ScriptLoader loadFFI.
>
> and then download the GLMorphic-JEP version of GLMorphic package from
> squeaksource (after GLMorphic-sig? ). I also made some modifications to
> FFI-Examples, so you may also have to dowonload FF-Examples-JEP from
> squeakfoundation.org. I'm new to monticello so it wouldn't be strange if
> nothing got uploaded correctly.
>
> Some things work and most looks messed up, specially fonts... try
>

i suspect that the source of mess is texture handling. Especially with
font glyphs.
I had plans to rewrite the texture/font cache for it, to not use weak
finalization.
Because i suspect that this is a reason why sometimes textures go wild
- because finalization process interrupts UI process in the middle.
And this potentially could damade the OpenGL state mechanism, because
of out-of-order calls.
At time, i implemented it, i was not aware of Squeak's scheduling nuances :)

> World fullDrawOn: GLDisplayScreen testCanvas.
>
> and you'll see.
>
> Let me know what you think.
>
> Bye!
>
> --
> Javier Pimás
> Ciudad de Buenos Aires
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>



--
Best regards,
Igor Stasenko AKA sig.

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Making GLMorphic plugin work in Pharo

Igor Stasenko
In reply to this post by melkyades
2009/7/27 Javier Pimás <[hidden email]>:

[snip]

> If you want to try it, you should do
>
> ScriptLoader loadFFI.
>
> and then download the GLMorphic-JEP version of GLMorphic package from
> squeaksource (after GLMorphic-sig? ). I also made some modifications to
> FFI-Examples, so you may also have to dowonload FF-Examples-JEP from
> squeakfoundation.org. I'm new to monticello so it wouldn't be strange if
> nothing got uploaded correctly.
>

Please, put this into GLMorphic package. Make a separate class & copy
the code you need.
FFI-Examples is bad place for this.

Btw, i'm currently in the middle of writing plugin for binding the
OpenVG (http://www.khronos.org/openvg/).
And your new additions could be useful, because for tests i wanna use
the ShivaVG implementation, which
expects a pre-initialized OpenGL rendering context...

[snip]


--
Best regards,
Igor Stasenko AKA sig.

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Making GLMorphic plugin work in Pharo

melkyades
>- you can't access the squeak window handle directly, there is no primitive.

Yes, I also found that problem, but there must be a way to find it in some place (or there should be) without writing a plugin.

>Please, put this into GLMorphic package. Make a separate class & copy
>the code you need.
>FFI-Examples is bad place for this.

Ok I'll change that, and also I'll try to fix the glitches (at least making the fonts respect the ascend so that the characters are placed in the baseline.

On Mon, Jul 27, 2009 at 4:34 PM, Igor Stasenko <[hidden email]> wrote:
2009/7/27 Javier Pimás <[hidden email]>:

[snip]

> If you want to try it, you should do
>
> ScriptLoader loadFFI.
>
> and then download the GLMorphic-JEP version of GLMorphic package from
> squeaksource (after GLMorphic-sig? ). I also made some modifications to
> FFI-Examples, so you may also have to dowonload FF-Examples-JEP from
> squeakfoundation.org. I'm new to monticello so it wouldn't be strange if
> nothing got uploaded correctly.
>


Btw, i'm currently in the middle of writing plugin for binding the
OpenVG (http://www.khronos.org/openvg/).
And your new additions could be useful, because for tests i wanna use
the ShivaVG implementation, which
expects a pre-initialized OpenGL rendering context...

[snip]


--
Best regards,
Igor Stasenko AKA sig.

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project



--
Javier Pimás
Ciudad de Buenos Aires

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Making GLMorphic plugin work in Pharo

melkyades
Mariano, you can update and test it again now. I moved all the code to GLMorphic package and everything you need should be there.

On Mon, Jul 27, 2009 at 6:45 PM, Javier Pimás <[hidden email]> wrote:
>- you can't access the squeak window handle directly, there is no primitive.

Yes, I also found that problem, but there must be a way to find it in some place (or there should be) without writing a plugin.


>Please, put this into GLMorphic package. Make a separate class & copy
>the code you need.
>FFI-Examples is bad place for this.

Ok I'll change that, and also I'll try to fix the glitches (at least making the fonts respect the ascend so that the characters are placed in the baseline.

On Mon, Jul 27, 2009 at 4:34 PM, Igor Stasenko <[hidden email]> wrote:
2009/7/27 Javier Pimás <[hidden email]>:

[snip]

> If you want to try it, you should do
>
> ScriptLoader loadFFI.
>
> and then download the GLMorphic-JEP version of GLMorphic package from
> squeaksource (after GLMorphic-sig? ). I also made some modifications to
> FFI-Examples, so you may also have to dowonload FF-Examples-JEP from
> squeakfoundation.org. I'm new to monticello so it wouldn't be strange if
> nothing got uploaded correctly.
>


Btw, i'm currently in the middle of writing plugin for binding the
OpenVG (http://www.khronos.org/openvg/).
And your new additions could be useful, because for tests i wanna use
the ShivaVG implementation, which
expects a pre-initialized OpenGL rendering context...

[snip]


--
Best regards,
Igor Stasenko AKA sig.

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project



--
Javier Pimás
Ciudad de Buenos Aires



--
Javier Pimás
Ciudad de Buenos Aires

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Making GLMorphic plugin work in Pharo

Igor Stasenko
Btw the last thing i added is Frame Buffer Object extension
(see GLFboBuffer & friends).

It is not tested very well, and not integrated with GLCanvas.

FBOs, if they are available, can be used to render into texture as if
you render on screen.

I planned to use it for caching the window contents when you dragging
it.. there , of course, many other use cases.

--
Best regards,
Igor Stasenko AKA sig.

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project