[squeak-dev] 64 bit FFI

gettimothy gettimothy at zoho.com
Fri Mar 20 00:48:11 UTC 2020


Squeak 32 does not run 'seamlessly'  on ubuntu 18 .  After a day of wrangling it, It starts and I can set the preferences wizard up to rhe point where it must connect to the Internet to download and install ffi, osprocess, git, etc ..at that point, what should be  the 'ok' button says 'you dont have internet access' or something to that effect.


Tldr; could not get to OpenGL example on 32 bit install on 64 bit Ubuntu 18 with i386 libs installed.

I got tired of trying and moved to another approach.


If you know of a fix for the internet stuff, I can try again come Tuesday

Fwiw, the 64 bit squeak installs fine as does the CroquetGL stuff and OpenGL example does not work. The ffi? primitives fail.

On a happy note, I was able to build a simple c example after a day, today, of wrangling, and displai a triangle. 

Linking libraries was huge issue, which I grok now, and it leads ne to wonder how the Squeak  OpenGL is even aware of the existing libraries.. (i doubt it is)

For example -lGL had to be xhanged to -lOpenGL in my program as did the -L path to get C to talk to the graphics card via the OpenGL stuff.

Cheers

t








---- On Thu, 19 Mar 2020 19:06:37 -0400 bert at freudenbergs.de wrote ----


The OpenGL class has two example methods on the class side. Trying these is what I meant with "make sure it works in 32 bits":


example	"OpenGL example"
	"A very simple OpenGL example"

	| ogl frames startTime deltaTime framesPerSec bounds font |
	font := StrikeFont familyName: 'Atlanta' pointSize: 11.
	bounds := 0 at 0 extent: 400 at 400.
	ogl := OpenGL newIn: bounds.
	ogl ifNil:[^self error: 'Unable to create renderer'].
	[frames := 0.
	startTime := Time millisecondClockValue.
	[Sensor anyButtonPressed] whileFalse:[
		"start counting at second frame since first frame is penalized
		by the upload of the bitmap font outside of ogl."
		frames = 1 ifTrue:[startTime := Time millisecondClockValue].
		ogl beginFrame.

	"--- this is the actual scene content ---"

		ogl glDisable: GLDepthTest.	"for the simple example only"
		ogl glDisable: GLLighting.		"for the simple example only"

		ogl glClearColor: 1.0 with: 1.0 with: 1.0 with: 1.0.
		ogl glClear: GLColorBufferBit.

		ogl glRotatef: 5.0 with: 0.0 with: 0.0 with: 1.0.
		ogl glColor3f: 1.0 with: 0.0 with: 0.0.

		ogl glBegin: GLPolygon.
			ogl glVertex2f: -0.7 with: -0.7.
			ogl glVertex2f:  0.7 with: -0.7.
			ogl glVertex2f:  0.7 with:  0.7.
			ogl glVertex2f: -0.7 with:  0.7.
		ogl glEnd.

	"--- here is the 2d overlay setup ---"

		ogl glMatrixMode: GLProjection.
		ogl glPushMatrix.
		ogl glLoadIdentity.
		ogl glMatrixMode: GLModelview.
		ogl glPushMatrix.
		ogl glLoadIdentity.
		ogl glTranslated: -1 with: 1 with: 0.0.
		ogl glScaled: (2.0 / bounds width) with: (-2.0 / bounds height) with: 1.0.
		ogl glDisable: GLDepthTest.
		ogl glEnable: GLBlend.
		ogl glBlendFunc: GLOne with: GLOneMinusSrcAlpha.

	"--- here is the 2d overlay rendering ---"
		deltaTime := Time millisecondsSince: startTime.
		framesPerSec := frames * 1000 / (deltaTime max: 1) asFloat.
		
		"@@@@: Fixme. It appears as if #drawString: depends on glColor being set.
		Makes no sense but I'm not going to figure this out - probably some mishap
		wrt. GLLighting being disabled."
		ogl glColor3f: 0.0 with: 0.0 with: 0.0.
		ogl drawString: frames printString, ' frames: ', (framesPerSec truncateTo: 0.1), ' fps'
			at: 0 at font height at 0 font: font color: Color black.

		ogl glDisable: GLBlend.
		ogl glMatrixMode: GLModelview.
		ogl glPopMatrix.
		ogl glMatrixMode: GLProjection.
		ogl glPopMatrix.
		ogl glMatrixMode: GLModelview.

	"--- end the end frame operations"

		ogl endFrame.
		ogl swapBuffers.
		frames := frames + 1.
	].
	] ensure:[ogl destroy].

- Bert -




On Thu, Mar 19, 2020 at 5:57 AM gettimothy via Squeak-dev <squeak-dev at lists.squeakfoundation.org> wrote:



Hi Subbu,

I will keep it in mind. My focus now is on building openGL tutorial programs such as this: https://paroj.github.io/gltut/index.html
or this: https://www.linuxjournal.com/content/introduction-opengl-programming


the exercise is already giving me insight into the Squeak openGL and should be of use when I get to the FFI part.

cheers,

t



---- On Thu, 19 Mar 2020 04:00:06 -0400 K K Subbu <kksubbu.ml at gmail.com> wrote ----



On 18/03/20 5:28 PM, gettimothy via Squeak-dev wrote:
>
> Step 1: verify working on 32 bit machines.  Well, I do not have a 32 bit
> machine that can run squeak (old pentium laptop --the kind that catches
> on fire) and I tried running side-by-side on Ubuntu.
> 64 bit runs fine, 32 bit tries to launch and cannot find the display
> driver.  I could install 32 bit compat libs on my Slackware distro boot,
> but I prefer to keep that pristine.
> I don't care for fighting with Ubuntu, so if anybody knows a quick fix,
> much appreciated. I can get the exact error if needed, just need to
> reboot and retry.
Have you tried booting 32-bit Ubuntu from a live USB (4GB+) drive for
your experiments?

Regards .. Subbu







-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200319/2cb58d54/attachment.html>


More information about the Squeak-dev mailing list