Recent

Author Topic: BGRABitmap demo projects  (Read 10175 times)

lainz

  • Hero Member
  • *****
  • Posts: 4449
    • https://lainz.github.io/
BGRABitmap demo projects
« on: May 29, 2018, 05:05:03 pm »
Hi, I've made a new repository some days ago
https://github.com/bgrabitmap/demo#demo

Where to put things that you can do with BGRABitmap.

Currently it has 4 projects, but if you have a project made with BGRABitmap you can contribute sending it here, and I will add it quickly.
« Last Edit: June 18, 2018, 11:26:19 pm by lainz »

circular

  • Hero Member
  • *****
  • Posts: 4181
    • Personal webpage
Re: BGRABitmap demo projects
« Reply #1 on: May 30, 2018, 08:57:22 pm »
I am thinking about adding some voxel demo I made. However there is a bit of a glitch in the textures so I am trying to fix that first.
Conscience is the debugger of the mind

circular

  • Hero Member
  • *****
  • Posts: 4181
    • Personal webpage
Re: BGRABitmap demo projects
« Reply #2 on: May 30, 2018, 11:15:59 pm »
I've added the voxel demo. Textures are still a bit glitchy but it's already something.

Move with arrows. Jump and crouch with page up/down.

You can go outside of the map and see from the outside.

https://github.com/bgrabitmap/demo/tree/master/voxel
Conscience is the debugger of the mind

lainz

  • Hero Member
  • *****
  • Posts: 4449
    • https://lainz.github.io/
Re: BGRABitmap demo projects
« Reply #3 on: May 31, 2018, 02:03:51 pm »
Thanks =)

lainz

  • Hero Member
  • *****
  • Posts: 4449
    • https://lainz.github.io/
Re: BGRABitmap demo projects
« Reply #4 on: June 17, 2018, 04:16:15 pm »
Hi, I've added 3 more projects:
- waves: move the mouse and clic to paint
- mouse down and draw circles: an bgrabitmap 'game' where you need to draw circles to sum score
- hello world 2: more animations with easings

Currently we have 8 projects in this repository-
« Last Edit: June 17, 2018, 09:46:43 pm by lainz »

lainz

  • Hero Member
  • *****
  • Posts: 4449
    • https://lainz.github.io/
Re: BGRABitmap demo projects
« Reply #5 on: June 17, 2018, 04:37:29 pm »
And I've tested finally the Voxel demo, is just amazing!

I've tested it with pixel size of 0.5, 1, 2, 5, etc.. all working fine. From the most antialiased to the most pixelated!

circular

  • Hero Member
  • *****
  • Posts: 4181
    • Personal webpage
Re: BGRABitmap demo projects
« Reply #6 on: June 17, 2018, 08:02:16 pm »
Glad you like my voxel demo.  :)

I tried your projects. Waves and hello world 2 works fine.

I am not quite understanding the "mouse down and draw circles". Also it does not seem to use OpenGL. Am I missing something?
Conscience is the debugger of the mind

lainz

  • Hero Member
  • *****
  • Posts: 4449
    • https://lainz.github.io/
Re: BGRABitmap demo projects
« Reply #7 on: June 17, 2018, 09:46:11 pm »
Glad you like my voxel demo.  :)

I tried your projects. Waves and hello world 2 works fine.

I am not quite understanding the "mouse down and draw circles". Also it does not seem to use OpenGL. Am I missing something?

Oh, maybe I just remember it bad, I think it was using OpenGL, but I not checked that, just grabed the source and put in the repository  :) I'm editing my previous post.

