Opengl and Squeak

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

Opengl and Squeak

kilon
Is there a library out there for squeak that will allow me to use opengl 4 ?
Reply | Threaded
Open this post in threaded view
|

Re: Opengl and Squeak

Hans-Martin Mosner
Am 16.08.2012 19:17, schrieb kilon:
> Is there a library out there for squeak that will allow me to use opengl 4 ?
>
>
I think you should be able to extend the existing OpenGL interface with the OpenGL 4 functions that you want to access.
But AFAIK no one has done it yet.

Cheers,
Hans-Martin

Reply | Threaded
Open this post in threaded view
|

Re: Opengl and Squeak

LawsonEnglish
On 8/16/12 11:13 AM, Hans-Martin Mosner wrote:

> Am 16.08.2012 19:17, schrieb kilon:
>> Is there a library out there for squeak that will allow me to use opengl 4 ?
>>
>>
> I think you should be able to extend the existing OpenGL interface with the OpenGL 4 functions that you want to access.
> But AFAIK no one has done it yet.
>
> Cheers,
> Hans-Martin
>
>
The NativeBOost OpenGL has bindings for everything that is found in the
OpenGL.org headers page, at least from the last time that Igor ran his
utility to create the bindings a few months ago, so it is actually more
up to date than any commercial C compiler or at least will be if you
decide to run the utility yourself.  NBOpenGL requires Igor's custom
CogVM. I don't know if there are any Pharo dependencies involved in the
packages that the utility creates or with any other aspect of
NativeBoost. You'll have to ask him.

L.

--
Squeak from the very start (introduction to Squeak and Pharo Smalltalk for the (almost) complete and compleate beginner).
https://www.youtube.com/playlist?list=PL6601A198DF14788D&feature=view_all


Reply | Threaded
Open this post in threaded view
|

Re: Opengl and Squeak

kilon
Thanks for the replies from both of you. 

I am trying to find the laziest route right now. Nativeboost is of course an option, but i would prefer if I remained on Squeak and not having to port on Pharo. Last time I checked the NBOpengl was for Pharo and not available in all OSes. 

How exactly and what exactly I will extend. Squeak AFAIK has no opengl support included as libray. At least I cant see one in the system browser and I am aware there is a MorphiGL , Croquet and Open Cobalt but nowhere there is info about which opengl versions are supported. I am also abit nooby with opengl so I am trying to find my barings. any help is appreciated. 


From: Lawson English <[hidden email]>
To: [hidden email]
Sent: Thursday, 16 August 2012, 21:57
Subject: Re: [squeak-dev] Opengl and Squeak

On 8/16/12 11:13 AM, Hans-Martin Mosner wrote:

> Am 16.08.2012 19:17, schrieb kilon:
>> Is there a library out there for squeak that will allow me to use opengl 4 ?
>>
>>
> I think you should be able to extend the existing OpenGL interface with the OpenGL 4 functions that you want to access.
> But AFAIK no one has done it yet.
>
> Cheers,
> Hans-Martin
>
>
The NativeBOost OpenGL has bindings for everything that is found in the OpenGL.org headers page, at least from the last time that Igor ran his utility to create the bindings a few months ago, so it is actually more up to date than any commercial C compiler or at least will be if you decide to run the utility yourself.  NBOpenGL requires Igor's custom CogVM. I don't know if there are any Pharo dependencies involved in the packages that the utility creates or with any other aspect of NativeBoost. You'll have to ask him.

L.

-- Squeak from the very start (introduction to Squeak and Pharo Smalltalk for the (almost) complete and compleate beginner).
https://www.youtube.com/playlist?list=PL6601A198DF14788D&feature=view_all






Reply | Threaded
Open this post in threaded view
|

Re: Opengl and Squeak

Hans-Martin Mosner
Am 16.08.2012 21:08, schrieb dimitris chloupis:
> Thanks for the replies from both of you.
>
> I am trying to find the laziest route right now. Nativeboost is of course an option, but i would prefer if I remained on Squeak and not having to port on Pharo. Last time I checked the NBOpengl was for Pharo and not available in all OSes.
>
> How exactly and what exactly I will extend. Squeak AFAIK has no opengl support included as libray. At least I cant see one in the system browser and I am aware there is a MorphiGL , Croquet and Open Cobalt but nowhere there is info about which opengl versions are supported. I am also abit nooby with opengl so I am trying to find my barings. any help is appreciated.
The Squeak OpenGL bindings are on squeaksource.com. Here is an older mail exchange describing the installation procedure:
http://forum.world.st/OpenGL-in-4-1-or-later-td3794639.html

I have just tried it in a 4.3 image, and after fixing three small glitches it worked:
- somehow the method OGLUnix>>#openGLLibraryName has an illegal character at the end (it's probably being handled as
whitespace in other Squeak/Pharo images)
- the method Point>>#area does not exist. I implemented it as returning x*y, which works.
- the method printShowingMaxDecimalPlaces: does not exist. I used printString instead.

That should get you started.

Cheers,
Hans-Martin

Reply | Threaded
Open this post in threaded view
|

Re: Opengl and Squeak

LawsonEnglish
In reply to this post by kilon
There is a set of libraries for OpenGL that were lifted from Croquet/Cobalt, that work with Squeak 4.2 (4.1?). I did a series of Squeak from the Very start (see URL below) videos showing them working in various ways but haven't tested them in about a year with the latest release of Squeak. I'll do that today and get back to you.


L





On 8/16/12 12:08 PM, dimitris chloupis wrote:
Thanks for the replies from both of you. 

I am trying to find the laziest route right now. Nativeboost is of course an option, but i would prefer if I remained on Squeak and not having to port on Pharo. Last time I checked the NBOpengl was for Pharo and not available in all OSes. 

How exactly and what exactly I will extend. Squeak AFAIK has no opengl support included as libray. At least I cant see one in the system browser and I am aware there is a MorphiGL , Croquet and Open Cobalt but nowhere there is info about which opengl versions are supported. I am also abit nooby with opengl so I am trying to find my barings. any help is appreciated. 


From: Lawson English [hidden email]
To: [hidden email]
Sent: Thursday, 16 August 2012, 21:57
Subject: Re: [squeak-dev] Opengl and Squeak

On 8/16/12 11:13 AM, Hans-Martin Mosner wrote:
> Am 16.08.2012 19:17, schrieb kilon:
>> Is there a library out there for squeak that will allow me to use opengl 4 ?
>>
>>
> I think you should be able to extend the existing OpenGL interface with the OpenGL 4 functions that you want to access.
> But AFAIK no one has done it yet.
>
> Cheers,
> Hans-Martin
>
>
The NativeBOost OpenGL has bindings for everything that is found in the OpenGL.org headers page, at least from the last time that Igor ran his utility to create the bindings a few months ago, so it is actually more up to date than any commercial C compiler or at least will be if you decide to run the utility yourself.  NBOpenGL requires Igor's custom CogVM. I don't know if there are any Pharo dependencies involved in the packages that the utility creates or with any other aspect of NativeBoost. You'll have to ask him.

L.

-- Squeak from the very start (introduction to Squeak and Pharo Smalltalk for the (almost) complete and compleate beginner).
https://www.youtube.com/playlist?list=PL6601A198DF14788D&feature=view_all







    


-- 
Squeak from the very start (introduction to Squeak and Pharo Smalltalk for the (almost) complete and compleate beginner).
https://www.youtube.com/playlist?list=PL6601A198DF14788D&feature=view_all 


Reply | Threaded
Open this post in threaded view
|

Re: Opengl and Squeak

LawsonEnglish
In reply to this post by Hans-Martin Mosner
thanks Hans-Martin. I'll update my videos with that bit of info too.

I have been playing quite a bit with NativeBoost lately and it offers
some very nice features that anyone wanting to make a game or other
realtime-ish application will find beneficial, including the ability to
create a "cascade" of foreign file calls within a single method, or even
program a bit of custom x86 assembler. I don't know what will be
involved to port it to Squeak, but Igor's talk suggests that the only
"special" bit is already present in the VM, which should work with
either Pharo or Squeak. The rest is just glue code at the Smalltalk
level, which means that it is perfectly doable to get it working on
Squeak, in theory at least.

Native boost also offers a way of passing an arbitrary  ByteArray to an
external function as though it were a normal pointer to a bit of
malloc-ed memory, which can be VERY useful with certain libraries, that
and the ability to actually malloc memory for a ByteArray from the OS
level heap, opens up all sorts of possibilities like having an external
lib render directly into a BitMap object asynchronously from its own OS
level thread so that each update can show the library's progress in a
morph without any further coding.

I'm actually working on a simple MandelBrot Set generator lib in C to
demo this.

L.



On 8/16/12 12:38 PM, Hans-Martin Mosner wrote:

> The Squeak OpenGL bindings are on squeaksource.com. Here is an older
> mail exchange describing the installation procedure:
> http://forum.world.st/OpenGL-in-4-1-or-later-td3794639.html I have
> just tried it in a 4.3 image, and after fixing three small glitches it
> worked: - somehow the method OGLUnix>>#openGLLibraryName has an
> illegal character at the end (it's probably being handled as
> whitespace in other Squeak/Pharo images) - the method Point>>#area
> does not exist. I implemented it as returning x*y, which works. - the
> method printShowingMaxDecimalPlaces: does not exist. I used
> printString instead. That should get you started. Cheers, Hans-Martin


--
Squeak from the very start (introduction to Squeak and Pharo Smalltalk for the (almost) complete and compleate beginner).
https://www.youtube.com/playlist?list=PL6601A198DF14788D&feature=view_all


Reply | Threaded
Open this post in threaded view
|

Re: Opengl and Squeak

kilon
Well if FFI works okish in squeak I dont have a need for nativeboost, since I prefer to code in smalltalk than assembly. 

