PDA

View Full Version : Pascal eXtended Library (aka Asphyre) released!



LP
04-10-2015, 03:12 AM
Hi guys,

I'd like to let you know that Asphyre project continues and a new version, now called Pascal eXtended Library (http://www.afterwarp.net/products/pxl) has been released.

This new release contains almost everything that most recent release of Asphyre Sphinx 3 had, but with many new features.

The most exciting features include native support for singleboard devices such as Raspberry PI, Intel Galileo, BeagleBone Black among others. This includes fast access to interfaces such as GPIO, I2C, SPI, UART, PWM and so on.

Support for OpenGL, OpenGL ES, Direct3D 7, Direct3D 9 and Direct3D 11 is provided, along with new Software Renderer, which can also be used on singleboard computers as well.

This release supports all platforms available in Embarcadero Delphi XE 8 and later, and the following platforms in FreePascal / Lazarus: Windows 32 and 64-bit, Linux 32-bit, 64-bit and ARM, Mac OS X (32-bit Carbon and 64-bit Cocoa), SingleBoard devices (w/Linux) and experimental support for Android ARM and Intel.

As always, you can get the latest release from the official web site: http://www.afterwarp.net

I'm still working on updating the site and including new forums. Also, I'll be creating tutorials on how to install and configure FreePascal / Lazarus for each of the aforementioned platforms. I will be uploading source code to GitHub in next couple of days too.

As you can understand from above, there is still a lot of work to do with the web site, so please be patient. :)

Meanwhile, let me know what you think about this release.

P.S. If you are wondering about the name, since this thing now supports much more than Asphyre ever did, including major features for Electronics / Maker Community in addition to Game Development, a more broad name seemed appropriate.

Vinzvega
08-10-2015, 10:09 AM
Woww ! That is VERY cool : I'll take a look : In advance, congrat for advanced support of single board computer ! very Impressive. :)
And for the support for the 2 major pascal IDE too ;) It is not a detail !

I'll test on my Raspberry : Thank you very much for this work.

LP
10-10-2015, 03:16 AM
Thank you for the comments! I'm still working on the web site, have been having problems with different hosting providers (already switched a few in the past week). Next task will be adding tutorials to prepare FPC / Lazarus for each of the platforms supported by PXL, including Raspberry PI, Intel Galileo and others.

Anton
13-10-2015, 08:07 PM
Great work! Indeed very impressive :)

LP
14-10-2015, 05:48 PM
Thanks! I'm still writing some tutorials, currently have finished only two of them (http://afterwarp.net/wiki/index.php?title=Main_Page). At the same time, am investigating "embedded" target in FreePascal to hopefully support some additional CPUs. At some point, will also get to porting GUI framework.

devchenxip
17-10-2015, 07:48 AM
Great work!!! Thank you very much for this work. But I hope that can better support Chinese.