If you press the mouse button and draw a circle, it adds score at the top left. (Notice that the algorythm is not perfect, and it maybe adds score as well if you don't draw a perfect circle, it can be tweaked).

I've added a new test project, but this time in BGRAControls:
https://github.com/bgrabitmap/bgracontrols/tree/dev-bgracontrols/test/dashboard

Edit: I forget that this requires the material design package... maybe it's a good idea to move that button to BGRAControls. In fact BGRAControls had the first material design button, but I've improved it a lot in the other package.

I had more projects, but I have the bad habit to delete anything I don't use  :(
« Last Edit: June 17, 2018, 10:07:34 pm by lainz »

Josh

  • Hero Member
  • *****
  • Posts: 1270
Re: BGRABitmap demo projects
« Reply #8 on: June 18, 2018, 12:59:29 am »
 Hi

I tried voxel but am getting error, windows 10 64, latest bgrabitmap and controls via opm.

Code: [Select]
Compile Project, Target: voxel.exe: Exit code 1, Errors: 1, Hints: 4
umain.pas(26,59) Hint: Parameter "Shift" not used
umain.pas(27,57) Hint: Parameter "Shift" not used
umain.pas(167,50) Error: Can't determine which overloaded function to call
bgradefaultbitmap.pas(1847,29) Hint: Found declaration: GetPixel(Single;Single;TResampleFilter=`1`;Boolean=`TRUE`):<record type>;
bgradefaultbitmap.pas(1817,29) Hint: Found declaration: GetPixel(LongInt;LongInt):<record type>;
.

Latest Lazarus and FPC trunk.

Any ideas?
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

lainz

  • Hero Member
  • *****
  • Posts: 4449
    • https://lainz.github.io/
Re: BGRABitmap demo projects
« Reply #9 on: June 18, 2018, 01:31:03 am »
Try on 1.8.4

Trunk is not very good

Edit: remove the 'round(x)' and 'round(y)' in the line given the error, and it will work fine in trunk.
« Last Edit: June 18, 2018, 01:33:58 am by lainz »

Josh

  • Hero Member
  • *****
  • Posts: 1270
Re: BGRABitmap demo projects
« Reply #10 on: June 18, 2018, 01:51:14 am »
Hi

thanks, I removed the Round(x),y so it is now just x,y

When I compile and run, all is ok, but if Turn On debig, and then compile and run and exit the demo, I get loads of unfreed memory blocks???

ps. Very impressive though :+)
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

lainz

  • Hero Member
  • *****
  • Posts: 4449
    • https://lainz.github.io/
Re: BGRABitmap demo projects
« Reply #11 on: June 18, 2018, 07:57:06 pm »
Yesterday I've added the superformula test project:
https://github.com/bgrabitmap/demo/tree/master/superformula

Based on this video:
https://www.youtube.com/watch?v=u6arTXBDYhQ

I get a lot of 'float' exceptions when working with random values, so I added some exception handling, seems that they're using Java in the video.

Edit: play tweaking the values to get random animations =)

Code: Pascal  [Select][+][-]
  1.     rad := r(theta, 0.1, // a - size and control spikes
  2.       0.1, // b - size and control spikes
  3.       32, // m - number of spikes
  4.       1, // n1 - roundness
  5.       tan(t/pi) * 0.5 + 0.5, // n2 - shape
  6.       sin(t*pi) * 0.5 + 0.5 // n3 - shape
  7.       );
  8.     if t > 2 * pi then
  9.       t := 0;  

Edit 2: this is a great one, it keeps adding spikes, until it rolls back to become a circle again, and then starting to add spikes again!

Code: Pascal  [Select][+][-]
  1.     rad := r(theta, 1, // a - size and control spikes
  2.       11, // b - size and control spikes
  3.       t, // m - number of spikes
  4.       4, // n1 - roundness
  5.       1, // n2 - shape
  6.       1 // n3 - shape
  7.       );  

Use "t" in the number of spikes.

Another edit: I've added all screenshots
https://github.com/bgrabitmap/demo#demo

And fixed the memory leak in Voxel, it was just a line.
« Last Edit: June 19, 2018, 12:15:42 am by lainz »

circular

  • Hero Member
  • *****
  • Posts: 4181
    • Personal webpage
Re: BGRABitmap demo projects
« Reply #12 on: June 19, 2018, 10:58:46 am »
Ah yes, I did not call the Free method at the end of the program.  :-[
Conscience is the debugger of the mind

lainz

  • Hero Member
  • *****
  • Posts: 4449
    • https://lainz.github.io/
Re: BGRABitmap demo projects
« Reply #13 on: June 24, 2018, 12:30:28 am »
Hi, these days I've added:
- Fractal Tree
- Fractal Tree 2 (thanks to my brother, learning Pascal, one of his first programs)
- Superformula UI

And now we have 12 demo projects.  :)

Unfortunately, I tried but can't fix the Superformula UI (https://forum.lazarus.freepascal.org/index.php/topic,41646.msg289478.html#msg289478) to stop breaking the application with SIGFPE exceptions sometimes, seems that I'm doing something wrong that I can't fix. So in it's current state, is not good idea to try to include it in LazPaint.

Well, I'm not sure how far this will go. There are always fun and interesting things to code with BGRABitmap.

But I'm sure these are enough for anyone wanting to start with BGRA. There are animations, Canvas2D, images, user input and more.

circular

  • Hero Member
  • *****
  • Posts: 4181
    • Personal webpage
Re: BGRABitmap demo projects
« Reply #14 on: June 26, 2018, 10:57:38 am »
Have you been able to determine the value of the parameters for which the computation of the superformula breaks? You might then determine step by step in the formula where it goes to infinity or something.

That's indeed a few demos already.

This fractal tree is awesome!  :)
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018