I decided to continue my project 'Ephestos' is squeak, since Blender python has been a complete failure, the opengl implementation is buggy , still stuck to version 1.1 and it consumes CPU cycles like crazy (simple hand morph system  consume 50% of my dual core) so fingers crossed it will works with squeak. I dont care for fancy features like nativevboost if its buggy, non cross platform and slow. 

Seems I am not getting replies from other than you lawson , I assume something is wrong with my squeak-dev subscription. 

Anyway, will test FFI from CroquetGL and hopefully it will work for me too.Thanks for the help. 

From: Lawson English <[hidden email]>
To: [hidden email]
Sent: Thursday, 16 August 2012, 23:07
Subject: Re: [squeak-dev] Opengl and Squeak

thanks Hans-Martin. I'll update my videos with that bit of info too.

I have been playing quite a bit with NativeBoost lately and it offers some very nice features that anyone wanting to make a game or other realtime-ish application will find beneficial, including the ability to create a "cascade" of foreign file calls within a single method, or even program a bit of custom x86 assembler. I don't know what will be involved to port it to Squeak, but Igor's talk suggests that the only "special" bit is already present in the VM, which should work with either Pharo or Squeak. The rest is just glue code at the Smalltalk level, which means that it is perfectly doable to get it working on Squeak, in theory at least.

Native boost also offers a way of passing an arbitrary  ByteArray to an external function as though it were a normal pointer to a bit of malloc-ed memory, which can be VERY useful with certain libraries, that and the ability to actually malloc memory for a ByteArray from the OS level heap, opens up all sorts of possibilities like having an external lib render directly into a BitMap object asynchronously from its own OS level thread so that each update can show the library's progress in a morph without any further coding.

I'm actually working on a simple MandelBrot Set generator lib in C to demo this.

L.



On 8/16/12 12:38 PM, Hans-Martin Mosner wrote:
> The Squeak OpenGL bindings are on squeaksource.com. Here is an older mail exchange describing the installation procedure: http://forum.world.st/OpenGL-in-4-1-or-later-td3794639.html I have just tried it in a 4.3 image, and after fixing three small glitches it worked: - somehow the method OGLUnix>>#openGLLibraryName has an illegal character at the end (it's probably being handled as whitespace in other Squeak/Pharo images) - the method Point>>#area does not exist. I implemented it as returning x*y, which works. - the method printShowingMaxDecimalPlaces: does not exist. I used printString instead. That should get you started. Cheers, Hans-Martin


-- Squeak from the very start (introduction to Squeak and Pharo Smalltalk for the (almost) complete and compleate beginner).
https://www.youtube.com/playlist?list=PL6601A198DF14788D&feature=view_all






Reply | Threaded
Open this post in threaded view
|

Re: Opengl and Squeak

David T. Lewis
Hello Dimitris,

I do not know much about GL, but I have some experience with interfacing
Squeak to external libraries. I would suggest that you consider developing
your interface in the form of a VM plugin, rather than relying on any of
the FFI interfaces. It is a little more work to get started doing it this
way, but in the long run the result will be much more reliable, portable,
and maintainable than anything you could do with FFI calls.

If you are interested in doing this I'll try to give some help and pointers.

Dave


On Fri, Aug 17, 2012 at 07:51:14AM +0100, dimitris chloupis wrote:

> Well if FFI works okish in squeak I dont have a need for nativeboost, since I prefer to code in smalltalk than assembly.?
>
> I decided to continue my project 'Ephestos' is squeak, since Blender python has been a complete failure, the opengl implementation is buggy , still stuck to version 1.1 and it consumes CPU cycles like crazy (simple hand morph system ?consume 50% of my dual core) so fingers crossed it will works with squeak. I dont care for fancy features like nativevboost if its buggy, non cross platform and slow.?
>
> Seems I am not getting replies from other than you lawson , I assume something is wrong with my squeak-dev subscription.?
>
> Anyway, will test FFI from CroquetGL and hopefully it will work for me too.Thanks for the help.?
>
> ________________________________
>  From: Lawson English <[hidden email]>
> To: [hidden email]
> Sent: Thursday, 16 August 2012, 23:07
> Subject: Re: [squeak-dev] Opengl and Squeak
>  
> thanks Hans-Martin. I'll update my videos with that bit of info too.
>
> I have been playing quite a bit with NativeBoost lately and it offers some very nice features that anyone wanting to make a game or other realtime-ish application will find beneficial, including the ability to create a "cascade" of foreign file calls within a single method, or even program a bit of custom x86 assembler. I don't know what will be involved to port it to Squeak, but Igor's talk suggests that the only "special" bit is already present in the VM, which should work with either Pharo or Squeak. The rest is just glue code at the Smalltalk level, which means that it is perfectly doable to get it working on Squeak, in theory at least.
>
> Native boost also offers a way of passing an arbitrary? ByteArray to an external function as though it were a normal pointer to a bit of malloc-ed memory, which can be VERY useful with certain libraries, that and the ability to actually malloc memory for a ByteArray from the OS level heap, opens up all sorts of possibilities like having an external lib render directly into a BitMap object asynchronously from its own OS level thread so that each update can show the library's progress in a morph without any further coding.
>
> I'm actually working on a simple MandelBrot Set generator lib in C to demo this.
>
> L.
>
>
>
> On 8/16/12 12:38 PM, Hans-Martin Mosner wrote:
> > The Squeak OpenGL bindings are on squeaksource.com. Here is an older mail exchange describing the installation procedure: http://forum.world.st/OpenGL-in-4-1-or-later-td3794639.html I have just tried it in a 4.3 image, and after fixing three small glitches it worked: - somehow the method OGLUnix>>#openGLLibraryName has an illegal character at the end (it's probably being handled as whitespace in other Squeak/Pharo images) - the method Point>>#area does not exist. I implemented it as returning x*y, which works. - the method printShowingMaxDecimalPlaces: does not exist. I used printString instead. That should get you started. Cheers, Hans-Martin
>
>
> -- Squeak from the very start (introduction to Squeak and Pharo Smalltalk for the (almost) complete and compleate beginner).
> https://www.youtube.com/playlist?list=PL6601A198DF14788D&feature=view_all
>


Reply | Threaded
Open this post in threaded view
|

Re: Opengl and Squeak

Igor Stasenko
In reply to this post by kilon
On 17 August 2012 08:51, dimitris chloupis <[hidden email]> wrote:
> Well if FFI works okish in squeak I dont have a need for nativeboost, since
> I prefer to code in smalltalk than assembly.
>
You don't have to learn assembly to use OpenGL with Nativeboost.
Also, replying to previous post, it supports all 3 major platforms -
mac, unix and windows.

As for making NB working on Squeak, except from VM there's only one
significant change
made in Pharo but not in Squeak (afaik) is to improve the debugger
support for custom primitives.

> I decided to continue my project 'Ephestos' is squeak, since Blender python
> has been a complete failure, the opengl implementation is buggy , still
> stuck to version 1.1 and it consumes CPU cycles like crazy (simple hand
> morph system  consume 50% of my dual core) so fingers crossed it will works
> with squeak. I dont care for fancy features like nativevboost if its buggy,
> non cross platform and slow.
>
> Seems I am not getting replies from other than you lawson , I assume
> something is wrong with my squeak-dev subscription.
>
> Anyway, will test FFI from CroquetGL and hopefully it will work for me
> too.Thanks for the help.
> ________________________________
> From: Lawson English <[hidden email]>
> To: [hidden email]
> Sent: Thursday, 16 August 2012, 23:07
>
> Subject: Re: [squeak-dev] Opengl and Squeak
>
> thanks Hans-Martin. I'll update my videos with that bit of info too.
>
> I have been playing quite a bit with NativeBoost lately and it offers some
> very nice features that anyone wanting to make a game or other realtime-ish
> application will find beneficial, including the ability to create a
> "cascade" of foreign file calls within a single method, or even program a
> bit of custom x86 assembler. I don't know what will be involved to port it
> to Squeak, but Igor's talk suggests that the only "special" bit is already
> present in the VM, which should work with either Pharo or Squeak. The rest
> is just glue code at the Smalltalk level, which means that it is perfectly
> doable to get it working on Squeak, in theory at least.
>
> Native boost also offers a way of passing an arbitrary  ByteArray to an
> external function as though it were a normal pointer to a bit of malloc-ed
> memory, which can be VERY useful with certain libraries, that and the
> ability to actually malloc memory for a ByteArray from the OS level heap,
> opens up all sorts of possibilities like having an external lib render
> directly into a BitMap object asynchronously from its own OS level thread so
> that each update can show the library's progress in a morph without any
> further coding.
>
> I'm actually working on a simple MandelBrot Set generator lib in C to demo
> this.
>
> L.
>
>
>
> On 8/16/12 12:38 PM, Hans-Martin Mosner wrote:
>> The Squeak OpenGL bindings are on squeaksource.com. Here is an older mail
>> exchange describing the installation procedure:
>> http://forum.world.st/OpenGL-in-4-1-or-later-td3794639.html I have just
>> tried it in a 4.3 image, and after fixing three small glitches it worked: -
>> somehow the method OGLUnix>>#openGLLibraryName has an illegal character at
>> the end (it's probably being handled as whitespace in other Squeak/Pharo
>> images) - the method Point>>#area does not exist. I implemented it as
>> returning x*y, which works. - the method printShowingMaxDecimalPlaces: does
>> not exist. I used printString instead. That should get you started. Cheers,
>> Hans-Martin
>
>
> -- Squeak from the very start (introduction to Squeak and Pharo Smalltalk
> for the (almost) complete and compleate beginner).
> https://www.youtube.com/playlist?list=PL6601A198DF14788D&feature=view_all
>
>
>
>
>
>
>



--
Best regards,
Igor Stasenko.

Reply | Threaded
Open this post in threaded view
|

Re: Opengl and Squeak

