Coder Social home page Coder Social logo

form-scene-graph's Introduction

Form Scene Graph

Rendering framework inspired on GSK for Pharo.

Loading the framework in Pharo

For loading this framework with the default software based backend, you need to execute the following script in a playground:

"Scene graph rendering framework"
Metacello new
   baseline: 'FormSceneGraph';
   repository: 'github://desromech/form-scene-graph';
   onConflictUseIncoming;
   load.

If you feel adventurous, and want to try the experiment OpenGL ES accelerated backend, you need to load it with the following script in a playground, and then select it in the Setting browser:

"Scene graph rendering framework"
Metacello new
   baseline: 'FormSceneGraph';
   repository: 'github://desromech/form-scene-graph';
   onConflictUseIncoming;
   load: #AcceleratedOpenGL.

If you feel even more adventurous, and want to try the experiment AbstractGPU accelerated backend (Vulkan, Metal and Direct3D 12), you need to load it with the following script in a playground, and then select it in the Setting browser:

"Scene graph rendering framework"
Metacello new
   baseline: 'FormSceneGraph';
   repository: 'github://ronsaldo/form-scene-graph';
   onConflictUseIncoming;
   load: #AcceleratedAbstractGPU.

Enabling the new renderer on the main Pharo window.

For enabling this new renderer for the Pharo Morphic World, in addition to loading this baseline it is required to also enable its usage through the Settings browser:

Renderer Enabling Setting

The effect of changing this setting is only visible after restarting the image by doing a save and quit.

Comparison

The followings are comparisons with a scale factor of 1.5:

Old Renderer at 1.5x: Old Renderer 1.5x

New Renderer at 1.5x with Athens backend: New Renderer 1.5x

New Renderer at 1.5x with OSWindow SDL2 renderer backend: New Renderer 1.5x

Extra: opening external windows (Very experimental)

"Open an external world with the Athens based scene graph renderer. (Most of the work goes here)"
FormSGAthensWorldMorph new open.

"Open an external world with the SDL2 based renderer."
FormOSWindowGenericRendererSGWorldRenderer new open.

"Open an external world with the BitBlt based renderer. (Incomplete)"
FormSGCanvasWorldMorph new open.

"Open an external world with the OpenGL ES based scene graph renderer. (Experimental, may be unstable)"
FormSGOpenGLESRendererWorldMorph new open.

"Open an external world with the AbstractGPU based scene graph renderer. (Experimental, may be unstable)"
FormSGAGPURendererWorldMorph new open.

form-scene-graph's People

Contributors

ducasse avatar ronsaldo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

form-scene-graph's Issues

Loading warning in latest Pharo 9.0

  1. Download Pharo 9 this way: curl https://get.pharo.org/64/90+vmHeadlessLatest | bash
  2. Open image with pharo-ui.
  3. Execute loading script.
  4. Get:
Warning: This package depends on the following classes:
  IceTipToolbarItemButtonMorph
You must resolve these dependencies before you will be able to load these definitions: 
  IceTipToolbarItemButtonMorph>>#buildBadgeSceneGraphNodeWith:
  IceTipToolbarItemButtonMorph>>#buildSceneGraphNodeWith:

How to animate a morph that renders with cairo on every step?

Hi!

In P10, when you evaluate AthensTigerWindow openAnimated you get:

http://www.giphy.com/gifs/WUdi6gjbUpVjS3NrKq

I was particularly interested on this case, so I tried to implement it.

I installed FSG with:

Metacello new
   baseline: 'FormSceneGraph';
   repository: 'github://ronsaldo/form-scene-graph';
   onConflictUseIncoming;
   load: #AcceleratedAbstractGPU.

(the "adventurous" option, as the readme says :) )

When I try the AthensTigerWindow, I only get a window with gray background.
I looked at AnimatedImageMorph for inspiration and added:

AthensTigerWindow>>
buildSceneGraphNodeWith: builder
	^ builder textureForm: surface asForm at: self layoutBounds origin.

Similar for AthensFlakeDemo open, where I added:

AthensFlakeDemo>>
buildSceneGraphNodeWith: builder
	self render.
	^ builder textureForm: surface asForm at: bounds origin

AcceleratedAbstractGPU: Can't download file

Hi!

I get a loading error... I tried in Pharo 9 and 10 (MacBook from 2018):

Metacello new
   baseline: 'FormSceneGraph';
   repository: 'github://ronsaldo/form-scene-graph';
   load: #AcceleratedAbstractGPU.

There is this URI:
https://api.github.com/repos/ronsaldo/abstract-gpu/releases/assets/49144800
In the debugger that's shown.