LP
18-10-2015, 11:43 PM
Thank you and, by the way, support for embedded (http://afterwarp.net/forum/forum/engineering-and-science/programming-and-graphics/27623-further-pxl-development-geared-towards-embedded-target) target is under development. Who knew FreePascal supports bare-bone ARM and AVR (e.g. Arduino) already....

devchenxip
27-10-2015, 09:12 AM
dear LP, PXL change too much, if you can continue to support tulip UI.

gcarreno
02-11-2015, 10:52 AM
This is a major update and a very welcome one. Especially the support for the Makers.

To be quite honest, this has make my day. I've just found out that a Hacker Space has opened here in Lancaster/UK and this is the cherry on top!!

Many, MANY thanks and a big loft of congratulations on the massive job, well done indeed!!

Cheers,
Gus

devchenxip
02-11-2015, 03:33 PM
PXL.Archives.Loading.pas

add code in 415line: Image.Name:= Key;

Otherwise, according to the name lookup complains

LP
04-11-2015, 05:35 PM
dear LP, PXL change too much, if you can continue to support tulip UI.
Indeed, UI has been a requested feature and even I've been offered to help porting UI. I've previously started to port Asphyre Sphinx UI to PXL, but as I'm trying to use RTTI now, it has been going slowly. Tulip UI was made by Marco Cestari, but I don't have the source code for its editor and haven't received answer to my last e-mail, so am still waiting.

By the way, there was a recent fix to FontTool, solving some issues with Unicode characters.


PXL.Archives.Loading.pas

add code in 415line: Image.Name:= Key;

Otherwise, according to the name lookup complains
Thanks! I've fixed this in both "v1.0 updates" and "master" branches.

Currently I'm still working on embedded target in master branch with full support for LPC1114, which would also serve as an example for adding support to other chips. Michael Ring has also kindly provided me additional FPC units for supporting Atmel SAM3x8e (Arduino Due) and several others, including some ARM Freedom and Nucleo boards, so I'll be testing those as well. I could also run AVR code on ATtiny2313 (smaller/cheaper chip than ATmega used in Arduino Uno), but have found few compiler optimization bugs there, so am waiting until they are fixed.

I've been also struggling with multiple hosting providers and forum software, but it seems that sorted things out and there shouldn't be any more trouble (I hope).

devchenxip
11-11-2015, 03:19 AM
Sphinx304:

function OverlapRect(const Rect1, Rect2: TRect): Boolean;
begin
Result:= (Rect1.Left < Rect2.Right) and (Rect1.Right > Rect2.Left) and (Rect1.Top < Rect2.Bottom) and (Rect1.Bottom > Rect2.Top);
end;

PXL:

function OverlapRect(const Rect1, Rect2: TIntRect): Boolean;
begin
Result := (Rect2.Left < Rect1.Right) and (Rect2.Right > Rect1.Left) and (Rect2.Top < Rect1.Bottom) and
(Rect2.Bottom > Rect1.Top);
end;

dear LP, It took me two hours to debug the changes...

SilverWarior
11-11-2015, 05:55 PM
@devchenxip Please use code tags when posting source code one the forum.

To do so you might want to switch to advanced post editing by using "Go Advanced" button which also have several buttons for adding code tags. The languages for which code tags are supported by our forums are Object Pascal, HTM; and PHP.

Also don't use any other type of formatting for source code like Coloring or it breaks the code tags.

LP
11-11-2015, 08:55 PM
devchenxip, thanks for reporting this, but what is the problem?
(yes, OverlapRect was modified to test Rect2 vs Rect1, previously it was inverted)

Also, for bugs, it is advisable to post them here (https://github.com/yunkot/pxl/issues).

devchenxip
13-11-2015, 03:25 AM
@devchenxip Please use code tags when posting source code one the forum.

To do so you might want to switch to advanced post editing by using "Go Advanced" button which also have several buttons for adding code tags. The languages for which code tags are supported by our forums are Object Pascal, HTM; and PHP.

Also don't use any other type of formatting for source code like Coloring or it breaks the code tags.


Sorry for the inconvenience!

devchenxip
13-11-2015, 03:31 AM
devchenxip, thanks for reporting this, but what is the problem?
(yes, OverlapRect was modified to test Rect2 vs Rect1, previously it was inverted)

Also, for bugs, it is advisable to post them here (https://github.com/yunkot/pxl/issues).

I didn't expect you will modify the code.


My old code used in many places this function.


It took me a lot of time debugging, finally found unexpectedly is "OverlapRect" changed.

Have a nice weekend.

Akira13
27-02-2016, 10:55 PM
Wow, this is a SERIOUS upgrade from the last version of Asphyre Sphinx... by far the best Object Pascal-based DirectX 11 rendering backend available. Very wise decision to do a fresh implementation of the headers, too, rather than using the terrible old JSB headers like everyone else out there.

devchenxip
26-04-2016, 04:59 AM
First chance exception at $00017D80. Exception class EAccessViolation with message 'Access violation at address 0058520B, accessing address 00000000'. Process client_mobile (388)

target platform:OS X - MacOSX 10.9.5


procedure TExtensions.DecodeVersionString;
var
VersionText: TExtString;
CharPos: Integer;
begin
VersionText := GetGLString(GL_VERSION); //VersionText = '' ??


CharPos := 1;


FMajorVersion := StrToIntDef(ExtractNumberWord(VersionText, CharPos), 0);


if CharPos <= Length(VersionText) then
FMinorVersion := StrToIntDef(ExtractNumberWord(VersionText, CharPos, 1), 0);
end;

devchenxip
26-04-2016, 01:25 PM
Basic Simple(FireMonkey) has leak found:

---------------------------
Unexpected Memory Leak
---------------------------
An unexpected memory leak has occurred. The unexpected small block leaks are:

1 - 12 bytes: TFireDX11Provider x 1
117 - 124 bytes: TMultimediaTimer x 1


change this program Destory Event:

procedure TMainForm.FormDestroy(Sender: TObject);
begin
EngineTimer.Free;
EngineFonts.Free;
EngineImages.Free;
EngineCanvas.Free;
EngineDevice.Free;
DeviceProvider.Free;
FMBridge.Free;
end;

Zimond
20-05-2016, 03:30 PM
Hi there.

Maybe someone can give me a hint here :

(From the Tunnel Example)


var
BitmapMain: TBitmap;
.
.
BitmapMain := TBitmap.Create(EngineDevice);
.
.
BitmapMain.Canvas.FillRect(0, 0, 512, 512, $FFFCFCFC, TBlendingEffect.Multiply);


Is this now the way how rendertargets work? By using Tbitmaps and creating them with the enginedevice?

SilverWarior
21-05-2016, 10:27 AM
No there is a TCustomDrawableTexture (http://asphyre.net/pxl/help/PXL.Textures.TCustomDrawableTexture.html)that is intended to be used as a render target.

LP
22-06-2016, 08:17 PM
First chance exception at $00017D80. Exception class EAccessViolation with message 'Access violation at address 0058520B, accessing address 00000000'. Process client_mobile (388)

target platform:OS X - MacOSX 10.9.5


procedure TExtensions.DecodeVersionString;
var
VersionText: TExtString;
CharPos: Integer;
begin
VersionText := GetGLString(GL_VERSION); //VersionText = '' ??


CharPos := 1;


FMajorVersion := StrToIntDef(ExtractNumberWord(VersionText, CharPos), 0);


if CharPos <= Length(VersionText) then
FMinorVersion := StrToIntDef(ExtractNumberWord(VersionText, CharPos, 1), 0);
end;
Are you using Delphi or FPC/Lazarus? What version? Specs of OS X machine?

This issue is likely caused by using OpenGL 3.0 with Forward Compatibility profile, which deprecates old functions, including "GL_VERSION" parameter. However, to be able to investigate it, I need details asked above. Also, you can report PXL bugs directly on its Bug Tracker (https://sourceforge.net/p/asphyre/bugs/).

LP
22-06-2016, 08:20 PM
No there is a TCustomDrawableTexture (http://asphyre.net/pxl/help/PXL.Textures.TCustomDrawableTexture.html)that is intended to be used as a render target.

Zimond also asked this by e-mail and I've explained that PXL does support render targets similar to earlier Asphyre versions, just now they are called "drawable textures" as you've accurately explained. This new name was chosen to be something in the middle between "render targets" in DX and "frame buffer objects" in GL. However, PXL introduces TBitmap in "PXL.Bitmaps.pas", which can be used as an alternative to TAtlasImage. TBitmap can have multiple internal "storage" options: system texture (so you can access it via Bitmap.Surface.Scanline, Bitmap.Surface.Pixels and so on), lockable texture or drawable texture (both of which can be accessed through Bitmap.Texture). The storage type is chosen and/or gets changed automatically depending on how you use it, but you can also control it explicitly via Storage property.

TBitmap also owns "Canvas", so you can draw to it easily. Something like:


MyBitmap := TBitmap.Create(MyDevice); // MyDevice must be already initialized here.
MyBitmap.SetSize(256, 256);

// Render something on bitmap using GPU.
if MyBitmap.Canvas.BeginScene then
try
// Draw something on bitmap (in this case, green rectangle filling entire surface).
MyBitmap.Canvas.FillRect(0, 0, 256, 256, IntColorRGB(0, 255, 0));

// Draw another bitmap onto this one.
MyBitmap.Canvas.UseImage(AnotherBitmap);
MyBitmap.Canvas.TexQuad(FloatRect4(30, 40, 128, 128), IntColorWhite4);
finally
MyBitmap.Canvas.EndScene;
end;

// Now access bitmap pixels directly (in this case, set one pixel to purple).
MyBitmap.Surface.Pixels[25, 50] := IntColorRGB(255, 0, 255);

// Save final scene to disk.
MyBitmap.SaveToFile("test.png");


What's great about that triple storage thing is that you can render to bitmap using GPU acceleration and then switch storage to "System" and access its pixels directly, if you have to. For obvious reasons, constantly changing bitmap storage type, especially for large bitmaps, is resource-intensive and should be done with care. The framework's official package has "Tunnel" sample that illustrates usage of bitmaps.

devchenxip
27-06-2016, 09:07 AM
I Use DelphiXE8 and OSX10.9.5.
I Want to how report PXL bugs directly on its Bug Tracker?

devchenxip
29-06-2016, 02:42 AM
Hi, Dear LP. win7 OS, in 64 bit model, compile basic project, report this error: Left side cannot be assigned to.

[dcc64 Error] PXL.Formats.pas(577): E2064 Left side cannot be assigned to


2016.07.19 fixed: add xe 10.1 berlin compiler directives. PXL.Config.inc
{$IFDEF VER310} // Delphi XE 10.1
{$DEFINE DELPHI_2009_UP}
{$DEFINE DELPHI_2010_UP}
{$DEFINE DELPHI_XE_UP}
{$DEFINE DELPHI_XE2_UP}
{$DEFINE DELPHI_XE3_UP}
{$DEFINE DELPHI_XE4_UP}
{$DEFINE DELPHI_XE5_UP}
{$DEFINE DELPHI_XE5}
{$DEFINE DELPHI_XE6_UP}
{$DEFINE DELPHI_XE6}
{$DEFINE DELPHI_XE7_UP}
{$DEFINE DELPHI_XE7}
{$DEFINE DELPHI_XE8_UP}
{$DEFINE DELPHI_XE8}
{$DEFINE DELPHI_XE10_UP}
{$DEFINE DELPHI_XE10}
{$DEFINE DELPHI_XE101_UP}
{$DEFINE DELPHI_XE101}
{$ENDIF}

devchenxip
29-06-2016, 10:11 AM
Report a bug: TBitmapFonts.Font[fontname] return a nil value, change TBitmapFonts.insert(...) code:


function TBitmapFonts.Insert(const Font: TBitmapFont): Integer;
begin
Result := Length(FFonts);
SetLength(FFonts, Result + 1);


FFonts[Result] := Font;
FFonts[Result].StyleTags := FStyleTags;
FFonts[Result].Canvas := FCanvas;
FSearchListDirty := True; //add this code
end;

pixelwriter
07-08-2016, 09:58 AM
Hi LP,
is there a plan to support openGL ES2 on Windows as well?
I find this useful as modern crossplatform solution.

SilverWarior
08-08-2016, 02:50 PM
Why are you asking about support for OpenGL ES on Windows? Do you know that OpenGL ES is just a subset of standard OpenGL API designed for Embedded Devices so that you can use similar approach for graphical rendering on those devices as you would on desktop computers?

pixelwriter
08-08-2016, 09:09 PM
Subset yes, but GLES 2, 3 are fully shaderbased and suffice in my case.
The advantage is easier support in my crossplatform app.
OpenGL drivers are not a very sure thing on Windows,
that's why I go like the major webbrowsers (which use libGLESv2.dll for webGL
and others). The swiftshader software renderer libGLESv2.dll is OpenSource,
and also the speedier libGLESv2.dll Angle. This can be used as fallback
if a hardware driver (openGL ES or matching openGL) is lacking.

SilverWarior
09-08-2016, 03:30 PM
OpenGL drivers are not a very sure thing on Windows,

So why do you think that driver support for OpenGL ES would be any better since OpenGL ES is primarily developed for embedded devices and not for desktops?
A quick search on web will tell you that in order to be able to use OpenGL ES on Windows you either need special drivers or additional SDK's for it or even worse run your software through a special OpenGL ES emulator.
http://developer.amd.com/tools-and-sdks/graphics-development/amd-opengl-es-sdk/
https://www.g-truc.net/post-0457.html
http://developer.download.nvidia.com/tegra/docs/win_es2emu_pack_v100.pdf

I personally feel that it would be better to add support for Vulkan API (https://www.khronos.org/vulkan/) which was build from the ground up to be a cross-platform graphical API. And based on initial information it can also rival with DirectX 12.
Now while at the moment there is still limited hardware support for Vilkan API that will definitely change in the future. You see the official specifications for Vulkan API has only been officially released on 16th of February 2016 so hardware vendors did not have much time to prepare for its arrival.

pixelwriter
10-08-2016, 02:15 PM
I would prefer Vulkan too, but I see no fallback on older systems; so I cannot use it. GLES2 (and GLES3 almost) is viable TODAY, no need to wait. The Windows enduser has two options: a) use GLES dll of Angle, or b) use GLES dll of Swiftshader (software only, but works 100% on all systems, even winXP) We can use the dll in standard way (context via EGL) GLES Angle handles internally all driver bindings (is also looking for native GLES driver first). GLES Angle also looks for Vulkan, useful in a future when other drivers lose performance. Both Google and Microsoft work on Angle. As to MS Windows, here is the relevant page: https://github.com/Microsoft/angle/wiki Also advice about Windows OpenGL vs. Angle here: https://wiki.qt.io/Qt_5_on_Windows_ANGLE_and_OpenGL is from mid 2015, but still has valid points.

SilverWarior
10-08-2016, 04:50 PM
Also advice about Windows OpenGL vs. Angle here: https://wiki.qt.io/Qt_5_on_Windows_ANGLE_and_OpenGL is from mid 2015, but still has valid points.

This article is assuming that most people still use those Generic Graphic drivers that ship with Windows who only have OpenGL 1 compatibility. But that is no longer true. Why?
Because by using of such drivers you lose lots of functionality of your graphics card. Most notable one is the fact that in most cases such drivers don't even properly support Widescreen monitor resolutions so you basically end up with 4:3 aspect ratio screen stretched to fit the widescreen monitor. As a result most computer vendors already install proper graphics drivers.
And if you have newer computer with newer graphics card there is an increased possibility that Windows will actually download and install proper graphical drivers who already have full OpenGL functionality as they are made by graphics card vendors and are just distributed through Windows Update platform.
Also article states that you need "Custom" graphical drivers for OpenGL to work on Windows. That was only true in the beginning of Windows XP era since Microsoft has been refusing to issue a VSDL certificate for graphical drivers which also had support for OpenGL as an attempt to further solidify the use of their DirectX library instead. They abandoned this practice after a huge pressure was made on them by many gamers and graphical cards vendors since at certain point OpenGL had more functionality than their Direct X 9c.

Do you have any examples that could be used as a test bench to compare the performance of OpenGL vs OpenGL ES?

LP
12-08-2016, 12:05 AM
Hi LP,
is there a plan to support openGL ES2 on Windows as well?
I find this useful as modern crossplatform solution.

In addition to what SilverWarior said, remember that on Windows there is no native OpenGL ES support, other than what you mentioned, working either in software emulation (and PXL has software renderer of its own) or a wrapper on top of DirectX 11, which PXL supports directly. On Linux, you also need to install special packages so that OpenGL ES calls get translated to OpenGL. Nevertheless, if you really need OpenGL ES on Windows, you can just adapt existing OpenGL ES provider - it shouldn't be too difficult.


I personally feel that it would be better to add support for Vulkan API (https://www.khronos.org/vulkan/) which was build from the ground up to be a cross-platform graphical API. And based on initial information it can also rival with DirectX 12.
I have already made a couple of experiments with Vulkan and this provider is planned to be added.

devchenxip
04-04-2018, 08:10 AM
Hi, Dear LP, Can you open the code for the Tulip-UI editor?

http://bbs.2ccc.com/topic.asp?topicid=545520

LP
11-04-2018, 12:00 AM
Tulip UI author kindly agreed to publish the source code of the editor, which can now be found at:
https://github.com/MarquitosPT/Tulip