kilon
Well my limited understand of nativeboost is that it does what it does in Assembly level, so if something goes wrong with it , that would mean that I would have to dive inside assembly. Its FFI is true it bypasses assembly but I am not so sure how much that applies when things go wrong. Please correct me if I am wrong. 

Also last time I checked NBOpenGL was not available for all platforms. That was at least 6 months ago. I dont have a problem using pharo with some squeak libraries. The project I am making will be most likely a bridge between pharo and squeak. Since both projects have some very useful libraries .  I have also created a thread about this in pharo mailing list some time ago, I want to reimplement morphic in opengl and do my own explorations too. I think I will give another go to NBOpenGL and see how it will go. 


From: Igor Stasenko [via Smalltalk] <[hidden email]>
To: kilon <[hidden email]>
Sent: Saturday, 18 August 2012, 20:31
Subject: Re: Opengl and Squeak

On 17 August 2012 08:51, dimitris chloupis <[hidden email]> wrote:
> Well if FFI works okish in squeak I dont have a need for nativeboost, since
> I prefer to code in smalltalk than assembly.
>
You don't have to learn assembly to use OpenGL with Nativeboost.
Also, replying to previous post, it supports all 3 major platforms -
mac, unix and windows.

As for making NB working on Squeak, except from VM there's only one
significant change
made in Pharo but not in Squeak (afaik) is to improve the debugger
support for custom primitives.

> I decided to continue my project 'Ephestos' is squeak, since Blender python
> has been a complete failure, the opengl implementation is buggy , still
> stuck to version 1.1 and it consumes CPU cycles like crazy (simple hand
> morph system  consume 50% of my dual core) so fingers crossed it will works
> with squeak. I dont care for fancy features like nativevboost if its buggy,
> non cross platform and slow.
>
> Seems I am not getting replies from other than you lawson , I assume
> something is wrong with my squeak-dev subscription.
>
> Anyway, will test FFI from CroquetGL and hopefully it will work for me
> too.Thanks for the help.
> ________________________________
> From: Lawson English <[hidden email]>
> To: [hidden email]
> Sent: Thursday, 16 August 2012, 23:07
>
> Subject: Re: [squeak-dev] Opengl and Squeak
>
> thanks Hans-Martin. I'll update my videos with that bit of info too.
>
> I have been playing quite a bit with NativeBoost lately and it offers some
> very nice features that anyone wanting to make a game or other realtime-ish
> application will find beneficial, including the ability to create a
> "cascade" of foreign file calls within a single method, or even program a
> bit of custom x86 assembler. I don't know what will be involved to port it
> to Squeak, but Igor's talk suggests that the only "special" bit is already
> present in the VM, which should work with either Pharo or Squeak. The rest
> is just glue code at the Smalltalk level, which means that it is perfectly
> doable to get it working on Squeak, in theory at least.
>
> Native boost also offers a way of passing an arbitrary  ByteArray to an
> external function as though it were a normal pointer to a bit of malloc-ed
> memory, which can be VERY useful with certain libraries, that and the
> ability to actually malloc memory for a ByteArray from the OS level heap,
> opens up all sorts of possibilities like having an external lib render
> directly into a BitMap object asynchronously from its own OS level thread so
> that each update can show the library's progress in a morph without any
> further coding.
>
> I'm actually working on a simple MandelBrot Set generator lib in C to demo
> this.
>
> L.
>
>
>
> On 8/16/12 12:38 PM, Hans-Martin Mosner wrote:
>> The Squeak OpenGL bindings are on squeaksource.com. Here is an older mail
>> exchange describing the installation procedure:
>> http://forum.world.st/OpenGL-in-4-1-or-later-td3794639.html I have just
>> tried it in a 4.3 image, and after fixing three small glitches it worked: -
>> somehow the method OGLUnix>>#openGLLibraryName has an illegal character at
>> the end (it's probably being handled as whitespace in other Squeak/Pharo
>> images) - the method Point>>#area does not exist. I implemented it as
>> returning x*y, which works. - the method printShowingMaxDecimalPlaces: does
>> not exist. I used printString instead. That should get you started. Cheers,
>> Hans-Martin
>
>
> -- Squeak from the very start (introduction to Squeak and Pharo Smalltalk
> for the (almost) complete and compleate beginner).
> https://www.youtube.com/playlist?list=PL6601A198DF14788D&feature=view_all
>
>
>
>
>
>
>


--
Best regards,
Igor Stasenko.




If you reply to this email, your message will be added to the discussion below:
http://forum.world.st/Opengl-and-Squeak-tp4644265p4644549.html
To unsubscribe from Opengl and Squeak, click here.
NAML




Reply | Threaded
Open this post in threaded view
|

How to build plugins and VMs (was: Opengl and Squeak)

David T. Lewis
In reply to this post by David T. Lewis
On Sat, Aug 18, 2012 at 08:19:34AM +0100, dimitris chloupis wrote:

Hi Dimitris,

Skip to the bottom for the important part, how to build plugins.

But first I will try to answer your questions.

> Why coders prefer FFIs ??
>

Some people prefer FFIs because it allows the interface to be done
without using compilers or building VMs, and because it is not necessary
to distribute a compiled plugin to provide the platform interface.

Some people may prefer using an FFI because they think it will save
time. They are usually wrong. Unfortunately, by the time they figure
this out, they will have wasted a lot of time trying to do things the
"easy way", and never bothered to invest a few hours to learn how to
do it more reliably with a plugin.

> For example I am a python coder, ctypes which is the FFI cpython comes with has seen an explosion the last years . The most suprising is the conversion of pyOpeng from C extenstion to ctypes libraries even though that has slow down the library 2-3x times. The reason behind that move is not hard to guess. Much easier to maintain. FFIs remove one importan element from the equation and pretty much why people avoid using C in the first place. Compiling and building. Thus making FFIs ideals for the fast changing libraries , be able to change things on the fly and not have to suffer the slow downs of the C compiler.?
>

Yes, an FFI is very adaptable because all changes can be done in the image,
and that is a good thing. However, relying on the compiler is only a
problem if you are waiting for someone *else* to compile it for you.
If you are willing to learn to do it for yourself, it is actually very
fast and easy to make updates. And if you do most of your work in Smalltalk
(aka "slang"), you will manage it with the same version control and tools
that you use for all the rest of your Smalltalk work.

You will find that you have far better support for debugging and profiling
when you use a plugin, because you can use the platform debuggers and other
tools directly. Also (and this is a really big thing in practice), you
have the benefits of strong type checking provided by the C compiler when
you build the interface as a plugin rather than directing your calls through
an FFI interface.

> I have taken a look at VM plugins, glanced through some tutorials, if I am not mistaken Slang is used to produce C code that then is compiled in a form that can be loaded by the VM is a primitive. The like an FFI call , you just use the primitive to execute the action.?
>

Yes, that's right.

> I am definetly interested , and if you have any link I am more than welcome them, my only hesitation is buidling C files . I am the type of coder that likes to moves one line of code (or several ) per time and always make sure by testing that I dont code garbage. One of the reason I decided to convert from python to squeak was because I felt that it was easier to "live code" in this enviroment. I fear that a VM plugin might cut short this experience. Please correct me If I am mistaken.?
>

See below for instructions that should help get you started. My explanation
assumes you are using unix/Linux, so please let me know if you are on
Windows or Mac or something else.

> Saying that I have installed with ease CroquetGL and the opengl example seems to run fine, (exampletex fails but that is to be expected , have not tried the fix yet).?
>
> If VM plugins are more stable, reliable and what the squeak community prefers I have no issues going down that route.?
>

You will probably not get a consensus from the community. I am giving you
an opinion based on my own personal experience.

OK, with that out of the way, here is what you should do:

Allow about two hours to work through these instructions for the first time.
If you are using Linux or Unix, you can follow the steps exactly. If you
use another platform, just do the things you can, and you will still be able
to get an idea of how things works. Here are the steps to follow:

Prepare tools. On Linux, install dev tools, libraries of interest, and Subversion.

Get a copy of the platform sources. Do this in the same directory in which
you will be running your Squeak image. On Linux:

  $ svn co http://squeakvm.org/svn/squeak/trunk/platforms

Any recent Squeak image will work for building VMs, but I like to work with
an updated trunk image, like this:

  world -> open... -> morphic project
  (enter the project)
  [menu bar] Tools -> Preferences
  (select category Monticello. change Update URL from http://source.squeak.org/squeak43 to http://source.squeak.org/trunk.
    accept the change (<ctl> s). click save button)
  world -> help... -> update code from server
  (wait for update process to complete, then save your image)

Install VMMaker. This is the trunk version for an interpreter VM. Do it this way
to get started so that you will be able to see your generated C code in a browser.

  world -> open... Squeak Map Catalog
  in the Squeak Map browser, click Update
  select package VMMaker, version "head"
  click Install
  (wait for installation to complete)

  In a workspace, evaluate "VMMaker initialize". This will activate the Slang browsing tools.
  (note: in the future, you can evaluate "VMMaker updateFromServer" to keep your VMMaker up to date)

Now have a look at some plugins.

Open a browser on UnixOSProcessPlugin>>primitiveGetUid. This is a simple
primitive call that links to the getuid() function in the C runtime library,
and answers your uid when the primitive is called. This is how the primitive
looks in Smalltalk. There is no C support code required, just the Smalltalk
code that you see here.

While looking at the primitiveGetUid method, click the "source" button on
the browser, then select either "translate inlined C". You will now see
the C code for the primitive.

Explore a few more primitives and other methods, and have a look at other
plugins, looking at both the Smalltalk source code and the generated C code.

Now point your browser at B3DAcceleratorPlugin. This is a 3D graphics support
plugin that uses GL. It was written by Andreas Raab, a distinguished Squeak
guru and expert in graphics and VM programming. Andreas is less active on the
list that he once was, but I'm sure he will chime it and offer some guidance
once in a while. For now though, just treat this as a non-trivial example of
interfacing to GL with a plugin.