During load I only get a visual popup with the download error that dissapears, but when I try to open the system preferences I get the debugger (apparently of the same error, didn't check).

I tried to debug or find a fix but failed.
For example, use variations of the parameters to the download sentence, but even rewriting it to use the Iceberg helper which should use my credentials*, but didn't succeed. And I didn't find an announcement from GitHub such a change in the REST API.

*:

		(IceGitHubAPI new
			acceptMediaType: 'application/octet-stream';
			get: downloadFileURI)

The stack in the debugger is:

PhaNAPIGitHubRelease(Object)>>error:
PhaNAPIGitHubRelease>>downloadAssetNamed:uri:
PhaNAPIGitHubRelease>>downloadUser:repository:release:forMode:platform:
PhaNAPIGitHubRelease>>fetchLibrary:fromUser:repository:release:
PhaNAPIGitHubRelease>>fetchLibrary:fromIcebergRepoOfClass:
PhaNAPIGitHubRelease class>>fetchLibrary:fromIcebergRepoOfClass:
AGPUCBindings(AGPUCBindingsBase)>>fetchLibrary
AGPUCBindings(PhaNAPILibrary)>>ffiLibraryName
AGPUCBindings(PhaNAPILibrary)>>libraryName
TFCalloutMethodBuilder(FFICalloutMethodBuilder)>>libraryName
TFCalloutMethodBuilder>>createFFICalloutLiteralFromSpec:
TFCalloutMethodBuilder>>generateFFICallout:spec:ffiLibrary:
[ :builder | | r |
		
		"Copy the properties of the old method"
		sender methodProperties
			ifNotNil: [ properties := sender methodProperties copy.
				properties method: nil.
				builder properties: properties ].

		builder
			numArgs: self argumentNames size;
			addTemps: (self argumentNames copyWith: #result).		
		
		ffiLibrary preMethodBuildContext: sender builder: builder spec: functionSpec.
		r := self generateFFICallout: builder spec: functionSpec ffiLibrary: ffiLibrary.
		ffiLibrary postMethodBuildContext: sender builder: builder spec: functionSpec.
		r] in TFCalloutMethodBuilder(FFICalloutMethodBuilder)>>generateMethodFromSpec: in Block: [ :builder | | r |...
IRBuilder class>>buildIR:
TFCalloutMethodBuilder(FFICalloutMethodBuilder)>>generateMethodFromSpec:
TFCalloutMethodBuilder(FFICalloutMethodBuilder)>>generate
TFCalloutMethodBuilder(FFICalloutMethodBuilder)>>build:
TFCalloutAPI(FFICalloutAPI)>>function:library:
TFCalloutAPI(FFICalloutAPI)>>function:module:
AGPUCBindings(FFILibrary)>>ffiCall:
AGPUCBindings>>getPlatforms_numplatforms:platforms:ret_numplatforms:
AGPU>>getPlatforms:platforms:ret_numplatforms:
[
		self getPlatforms: 0 platforms: nil ret_numplatforms: platformCount.
		^ platformCount unsignedLongAt: 1
	] in AGPU>>platformCount in Block: [...
FullBlockClosure(BlockClosure)>>ensure:
AGPU>>platformCount
AGPU>>fetchPlatforms
AGPU>>checkPlatformsSession
AGPU>>deviceDescriptions
AGPU class>>deviceDescriptions
AGPU class>>availableDeviceNames

Segmentation Fault in P9

  1. Download Pharo 9 this way: curl https://get.pharo.org/64/90+vmHeadlessLatest | bash
  2. Follow default loading instructions, enable in settings, and save&quit.
  3. Try to re open with pharo-ui.
  4. Get:
Segmentation fault Thu Feb 25 15:39:10 2021


/private/tmp/scg/pharo-vm/Pharo.app/Contents/MacOS/Pharo
PharoVM version:5.0-Pharo 9.0.0 built on Feb 23 2021 14:17:07 Compiler: 4.2.1 Compatible Apple LLVM 11.0.3 (clang-1103.0.32.29) 4.2.1 Compatible Apple LLVM 11.0.3 (clang-1103.0.32.29) [Production Spur 64-bit VM]
Built from: CoInterpreter VMMaker-tonel.1 uuid: cd319970-6278-0d00-8cf8-14330fc78c75 Feb 23 2021
 With:StackToRegisterMappingCogit VMMaker-tonel.1 uuid: cd319970-6278-0d00-8cf8-14330fc78c75 Feb 23 2021
 Revision: a3a0902b - Commit: a3a0902b - Date: 2021-02-23 13:50:44 +0100

C stack backtrace & registers:
	rax 0x0000000000000000 rbx 0x0000000114f39e30 rcx 0x0000000000000eb4 rdx 0x000000010a089e90
	rdi 0x0000000000000005 rsi 0x0000000000000005 rbp 0x00007ffee5c5a410 rsp 0x00007ffee5c5a3e0
	r8  0x000000010a06480e r9  0x000000010a064812 r10 0x0000000000000000 r11 0x0000000000000000
	r12 0x00007ffee5c6a0e8 r13 0x0000000000000000 r14 0x000000010f840440 r15 0x000000010a07c070
	rip 0x000000010f840455
*0   libSurfacePlugin.dylib              0x000000010f840455 primitiveCreateManualSurface + 21
1   libPharoVMCore.dylib                0x000000010a05f7c9 reportStackState + 313
2   libPharoVMCore.dylib                0x000000010a05f667 doReport + 183
3   libPharoVMCore.dylib                0x000000010a06034d sigsegv + 77
4   libsystem_platform.dylib            0x00007fff203a1d7d _sigtramp + 29
5   ???                                 0x0000000000000000 0x0 + 0
6   libPharoVMCore.dylib                0x000000010a00aa17 primitiveExternalCall + 951
7   libPharoVMCore.dylib                0x0000000109ff45b0 interpret + 29840
8   libPharoVMCore.dylib                0x000000010a0002f5 enterSmalltalkExecutiveImplementation + 149
9   libPharoVMCore.dylib                0x0000000109fed788 interpret + 1640
10  libPharoVMCore.dylib                0x0000000109fa5696 vm_main_with_parameters + 710
11  libPharoVMCore.dylib                0x0000000109fa57f6 vm_main + 294
12  Pharo                               0x0000000109f96f24 start + 52
13  ???                                 0x0000000000000000 0x0 + 0

Can't dump Smalltalk stack(s). Not in VM thread

Most recent primitives
stringHash:initialHash:
stringHash:initialHash:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.