Last but not least: Build a VM. This will be a minimal configuration with
only a few plugins, but it is enough to get you started. If you are able to
do this successfully, then you have everything you need in order to start
making your own plugins.

  world -> open... -> VMMaker
  click the the "Help" button and spend a few minutes reading it.
  click the "Entire" button to generate VM source code.
  This will translate the Smalltalk VM and plugin source code into C source
    files, which will be stored in the directory src along side your platforms
    directory. The platforms directory should contain all of the sources that
    you downloaded with Subversion, the the src directory will contain the generated sources from Smalltalk.

Now open a terminal window. Compile your VM as follows:

  $ mkdir build
  $ cd build
  $ ../platforms/unix/cmake/configure --src=../src --without-gl
  $ make

If you want to install your new VM, do a "make install".

HTH,
Dave


Reply | Threaded
Open this post in threaded view
|

Re: How to build plugins and VMs

Chris Cunnington
On 12-08-18 5:53 PM, David T. Lewis wrote:

> On Sat, Aug 18, 2012 at 08:19:34AM +0100, dimitris chloupis wrote:
>
> Hi Dimitris,
>
> Skip to the bottom for the important part, how to build plugins.
>
> But first I will try to answer your questions.
>
>> Why coders prefer FFIs ??
>>
> Some people prefer FFIs because it allows the interface to be done
> without using compilers or building VMs, and because it is not necessary
> to distribute a compiled plugin to provide the platform interface.
>
> Some people may prefer using an FFI because they think it will save
> time. They are usually wrong. Unfortunately, by the time they figure
> this out, they will have wasted a lot of time trying to do things the
> "easy way", and never bothered to invest a few hours to learn how to
> do it more reliably with a plugin.
>
>> For example I am a python coder, ctypes which is the FFI cpython comes with has seen an explosion the last years . The most suprising is the conversion of pyOpeng from C extenstion to ctypes libraries even though that has slow down the library 2-3x times. The reason behind that move is not hard to guess. Much easier to maintain. FFIs remove one importan element from the equation and pretty much why people avoid using C in the first place. Compiling and building. Thus making FFIs ideals for the fast changing libraries , be able to change things on the fly and not have to suffer the slow downs of the C compiler.?
>>
> Yes, an FFI is very adaptable because all changes can be done in the image,
> and that is a good thing. However, relying on the compiler is only a
> problem if you are waiting for someone *else* to compile it for you.
> If you are willing to learn to do it for yourself, it is actually very
> fast and easy to make updates. And if you do most of your work in Smalltalk
> (aka "slang"), you will manage it with the same version control and tools
> that you use for all the rest of your Smalltalk work.
>
> You will find that you have far better support for debugging and profiling
> when you use a plugin, because you can use the platform debuggers and other
> tools directly. Also (and this is a really big thing in practice), you
> have the benefits of strong type checking provided by the C compiler when
> you build the interface as a plugin rather than directing your calls through
> an FFI interface.
>
>> I have taken a look at VM plugins, glanced through some tutorials, if I am not mistaken Slang is used to produce C code that then is compiled in a form that can be loaded by the VM is a primitive. The like an FFI call , you just use the primitive to execute the action.?
>>
> Yes, that's right.
>
>> I am definetly interested , and if you have any link I am more than welcome them, my only hesitation is buidling C files . I am the type of coder that likes to moves one line of code (or several ) per time and always make sure by testing that I dont code garbage. One of the reason I decided to convert from python to squeak was because I felt that it was easier to "live code" in this enviroment. I fear that a VM plugin might cut short this experience. Please correct me If I am mistaken.?
>>
> See below for instructions that should help get you started. My explanation
> assumes you are using unix/Linux, so please let me know if you are on
> Windows or Mac or something else.
>
>> Saying that I have installed with ease CroquetGL and the opengl example seems to run fine, (exampletex fails but that is to be expected , have not tried the fix yet).?
>>
>> If VM plugins are more stable, reliable and what the squeak community prefers I have no issues going down that route.?
>>
> You will probably not get a consensus from the community. I am giving you
> an opinion based on my own personal experience.
>
> OK, with that out of the way, here is what you should do:
>
> Allow about two hours to work through these instructions for the first time.
> If you are using Linux or Unix, you can follow the steps exactly. If you
> use another platform, just do the things you can, and you will still be able
> to get an idea of how things works. Here are the steps to follow:
>
> Prepare tools. On Linux, install dev tools, libraries of interest, and Subversion.
>
> Get a copy of the platform sources. Do this in the same directory in which
> you will be running your Squeak image. On Linux:
>
>    $ svn co http://squeakvm.org/svn/squeak/trunk/platforms
>
> Any recent Squeak image will work for building VMs, but I like to work with
> an updated trunk image, like this:
>
>    world -> open... -> morphic project
>    (enter the project)
>    [menu bar] Tools -> Preferences
>    (select category Monticello. change Update URL from http://source.squeak.org/squeak43 to http://source.squeak.org/trunk.
>      accept the change (<ctl> s). click save button)
>    world -> help... -> update code from server
>    (wait for update process to complete, then save your image)
>
> Install VMMaker. This is the trunk version for an interpreter VM. Do it this way
> to get started so that you will be able to see your generated C code in a browser.
>
>    world -> open... Squeak Map Catalog
>    in the Squeak Map browser, click Update
At this stage Command+click (on a Mac) the empty pane below the search
pane. Deselect "New-safety-available packages" and the empty pane will
fill up. VMMaker is at the bottom.

>    select package VMMaker, version "head"
>    click Install
>    (wait for installation to complete)
>
>    In a workspace, evaluate "VMMaker initialize". This will activate the Slang browsing tools.
>    (note: in the future, you can evaluate "VMMaker updateFromServer" to keep your VMMaker up to date)
>
> Now have a look at some plugins.
>
> Open a browser on UnixOSProcessPlugin>>primitiveGetUid. This is a simple
> primitive call that links to the getuid() function in the C runtime library,
> and answers your uid when the primitive is called. This is how the primitive
> looks in Smalltalk. There is no C support code required, just the Smalltalk
> code that you see here.

Before the next step, you need to execute:

VMMaker initializeBrowserSupport

> While looking at the primitiveGetUid method, click the "source" button on
> the browser, then select either "translate inlined C". You will now see
> the C code for the primitive.
>
> Explore a few more primitives and other methods, and have a look at other
> plugins, looking at both the Smalltalk source code and the generated C code.
>
> Now point your browser at B3DAcceleratorPlugin. This is a 3D graphics support
> plugin that uses GL. It was written by Andreas Raab, a distinguished Squeak
> guru and expert in graphics and VM programming. Andreas is less active on the
> list that he once was, but I'm sure he will chime it and offer some guidance
> once in a while. For now though, just treat this as a non-trivial example of
> interfacing to GL with a plugin.
>
> Last but not least: Build a VM. This will be a minimal configuration with
> only a few plugins, but it is enough to get you started. If you are able to
> do this successfully, then you have everything you need in order to start
> making your own plugins.
David updates this information from time to time. This provides a longer
description.
http://lists.squeakfoundation.org/pipermail/squeak-dev/2011-November/162036.html

>
>    world -> open... -> VMMaker
>    click the the "Help" button and spend a few minutes reading it.
>    click the "Entire" button to generate VM source code.
>    This will translate the Smalltalk VM and plugin source code into C source
>      files, which will be stored in the directory src along side your platforms
>      directory. The platforms directory should contain all of the sources that
>      you downloaded with Subversion, the the src directory will contain the generated sources from Smalltalk.
>
> Now open a terminal window. Compile your VM as follows:
>
>    $ mkdir build
>    $ cd build
>    $ ../platforms/unix/cmake/configure --src=../src --without-gl
>    $ make
>
> If you want to install your new VM, do a "make install".
>
> HTH,
> Dave
>
>


Reply | Threaded
Open this post in threaded view
|

Re: How to build plugins and VMs (was: Opengl and Squeak)

kilon
In reply to this post by David T. Lewis
thank you very much , I have stored your instructions as pdf and will take a look at the plugin tutorials again. Will try your instructions when my computer has wifi internet again. Will an image update erase my work ? is it safe ? I will first upload to squeaksource my work just to be sure. 


From: David T. Lewis [via Smalltalk] <[hidden email]>
To: kilon <[hidden email]>
Sent: Sunday, 19 August 2012, 0:53
Subject: How to build plugins and VMs (was: Opengl and Squeak)

On Sat, Aug 18, 2012 at 08:19:34AM +0100, dimitris chloupis wrote:

Hi Dimitris,

Skip to the bottom for the important part, how to build plugins.

But first I will try to answer your questions.

> Why coders prefer FFIs ??
>

Some people prefer FFIs because it allows the interface to be done
without using compilers or building VMs, and because it is not necessary
to distribute a compiled plugin to provide the platform interface.

Some people may prefer using an FFI because they think it will save
time. They are usually wrong. Unfortunately, by the time they figure
this out, they will have wasted a lot of time trying to do things the
"easy way", and never bothered to invest a few hours to learn how to
do it more reliably with a plugin.

> For example I am a python coder, ctypes which is the FFI cpython comes with has seen an explosion the last years . The most suprising is the conversion of pyOpeng from C extenstion to ctypes libraries even though that has slow down the library 2-3x times. The reason behind that move is not hard to guess. Much easier to maintain. FFIs remove one importan element from the equation and pretty much why people avoid using C in the first place. Compiling and building. Thus making FFIs ideals for the fast changing libraries , be able to change things on the fly and not have to suffer the slow downs of the C compiler.?
>

Yes, an FFI is very adaptable because all changes can be done in the image,
and that is a good thing. However, relying on the compiler is only a
problem if you are waiting for someone *else* to compile it for you.
If you are willing to learn to do it for yourself, it is actually very
fast and easy to make updates. And if you do most of your work in Smalltalk
(aka "slang"), you will manage it with the same version control and tools
that you use for all the rest of your Smalltalk work.

You will find that you have far better support for debugging and profiling
when you use a plugin, because you can use the platform debuggers and other
tools directly. Also (and this is a really big thing in practice), you
have the benefits of strong type checking provided by the C compiler when
you build the interface as a plugin rather than directing your calls through
an FFI interface.

> I have taken a look at VM plugins, glanced through some tutorials, if I am not mistaken Slang is used to produce C code that then is compiled in a form that can be loaded by the VM is a primitive. The like an FFI call , you just use the primitive to execute the action.?
>

Yes, that's right.

> I am definetly interested , and if you have any link I am more than welcome them, my only hesitation is buidling C files . I am the type of coder that likes to moves one line of code (or several ) per time and always make sure by testing that I dont code garbage. One of the reason I decided to convert from python to squeak was because I felt that it was easier to "live code" in this enviroment. I fear that a VM plugin might cut short this experience. Please correct me If I am mistaken.?
>

See below for instructions that should help get you started. My explanation
assumes you are using unix/Linux, so please let me know if you are on
Windows or Mac or something else.

> Saying that I have installed with ease CroquetGL and the opengl example seems to run fine, (exampletex fails but that is to be expected , have not tried the fix yet).?
>
> If VM plugins are more stable, reliable and what the squeak community prefers I have no issues going down that route.?
>

You will probably not get a consensus from the community. I am giving you
an opinion based on my own personal experience.

OK, with that out of the way, here is what you should do:

Allow about two hours to work through these instructions for the first time.
If you are using Linux or Unix, you can follow the steps exactly. If you
use another platform, just do the things you can, and you will still be able
to get an idea of how things works. Here are the steps to follow:

Prepare tools. On Linux, install dev tools, libraries of interest, and Subversion.

Get a copy of the platform sources. Do this in the same directory in which
you will be running your Squeak image. On Linux:

  $ svn co http://squeakvm.org/svn/squeak/trunk/platforms

Any recent Squeak image will work for building VMs, but I like to work with
an updated trunk image, like this:

  world -> open... -> morphic project
  (enter the project)
  [menu bar] Tools -> Preferences
  (select category Monticello. change Update URL from http://source.squeak.org/squeak43 to http://source.squeak.org/trunk.
    accept the change (<ctl> s). click save button)
  world -> help... -> update code from server
  (wait for update process to complete, then save your image)

Install VMMaker. This is the trunk version for an interpreter VM. Do it this way
to get started so that you will be able to see your generated C code in a browser.

  world -> open... Squeak Map Catalog
  in the Squeak Map browser, click Update
  select package VMMaker, version "head"
  click Install
  (wait for installation to complete)

  In a workspace, evaluate "VMMaker initialize". This will activate the Slang browsing tools.
  (note: in the future, you can evaluate "VMMaker updateFromServer" to keep your VMMaker up to date)

Now have a look at some plugins.

Open a browser on UnixOSProcessPlugin>>primitiveGetUid. This is a simple
primitive call that links to the getuid() function in the C runtime library,
and answers your uid when the primitive is called. This is how the primitive
looks in Smalltalk. There is no C support code required, just the Smalltalk
code that you see here.

While looking at the primitiveGetUid method, click the "source" button on
the browser, then select either "translate inlined C". You will now see
the C code for the primitive.

Explore a few more primitives and other methods, and have a look at other
plugins, looking at both the Smalltalk source code and the generated C code.

Now point your browser at B3DAcceleratorPlugin. This is a 3D graphics support
plugin that uses GL. It was written by Andreas Raab, a distinguished Squeak
guru and expert in graphics and VM programming. Andreas is less active on the
list that he once was, but I'm sure he will chime it and offer some guidance
once in a while. For now though, just treat this as a non-trivial example of
interfacing to GL with a plugin.

Last but not least: Build a VM. This will be a minimal configuration with
only a few plugins, but it is enough to get you started. If you are able to
do this successfully, then you have everything you need in order to start
making your own plugins.

  world -> open... -> VMMaker
  click the the "Help" button and spend a few minutes reading it.
  click the "Entire" button to generate VM source code.
  This will translate the Smalltalk VM and plugin source code into C source
    files, which will be stored in the directory src along side your platforms
    directory. The platforms directory should contain all of the sources that
    you downloaded with Subversion, the the src directory will contain the generated sources from Smalltalk.

Now open a terminal window. Compile your VM as follows:

  $ mkdir build
  $ cd build
  $ ../platforms/unix/cmake/configure --src=../src --without-gl
  $ make

If you want to install your new VM, do a "make install".

HTH,
Dave





If you reply to this email, your message will be added to the discussion below:
http://forum.world.st/Opengl-and-Squeak-tp4644265p4644557.html
To unsubscribe from Opengl and Squeak, click here.
NAML




Reply | Threaded
Open this post in threaded view
|

Re: How to build plugins and VMs (was: Opengl and Squeak)

David T. Lewis
An image update is safe, and it will not erase your work. But you
should get into the habit of making periodic backup copies of your
image and changes files. For example, you should make a backup copy
of your image and changes files before you begin to try my instructions
for loading VMMaker. This will protect you if anything goes wrong, or
if you just decide you do not really want all of that stuff in your
image after all.

By the way, a convenient way to make a "backup" of your image is
with this:

  world -> save as new version

You do not need to upload to squeaksource to save your work. You
can use Montecello to save your work and do version control, and
with this you can make a local repository in a directory on your
hard drive. You can save versions of your work in that repository.

Dave


On Sun, Aug 19, 2012 at 10:16:14AM +0100, dimitris chloupis wrote:

> thank you very much , I have stored your instructions as pdf and will take a look at the plugin tutorials again. Will try your instructions when my computer has wifi internet again. Will an image update erase my work ? is it safe ? I will first upload to squeaksource my work just to be sure.?
>
>
> ________________________________
>  From: David T. Lewis [via Smalltalk] <[hidden email]>
> To: kilon <[hidden email]>
> Sent: Sunday, 19 August 2012, 0:53
> Subject: How to build plugins and VMs (was: Opengl and Squeak)
>  
>
> On Sat, Aug 18, 2012 at 08:19:34AM +0100, dimitris chloupis wrote:
>
> Hi Dimitris,
>
> Skip to the bottom for the important part, how to build plugins.
>
> But first I will try to answer your questions.
>
> > Why coders prefer FFIs ??
> >
>
> Some people prefer FFIs because it allows the interface to be done
> without using compilers or building VMs, and because it is not necessary
> to distribute a compiled plugin to provide the platform interface.
>
> Some people may prefer using an FFI because they think it will save
> time. They are usually wrong. Unfortunately, by the time they figure
> this out, they will have wasted a lot of time trying to do things the
> "easy way", and never bothered to invest a few hours to learn how to
> do it more reliably with a plugin.
>
> > For example I am a python coder, ctypes which is the FFI cpython comes with has seen an explosion the last years . The most suprising is the conversion of pyOpeng from C extenstion to ctypes libraries even though that has slow down the library 2-3x times. The reason behind that move is not hard to guess. Much easier to maintain. FFIs remove one importan element from the equation and pretty much why people avoid using C in the first place. Compiling and building. Thus making FFIs ideals for the fast changing libraries , be able to change things on the fly and not have to suffer the slow downs of the C compiler.?
> >
>
> Yes, an FFI is very adaptable because all changes can be done in the image,
> and that is a good thing. However, relying on the compiler is only a
> problem if you are waiting for someone *else* to compile it for you.
> If you are willing to learn to do it for yourself, it is actually very
> fast and easy to make updates. And if you do most of your work in Smalltalk
> (aka "slang"), you will manage it with the same version control and tools
> that you use for all the rest of your Smalltalk work.
>
> You will find that you have far better support for debugging and profiling
> when you use a plugin, because you can use the platform debuggers and other
> tools directly. Also (and this is a really big thing in practice), you
> have the benefits of strong type checking provided by the C compiler when
> you build the interface as a plugin rather than directing your calls through
> an FFI interface.
>
> > I have taken a look at VM plugins, glanced through some tutorials, if I am not mistaken Slang is used to produce C code that then is compiled in a form that can be loaded by the VM is a primitive. The like an FFI call , you just use the primitive to execute the action.?
> >
>
> Yes, that's right.
>
> > I am definetly interested , and if you have any link I am more than welcome them, my only hesitation is buidling C files . I am the type of coder that likes to moves one line of code (or several ) per time and always make sure by testing that I dont code garbage. One of the reason I decided to convert from python to squeak was because I felt that it was easier to "live code" in this enviroment. I fear that a VM plugin might cut short this experience. Please correct me If I am mistaken.?
> >
>
> See below for instructions that should help get you started. My explanation
> assumes you are using unix/Linux, so please let me know if you are on
> Windows or Mac or something else.
>
> > Saying that I have installed with ease CroquetGL and the opengl example seems to run fine, (exampletex fails but that is to be expected , have not tried the fix yet).?
> >
> > If VM plugins are more stable, reliable and what the squeak community prefers I have no issues going down that route.?
> >
>
> You will probably not get a consensus from the community. I am giving you
> an opinion based on my own personal experience.
>
> OK, with that out of the way, here is what you should do:
>
> Allow about two hours to work through these instructions for the first time.
> If you are using Linux or Unix, you can follow the steps exactly. If you
> use another platform, just do the things you can, and you will still be able
> to get an idea of how things works. Here are the steps to follow:
>
> Prepare tools. On Linux, install dev tools, libraries of interest, and Subversion.
>
> Get a copy of the platform sources. Do this in the same directory in which
> you will be running your Squeak image. On Linux:
>
> ? $ svn co http://squeakvm.org/svn/squeak/trunk/platforms
>
> Any recent Squeak image will work for building VMs, but I like to work with
> an updated trunk image, like this:
>
> ? world -> open... -> morphic project
> ? (enter the project)
> ? [menu bar] Tools -> Preferences
> ? (select category Monticello. change Update URL from http://source.squeak.org/squeak43?to http://source.squeak.org/trunk.
> ? ? accept the change (<ctl> s). click save button)
> ? world -> help... -> update code from server
> ? (wait for update process to complete, then save your image)
>
> Install VMMaker. This is the trunk version for an interpreter VM. Do it this way
> to get started so that you will be able to see your generated C code in a browser.
>
> ? world -> open... Squeak Map Catalog
> ? in the Squeak Map browser, click Update
> ? select package VMMaker, version "head"
> ? click Install
> ? (wait for installation to complete)
>
> ? In a workspace, evaluate "VMMaker initialize". This will activate the Slang browsing tools.
> ? (note: in the future, you can evaluate "VMMaker updateFromServer" to keep your VMMaker up to date)
>
> Now have a look at some plugins.
>
> Open a browser on UnixOSProcessPlugin>>primitiveGetUid. This is a simple
> primitive call that links to the getuid() function in the C runtime library,
> and answers your uid when the primitive is called. This is how the primitive
> looks in Smalltalk. There is no C support code required, just the Smalltalk
> code that you see here.
>
> While looking at the primitiveGetUid method, click the "source" button on
> the browser, then select either "translate inlined C". You will now see
> the C code for the primitive.
>
> Explore a few more primitives and other methods, and have a look at other
> plugins, looking at both the Smalltalk source code and the generated C code.
>
> Now point your browser at B3DAcceleratorPlugin. This is a 3D graphics support
> plugin that uses GL. It was written by Andreas Raab, a distinguished Squeak
> guru and expert in graphics and VM programming. Andreas is less active on the
> list that he once was, but I'm sure he will chime it and offer some guidance
> once in a while. For now though, just treat this as a non-trivial example of
> interfacing to GL with a plugin.
>
> Last but not least: Build a VM. This will be a minimal configuration with
> only a few plugins, but it is enough to get you started. If you are able to
> do this successfully, then you have everything you need in order to start
> making your own plugins.
>
> ? world -> open... -> VMMaker
> ? click the the "Help" button and spend a few minutes reading it.
> ? click the "Entire" button to generate VM source code.
> ? This will translate the Smalltalk VM and plugin source code into C source
> ? ? files, which will be stored in the directory src along side your platforms
> ? ? directory. The platforms directory should contain all of the sources that
> ? ? you downloaded with Subversion, the the src directory will contain the generated sources from Smalltalk.
>
> Now open a terminal window. Compile your VM as follows:
>
> ? $ mkdir build
> ? $ cd build
> ? $ ../platforms/unix/cmake/configure --src=../src --without-gl
> ? $ make
>
> If you want to install your new VM, do a "make install".
>
> HTH,
> Dave
>
>
>
>
> ________________________________
>  
> If you reply to this email, your message will be added to the discussion below:http://forum.world.st/Opengl-and-Squeak-tp4644265p4644557.html 
> To unsubscribe from Opengl and Squeak, click here.
> NAML
>


Reply | Threaded
Open this post in threaded view
|

Re: Opengl and Squeak

Igor Stasenko
In reply to this post by kilon
On 18 August 2012 22:41, dimitris chloupis <[hidden email]> wrote:
> Well my limited understand of nativeboost is that it does what it does in
> Assembly level, so if something goes wrong with it , that would mean that I
> would have to dive inside assembly. Its FFI is true it bypasses assembly but
> I am not so sure how much that applies when things go wrong. Please correct
> me if I am wrong.

And what would you do if something go wrong with FFI plugin?
Unless there's a bug in NB, you don't need to dive into assembly to
interface with C library.
We're talking about two implementations of same thing - FFI, one using
C and compiled as a plugin,
and another is implemented in smalltalk and generates code
dynamically. But you don't have to look into
depths in order to use any of them.
Yes, NB allows you to hack things, but that doesn't means that you
will need to do that regularly.

>
> Also last time I checked NBOpenGL was not available for all platforms. That
> was at least 6 months ago. I dont have a problem using pharo with some
> squeak libraries. The project I am making will be most likely a bridge
> between pharo and squeak. Since both projects have some very useful
> libraries .  I have also created a thread about this in pharo mailing list
> some time ago, I want to reimplement morphic in opengl and do my own
> explorations too. I think I will give another go to NBOpenGL and see how it
> will go.
>
It is up to you, of course.
Just to note, that at our lab, we have a guy who implemented a
codecity visualisation
 using NBOpenGL.

> ________________________________
> From: Igor Stasenko [via Smalltalk]
> <[hidden email]>
> To: kilon <[hidden email]>
> Sent: Saturday, 18 August 2012, 20:31
> Subject: Re: Opengl and Squeak
>
> On 17 August 2012 08:51, dimitris chloupis <[hidden email]> wrote:
>> Well if FFI works okish in squeak I dont have a need for nativeboost,
>> since
>> I prefer to code in smalltalk than assembly.
>>
> You don't have to learn assembly to use OpenGL with Nativeboost.
> Also, replying to previous post, it supports all 3 major platforms -
> mac, unix and windows.
>
> As for making NB working on Squeak, except from VM there's only one
> significant change
> made in Pharo but not in Squeak (afaik) is to improve the debugger
> support for custom primitives.
>
>> I decided to continue my project 'Ephestos' is squeak, since Blender
>> python
>> has been a complete failure, the opengl implementation is buggy , still
>> stuck to version 1.1 and it consumes CPU cycles like crazy (simple hand
>> morph system  consume 50% of my dual core) so fingers crossed it will
>> works
>> with squeak. I dont care for fancy features like nativevboost if its
>> buggy,
>> non cross platform and slow.
>>
>> Seems I am not getting replies from other than you lawson , I assume
>> something is wrong with my squeak-dev subscription.
>>
>> Anyway, will test FFI from CroquetGL and hopefully it will work for me
>> too.Thanks for the help.
>> ________________________________
>> From: Lawson English <[hidden email]>
>> To: [hidden email]
>> Sent: Thursday, 16 August 2012, 23:07
>>
>> Subject: Re: [squeak-dev] Opengl and Squeak
>>
>> thanks Hans-Martin. I'll update my videos with that bit of info too.
>>
>> I have been playing quite a bit with NativeBoost lately and it offers some
>> very nice features that anyone wanting to make a game or other
>> realtime-ish
>> application will find beneficial, including the ability to create a
>> "cascade" of foreign file calls within a single method, or even program a
>> bit of custom x86 assembler. I don't know what will be involved to port it
>> to Squeak, but Igor's talk suggests that the only "special" bit is already
>> present in the VM, which should work with either Pharo or Squeak. The rest
>> is just glue code at the Smalltalk level, which means that it is perfectly
>> doable to get it working on Squeak, in theory at least.
>>
>> Native boost also offers a way of passing an arbitrary  ByteArray to an
>> external function as though it were a normal pointer to a bit of malloc-ed
>> memory, which can be VERY useful with certain libraries, that and the
>> ability to actually malloc memory for a ByteArray from the OS level heap,
>> opens up all sorts of possibilities like having an external lib render
>> directly into a BitMap object asynchronously from its own OS level thread
>> so
>> that each update can show the library's progress in a morph without any
>> further coding.
>>
>> I'm actually working on a simple MandelBrot Set generator lib in C to demo
>> this.
>>
>> L.
>>
>>
>>
>> On 8/16/12 12:38 PM, Hans-Martin Mosner wrote:
>>> The Squeak OpenGL bindings are on squeaksource.com. Here is an older mail
>>> exchange describing the installation procedure:
>>> http://forum.world.st/OpenGL-in-4-1-or-later-td3794639.html I have just
>>> tried it in a 4.3 image, and after fixing three small glitches it worked:
>>> -
>>> somehow the method OGLUnix>>#openGLLibraryName has an illegal character
>>> at
>>> the end (it's probably being handled as whitespace in other Squeak/Pharo
>>> images) - the method Point>>#area does not exist. I implemented it as
>>> returning x*y, which works. - the method printShowingMaxDecimalPlaces:
>>> does
>>> not exist. I used printString instead. That should get you started.
>>> Cheers,
>>> Hans-Martin
>>
>>
>> -- Squeak from the very start (introduction to Squeak and Pharo Smalltalk
>> for the (almost) complete and compleate beginner).
>> https://www.youtube.com/playlist?list=PL6601A198DF14788D&feature=view_all
>>
>>
>>
>>
>>
>>
>>
>
>
>
> --
> Best regards,
> Igor Stasenko.
>
>
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://forum.world.st/Opengl-and-Squeak-tp4644265p4644549.html
> To unsubscribe from Opengl and Squeak, click here.
> NAML
>
>
>
>
>



--
Best regards,
Igor Stasenko.

Reply | Threaded
Open this post in threaded view
|

Re: How to build plugins and VMs

LawsonEnglish
In reply to this post by David T. Lewis
I would say that "easy way" depends entirely on what you are trying to
accomplish. For example, as part of my learning how to use NativeBoost,
I created a partial interface to the various GNU multi-precision math
libraries. These are consistently faster than using Squeak's own
built-in libraries for many uses, including the Mandelbrot set generator
I've mentioned before. Squeak doens't even HAVE a multi-precision float
class, nor a multi-precision complex number class, and my preliminary
testing suggests that past a certain precision-size, even the
VeryLargeInteger class is always slower for every operation than using
the GNU libraries, even though there is greater overhead in evoking the
NativeBoost FFI.

Both Andreas Raab and Igor Stasenko have created automated ways of
generating the FFI methods for OpenGL, and either technique could be
used with some modification, to automate generating interfaces for
different libraries.

The question becomes one of portability: the older FFI techniques are
compatible with older platforms and VMs. NativeBOost only works with x86
architectures and a specially modified CogVM. Both require that external
libraries be used which aren't going to be available on every platform
for which Squeak can be ported.

The tradeoffs are many and very complicated and there's no
one-size-fits-all answer to the question of FFI vs plugin, Old School
FFI vs NativeBoost.


Cheers.

L.






On 8/18/12 2:53 PM, David T. Lewis wrote:

> On Sat, Aug 18, 2012 at 08:19:34AM +0100, dimitris chloupis wrote:
>
> Hi Dimitris,
>
> Skip to the bottom for the important part, how to build plugins.
>
> But first I will try to answer your questions.
>
>> Why coders prefer FFIs ??
>>
> Some people prefer FFIs because it allows the interface to be done
> without using compilers or building VMs, and because it is not necessary
> to distribute a compiled plugin to provide the platform interface.
>
> Some people may prefer using an FFI because they think it will save
> time. They are usually wrong. Unfortunately, by the time they figure
> this out, they will have wasted a lot of time trying to do things the
> "easy way", and never bothered to invest a few hours to learn how to
> do it more reliably with a plugin.
>
>> For example I am a python coder, ctypes which is the FFI cpython comes with has seen an explosion the last years . The most suprising is the conversion of pyOpeng from C extenstion to ctypes libraries even though that has slow down the library 2-3x times. The reason behind that move is not hard to guess. Much easier to maintain. FFIs remove one importan element from the equation and pretty much why people avoid using C in the first place. Compiling and building. Thus making FFIs ideals for the fast changing libraries , be able to change things on the fly and not have to suffer the slow downs of the C compiler.?
>>
> Yes, an FFI is very adaptable because all changes can be done in the image,
> and that is a good thing. However, relying on the compiler is only a
> problem if you are waiting for someone *else* to compile it for you.
> If you are willing to learn to do it for yourself, it is actually very
> fast and easy to make updates. And if you do most of your work in Smalltalk
> (aka "slang"), you will manage it with the same version control and tools
> that you use for all the rest of your Smalltalk work.
>
> You will find that you have far better support for debugging and profiling
> when you use a plugin, because you can use the platform debuggers and other
> tools directly. Also (and this is a really big thing in practice), you
> have the benefits of strong type checking provided by the C compiler when
> you build the interface as a plugin rather than directing your calls through
> an FFI interface.
>
>> I have taken a look at VM plugins, glanced through some tutorials, if I am not mistaken Slang is used to produce C code that then is compiled in a form that can be loaded by the VM is a primitive. The like an FFI call , you just use the primitive to execute the action.?
>>
> Yes, that's right.
>
>> I am definetly interested , and if you have any link I am more than welcome them, my only hesitation is buidling C files . I am the type of coder that likes to moves one line of code (or several ) per time and always make sure by testing that I dont code garbage. One of the reason I decided to convert from python to squeak was because I felt that it was easier to "live code" in this enviroment. I fear that a VM plugin might cut short this experience. Please correct me If I am mistaken.?
>>
> See below for instructions that should help get you started. My explanation
> assumes you are using unix/Linux, so please let me know if you are on
> Windows or Mac or something else.
>
>> Saying that I have installed with ease CroquetGL and the opengl example seems to run fine, (exampletex fails but that is to be expected , have not tried the fix yet).?
>>
>> If VM plugins are more stable, reliable and what the squeak community prefers I have no issues going down that route.?
>>
> You will probably not get a consensus from the community. I am giving you
> an opinion based on my own personal experience.
>
> OK, with that out of the way, here is what you should do:
>
> Allow about two hours to work through these instructions for the first time.
> If you are using Linux or Unix, you can follow the steps exactly. If you
> use another platform, just do the things you can, and you will still be able
> to get an idea of how things works. Here are the steps to follow:
>
> Prepare tools. On Linux, install dev tools, libraries of interest, and Subversion.
>
> Get a copy of the platform sources. Do this in the same directory in which
> you will be running your Squeak image. On Linux:
>
>    $ svn co http://squeakvm.org/svn/squeak/trunk/platforms
>
> Any recent Squeak image will work for building VMs, but I like to work with
> an updated trunk image, like this:
>
>    world -> open... -> morphic project
>    (enter the project)
>    [menu bar] Tools -> Preferences
>    (select category Monticello. change Update URL from http://source.squeak.org/squeak43 to http://source.squeak.org/trunk.
>      accept the change (<ctl> s). click save button)
>    world -> help... -> update code from server
>    (wait for update process to complete, then save your image)
>
> Install VMMaker. This is the trunk version for an interpreter VM. Do it this way
> to get started so that you will be able to see your generated C code in a browser.
>
>    world -> open... Squeak Map Catalog
>    in the Squeak Map browser, click Update
>    select package VMMaker, version "head"
>    click Install
>    (wait for installation to complete)
>
>    In a workspace, evaluate "VMMaker initialize". This will activate the Slang browsing tools.
>    (note: in the future, you can evaluate "VMMaker updateFromServer" to keep your VMMaker up to date)
>
> Now have a look at some plugins.
>
> Open a browser on UnixOSProcessPlugin>>primitiveGetUid. This is a simple
> primitive call that links to the getuid() function in the C runtime library,
> and answers your uid when the primitive is called. This is how the primitive
> looks in Smalltalk. There is no C support code required, just the Smalltalk
> code that you see here.
>
> While looking at the primitiveGetUid method, click the "source" button on
> the browser, then select either "translate inlined C". You will now see
> the C code for the primitive.
>
> Explore a few more primitives and other methods, and have a look at other
> plugins, looking at both the Smalltalk source code and the generated C code.
>
> Now point your browser at B3DAcceleratorPlugin. This is a 3D graphics support
> plugin that uses GL. It was written by Andreas Raab, a distinguished Squeak
> guru and expert in graphics and VM programming. Andreas is less active on the
> list that he once was, but I'm sure he will chime it and offer some guidance
> once in a while. For now though, just treat this as a non-trivial example of
> interfacing to GL with a plugin.
>
> Last but not least: Build a VM. This will be a minimal configuration with
> only a few plugins, but it is enough to get you started. If you are able to
> do this successfully, then you have everything you need in order to start
> making your own plugins.
>
>    world -> open... -> VMMaker
>    click the the "Help" button and spend a few minutes reading it.
>    click the "Entire" button to generate VM source code.
>    This will translate the Smalltalk VM and plugin source code into C source
>      files, which will be stored in the directory src along side your platforms
>      directory. The platforms directory should contain all of the sources that
>      you downloaded with Subversion, the the src directory will contain the generated sources from Smalltalk.
>
> Now open a terminal window. Compile your VM as follows:
>
>    $ mkdir build
>    $ cd build
>    $ ../platforms/unix/cmake/configure --src=../src --without-gl
>    $ make
>
> If you want to install your new VM, do a "make install".
>
> HTH,
> Dave
>
>
>


--
Squeak from the very start (introduction to Squeak and Pharo Smalltalk for the (almost) complete and compleate beginner).
https://www.youtube.com/playlist?list=PL6601A198DF14788D&feature=view_all


Reply | Threaded
Open this post in threaded view
|

Re: How to build plugins and VMs

Igor Stasenko
In reply to this post by Chris Cunnington
> On 12-08-18 5:53 PM, David T. Lewis wrote:
>>
>> You will find that you have far better support for debugging and profiling
>> when you use a plugin, because you can use the platform debuggers and
>> other
>> tools directly. Also (and this is a really big thing in practice), you
>> have the benefits of strong type checking provided by the C compiler when
>> you build the interface as a plugin rather than directing your calls
>> through
>> an FFI interface.
>>

you know, my personal experience says otherwise.. every time i have to
type 'gdb' in my console
i feel pain... it is horrible to debug VM code in gdb. Maybe it is
just me, because
i don't mastered gdb to high levels.. but comparing to debugging a
code in smalltalk using debugger which admittedly quite basic, it make
a HUGE difference.
gdb is worst debugger i ever seen.. it is a shame for not having
anything better than that in GNU toolchain.

And coding plugins in slang is another wonderful exercise, which i
trying to keep away from. Because i found that it is much more
productive either to do all the way smalltalk or all the way C, but
not something "in between", like slang. It is really hard to do it
right from first time, and really hard to fix it, and it is too
elaborate.. and has many bells and whistles..
Of course it doesn't says that we could not have a better and easier
"slang" which makes things more natural (so you don't have to worry
about types etc when coding the VM code).. but that's not going to
happen , because it will require a paramount of work to redo
everything.. and no takers.

As for fixing the problems, look and compare two processes:
when your plugin code crashed VM.. you:
   - restarting VM under debugger, finding the place where it crashing
   - but sometimes it is really hard, so you putt "trace(..)" calls or
"printfs()", because see above, gdb is horrible.
   - sometimes it crashing only when you build under O2 optimization
but not when you build VM without any optimizations
   - every time you need to change something, you need to use another
image where you applying the fix,
    then generate the sources, compile VM and run it to see if problem is gone.
    .. and it take a lot of time to fix even simplest things.

What you do if FFI call crashed the VM?
  - you just restart an image, put break right before a call and see
what are you passing as arguments and check for docs or lib sources
where it is a problem.
  - so, after you found the cause, you fix the code and.. apply the
change.. it is just works now.. you done.

Coding an NB FFI was really fun, because comparing to C, in assembly
there is no "what if" or any uncertainty.. all of the uncertainty is
actually comes from C, and this is what wasting all our time.
In NB, once i made it to generate correct instructions, it just works,
i found that i don't need to return to examine same piece of code over
and over again, once i tested and proved that it worked. It simply
cannot break, because it is too simple and stupid and there's no any
"automagic" type conversions or struct/pointer etc mess. Everything is
exact and explicit and it helps a lot because by knowing the places
where it definitely cannot break, you have less places to suspect for
causing the problem.

Also, i found that using FFI it saves your coding time.. because for
plugin you need to code the plugin in slang and then it's interface
for it's language-side counterpart. And with FFI you do all in image.
And the bonus is that you don't need to switch compiler/debugger/image
etc etc in order to do the thing you want.. you just keep working in
same image, same environment. And i think this is the biggest plus to
FFI.

Again, it is my personal experience, and i don't want to
dis(en)courage for/against FFI or plugins.
Each to his own.


--
Best regards,
Igor Stasenko.

Reply | Threaded
Open this post in threaded view
|

Re: How to build plugins and VMs (was: Opengl and Squeak)

kilon
In reply to this post by David T. Lewis
Thank you very much for your Help David.I will most certainly use save as new version for backups and monticello repository.  


From: David T. Lewis [via Smalltalk] <[hidden email]>
To: kilon <[hidden email]>
Sent: Sunday, 19 August 2012, 13:37
Subject: Re: How to build plugins and VMs (was: Opengl and Squeak)

An image update is safe, and it will not erase your work. But you
should get into the habit of making periodic backup copies of your
image and changes files. For example, you should make a backup copy
of your image and changes files before you begin to try my instructions
for loading VMMaker. This will protect you if anything goes wrong, or
if you just decide you do not really want all of that stuff in your
image after all.

By the way, a convenient way to make a "backup" of your image is
with this:

  world -> save as new version

You do not need to upload to squeaksource to save your work. You
can use Montecello to save your work and do version control, and
with this you can make a local repository in a directory on your
hard drive. You can save versions of your work in that repository.

Dave


On Sun, Aug 19, 2012 at 10:16:14AM +0100, dimitris chloupis wrote:

> thank you very much , I have stored your instructions as pdf and will take a look at the plugin tutorials again. Will try your instructions when my computer has wifi internet again. Will an image update erase my work ? is it safe ? I will first upload to squeaksource my work just to be sure.?
>
>
> ________________________________
>  From: David T. Lewis [via Smalltalk] <[hidden email]>
> To: kilon <[hidden email]>
> Sent: Sunday, 19 August 2012, 0:53
> Subject: How to build plugins and VMs (was: Opengl and Squeak)
>  
>
> On Sat, Aug 18, 2012 at 08:19:34AM +0100, dimitris chloupis wrote:
>
> Hi Dimitris,
>
> Skip to the bottom for the important part, how to build plugins.
>
> But first I will try to answer your questions.
>
> > Why coders prefer FFIs ??
> >
>
> Some people prefer FFIs because it allows the interface to be done
> without using compilers or building VMs, and because it is not necessary
> to distribute a compiled plugin to provide the platform interface.
>
> Some people may prefer using an FFI because they think it will save
> time. They are usually wrong. Unfortunately, by the time they figure
> this out, they will have wasted a lot of time trying to do things the
> "easy way", and never bothered to invest a few hours to learn how to
> do it more reliably with a plugin.
>
> > For example I am a python coder, ctypes which is the FFI cpython comes with has seen an explosion the last years . The most suprising is the conversion of pyOpeng from C extenstion to ctypes libraries even though that has slow down the library 2-3x times. The reason behind that move is not hard to guess. Much easier to maintain. FFIs remove one importan element from the equation and pretty much why people avoid using C in the first place. Compiling and building. Thus making FFIs ideals for the fast changing libraries , be able to change things on the fly and not have to suffer the slow downs of the C compiler.?
> >
>
> Yes, an FFI is very adaptable because all changes can be done in the image,
> and that is a good thing. However, relying on the compiler is only a
> problem if you are waiting for someone *else* to compile it for you.
> If you are willing to learn to do it for yourself, it is actually very
> fast and easy to make updates. And if you do most of your work in Smalltalk
> (aka "slang"), you will manage it with the same version control and tools
> that you use for all the rest of your Smalltalk work.
>
> You will find that you have far better support for debugging and profiling
> when you use a plugin, because you can use the platform debuggers and other
> tools directly. Also (and this is a really big thing in practice), you
> have the benefits of strong type checking provided by the C compiler when
> you build the interface as a plugin rather than directing your calls through
> an FFI interface.
>
> > I have taken a look at VM plugins, glanced through some tutorials, if I am not mistaken Slang is used to produce C code that then is compiled in a form that can be loaded by the VM is a primitive. The like an FFI call , you just use the primitive to execute the action.?
> >
>
> Yes, that's right.
>
> > I am definetly interested , and if you have any link I am more than welcome them, my only hesitation is buidling C files . I am the type of coder that likes to moves one line of code (or several ) per time and always make sure by testing that I dont code garbage. One of the reason I decided to convert from python to squeak was because I felt that it was easier to "live code" in this enviroment. I fear that a VM plugin might cut short this experience. Please correct me If I am mistaken.?
> >
>
> See below for instructions that should help get you started. My explanation
> assumes you are using unix/Linux, so please let me know if you are on
> Windows or Mac or something else.
>
> > Saying that I have installed with ease CroquetGL and the opengl example seems to run fine, (exampletex fails but that is to be expected , have not tried the fix yet).?
> >
> > If VM plugins are more stable, reliable and what the squeak community prefers I have no issues going down that route.?
> >
>
> You will probably not get a consensus from the community. I am giving you
> an opinion based on my own personal experience.
>
> OK, with that out of the way, here is what you should do:
>
> Allow about two hours to work through these instructions for the first time.
> If you are using Linux or Unix, you can follow the steps exactly. If you
> use another platform, just do the things you can, and you will still be able
> to get an idea of how things works. Here are the steps to follow:
>
> Prepare tools. On Linux, install dev tools, libraries of interest, and Subversion.
>
> Get a copy of the platform sources. Do this in the same directory in which
> you will be running your Squeak image. On Linux:
>
> ? $ svn co http://squeakvm.org/svn/squeak/trunk/platforms
>
> Any recent Squeak image will work for building VMs, but I like to work with
> an updated trunk image, like this:
>
> ? world -> open... -> morphic project
> ? (enter the project)
> ? [menu bar] Tools -> Preferences
> ? (select category Monticello. change Update URL from http://source.squeak.org/squeak43?to http://source.squeak.org/trunk.
> ? ? accept the change (<ctl> s). click save button)
> ? world -> help... -> update code from server
> ? (wait for update process to complete, then save your image)
>
> Install VMMaker. This is the trunk version for an interpreter VM. Do it this way
> to get started so that you will be able to see your generated C code in a browser.
>
> ? world -> open... Squeak Map Catalog
> ? in the Squeak Map browser, click Update
> ? select package VMMaker, version "head"
> ? click Install
> ? (wait for installation to complete)
>
> ? In a workspace, evaluate "VMMaker initialize". This will activate the Slang browsing tools.
> ? (note: in the future, you can evaluate "VMMaker updateFromServer" to keep your VMMaker up to date)
>
> Now have a look at some plugins.
>
> Open a browser on UnixOSProcessPlugin>>primitiveGetUid. This is a simple
> primitive call that links to the getuid() function in the C runtime library,
> and answers your uid when the primitive is called. This is how the primitive
> looks in Smalltalk. There is no C support code required, just the Smalltalk
> code that you see here.
>
> While looking at the primitiveGetUid method, click the "source" button on
> the browser, then select either "translate inlined C". You will now see
> the C code for the primitive.
>
> Explore a few more primitives and other methods, and have a look at other
> plugins, looking at both the Smalltalk source code and the generated C code.
>
> Now point your browser at B3DAcceleratorPlugin. This is a 3D graphics support
> plugin that uses GL. It was written by Andreas Raab, a distinguished Squeak
> guru and expert in graphics and VM programming. Andreas is less active on the
> list that he once was, but I'm sure he will chime it and offer some guidance
> once in a while. For now though, just treat this as a non-trivial example of
> interfacing to GL with a plugin.
>
> Last but not least: Build a VM. This will be a minimal configuration with
> only a few plugins, but it is enough to get you started. If you are able to
> do this successfully, then you have everything you need in order to start
> making your own plugins.
>
> ? world -> open... -> VMMaker
> ? click the the "Help" button and spend a few minutes reading it.
> ? click the "Entire" button to generate VM source code.
> ? This will translate the Smalltalk VM and plugin source code into C source
> ? ? files, which will be stored in the directory src along side your platforms
> ? ? directory. The platforms directory should contain all of the sources that
> ? ? you downloaded with Subversion, the the src directory will contain the generated sources from Smalltalk.
>
> Now open a terminal window. Compile your VM as follows:
>
> ? $ mkdir build
> ? $ cd build
> ? $ ../platforms/unix/cmake/configure --src=../src --without-gl
> ? $ make
>
> If you want to install your new VM, do a "make install".
>
> HTH,
> Dave
>
>
>
>
> ________________________________
>  
> If you reply to this email, your message will be added to the discussion below:http://forum.world.st/Opengl-and-Squeak-tp4644265p4644557.html 
> To unsubscribe from Opengl and Squeak, click here.
> NAML
>




If you reply to this email, your message will be added to the discussion below:
http://forum.world.st/Opengl-and-Squeak-tp4644265p4644572.html
To unsubscribe from Opengl and Squeak, click here.
NAML




Reply | Threaded
Open this post in threaded view
|

Re: Opengl and Squeak

kilon
In reply to this post by Igor Stasenko
Thank you all for your help. I decided to go with Opengl ES 2.0 . Many openglers have recommended to me Opengl ES 2 as a very nice subset of opengl that is both very powerful and way simpler to implement, so I will most likely use that for porting Morphic to opengl and maybe open the way for squeak/pharo android/ios port. Seems like a double win to me.  If I can automate the generation of the wrappers as already CroquetGL is doing it would be great.


12