Recent

Poll

Vote: What's the best project of this year?

"ball" by raw
1 (3.7%)
"bgragraphics" by j-g (pocket watch)
2 (7.4%)
"duplo6" by bylaardt
7 (25.9%)
"glslideshow" by handoko
2 (7.4%)
"mariocronch" by ericktux
0 (0%)
"movingdots" by lainz
1 (3.7%)
"movingdotsgl" by lainz
0 (0%)
"relogio" by bylaardt
5 (18.5%)
"starsfieldshooter" by turrican
0 (0%)
"steampunkclock" by bylaardt
1 (3.7%)
"sudoku" by user137
5 (18.5%)
"furiouspaladin" by handoko
3 (11.1%)
"educrace" by lulu
0 (0%)

Total Members Voted: 26

Author Topic: Graphics Contest 2017, please vote now!  (Read 216046 times)

Handoko

  • Hero Member
  • *****
  • Posts: 5486
  • My goal: build my own game engine using Lazarus
Re: Graphics Contest 2017, please vote now!
« Reply #240 on: August 05, 2017, 05:30:09 pm »
Original size of 'snowflake BW.png' : 33396 bytes
Re-saved size of 'snowflake BW.png' : 40228 bytes
The ORIGINAL file was 40228 bytes   -  Curiouser and curiouser !!  -  unless you have accidentally transposed the two figures.
Sorry my mistake.

I cannot open both your 'snowflake BW NonInt.png' and 'snowflake BW.png' using TImage.Picture.LoadFromFile on my Linux64 computer. I can open them using GIMP and my Linux built-in image viewer.

Code: Pascal  [Select][+][-]
  1. unit Unit1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Forms, Dialogs, ExtCtrls, StdCtrls, ExtDlgs;
  9.  
  10. type
  11.  
  12.   { TForm1 }
  13.  
  14.   TForm1 = class(TForm)
  15.     Button1: TButton;
  16.     Image1: TImage;
  17.     OpenPictureDialog1: TOpenPictureDialog;
  18.     procedure Button1Click(Sender: TObject);
  19.   end;
  20.  
  21. var
  22.   Form1: TForm1;
  23.  
  24. implementation
  25.  
  26. {$R *.lfm}
  27.  
  28. { TForm1 }
  29.  
  30. procedure TForm1.Button1Click(Sender: TObject);
  31. begin
  32.   OpenPictureDialog1.Execute;
  33.   Image1.Picture.LoadFromFile(OpenPictureDialog1.FileName);
  34.   Caption := OpenPictureDialog1.FileName;
  35. end;
  36.  
  37. end.

If I open 'snowflake BW NonInt.png' or 'snowflake BW.png', I can see the titlebar changed to the file name. But nothing happened, sometimes the program just exit immediately. But if I open the image saved using GIMP, it works correctly. Can anyone please download loadimage.zip and test it?

One recommendation I might make for Handoko's Slideshow project that would immediately solve all image-format issues is to simply use BGRABitmap!

I ever thought about it. But now there is mystery needed to be solved.

J-G

  • Hero Member
  • *****
  • Posts: 966
Re: Graphics Contest 2017, please vote now!
« Reply #241 on: August 05, 2017, 05:33:13 pm »
I've now made time to check other 'Monochrome' images - or more precisely 8 bit Black/White images (rather than 'GreyScale') and every one fails. 

Most with a SIGSEGV but some with 'Offset Error'.

'GreyScale' are OK.

I've put a few on my web-site for testing.
« Last Edit: August 05, 2017, 08:51:22 pm by J-G »
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

lainz

  • Hero Member
  • *****
  • Posts: 4738
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: Graphics Contest 2017, please vote now!
« Reply #242 on: August 05, 2017, 05:41:25 pm »
One recommendation I might make for Handoko's Slideshow project that would immediately solve all image-format issues is to simply use BGRABitmap! The TBGRABitmap class is capable of loading pretty much any image file type that you'd ever want to...

That's true. I remember some old days when I provide Circular all the possible image formats of .psd files, and thanks to his work every single one was loaded fine with LazPaint.

Handoko

  • Hero Member
  • *****
  • Posts: 5486
  • My goal: build my own game engine using Lazarus
Re: Graphics Contest 2017, please vote now!
« Reply #243 on: August 05, 2017, 05:58:44 pm »
At the beginning I want to use just Lazarus' built-in libraries/units so users can easily compile and run the code. And you know, we hear a lot of users have problem installing TBGRABitmap.

Well, I think I should not reinvent the wheel. I will use BGRABitmap in glSlideshow.

@J-G

I test your images, only 'Card Background.tif' is able to open using the LoadImage code:
3-4.tif
BSL Logo.tif
✔ Card Background.tif
snowflake BW NonInt.png
snowflake BW.png
vonEssen.tif

Tested on Lazarus 1.6.4 Gt2 Ubuntu Mate 16.10. If it failed, it show no error and sometimes it exit immediately.
« Last Edit: August 05, 2017, 06:01:35 pm by Handoko »

lainz

  • Hero Member
  • *****
  • Posts: 4738
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: Graphics Contest 2017, please vote now!
« Reply #244 on: August 05, 2017, 07:31:41 pm »
I never had problems installing BGRABitmap on released lazarus and fpc both in Windows and Linux, the problems comes when using untested trunk builds of fpc and lazarus.

J-G

  • Hero Member
  • *****
  • Posts: 966
Re: Graphics Contest 2017, please vote now!
« Reply #245 on: August 05, 2017, 08:57:29 pm »
@J-G
I test your images, only 'Card Background.tif' is able to open using the LoadImage code:
3-4.tif
BSL Logo.tif
✔ Card Background.tif
snowflake BW NonInt.png
snowflake BW.png
vonEssen.tif

Tested on Lazarus 1.6.4 Gt2 Ubuntu Mate 16.10. If it failed, it show no error and sometimes it exit immediately.

I'm pleased to find that you have the same problems that I do - at least that means that my system isn't the culprit !!

The Card Background is the only RGB (24bit) image and of course you had already solved the 32/24 bit issue.
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

Akira1364

  • Hero Member
  • *****
  • Posts: 563
Re: Graphics Contest 2017, please vote now!
« Reply #246 on: August 07, 2017, 01:05:17 am »
Had some free time today, so just for fun I did a bit of a rewrite of Handoko's Slideshow project (using BGRABitmap like I had suggested, along with some other changes to the rendering code). Obviously this isn't a contest entry or anything, moreso just something I did as an example/learning template for others. I've attached a zip file that includes the changed files/forms. You'll need to add BGRABitmap to the projects requirements in order to use them, of course.

EDIT: Forgot to change the OpenDialog to be able to recognize non-JPEG images. Ended up just making it an OpenPictureDialog so I wouldn't have to type out every file extension manually, and re-uploaded the zip file.

EDIT (again): Realized I had broken the timing code. Fixed it. Re-uploaded. Everything should work as intended now. Don't drink and code, kids!

EDIT, Part III (Bigger And Editier): posted this below but will post it up here as well. If you're on Windows neither of the following two things are necessary, but if you're on Linux, change line 30 of "uniGraphics.pas" to look like this:

Code: Pascal  [Select][+][-]
  1. {$IFDEF WINDOWS}
  2.   TexCoords: array[0..7] of SmallInt = (0, -1, 1, -1, 1, 0, 0, 0);
  3. {$ELSE}
  4.   TexCoords: array[0..7] of SmallInt = (0, 1, 1, 1, 1, 0, 0, 0);
  5. {$ENDIF}

And at around line 415 of same unit, in the "CreateOpenGLTexture" function, change it to look like:

Code: Pascal  [Select][+][-]
  1. {$IFDEF WINDOWS}
  2.   glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, TempBitmap.Width, TempBitmap.Height, 0, GL_BGRA, GL_UNSIGNED_BYTE, TempBitmap.Data);
  3. {$ELSE}
  4.   glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, TempBitmap.Width, TempBitmap.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, TempBitmap.Data);
  5. {$ENDIF}

Edit 4/Update: Added the above defines directly to the source. Also completely did away with the use of the fixed-function OpenGL matrix transformation API, replacing it with two "advanced record" types: TMatrix, which can Scale/Rotate/Translate/Multiply itself, and TCamera, which uses a TMatrix internally and uploads the final transformed data from it directly with glLoadMatrixF. Lastly, I changed the array of TBGRABitmaps to simply be an array of filename strings, so that they're only in memory temporarily when being loaded into OpenGL and assigned to the TBitButton glyphs. I've re-attached an updated version of the zip file with all of these changes, of course. Probably done playing around with the source for now, although I might re-visit it later.

Edit 5: Made a few more refinements/fixes/changes... All of the rendering functionality is now wrapped in advanced records (TSlideShowRenderer and TSlideShowConstants, as well as the previously mentioned TMatrix and TCamera) to allow for a nice object-oriented user/programmer experience. I also added RibbonRight and RibbonDown transitions, as it seemed like something was missing with only RibbonLeft and RibbonUp. Re-uploaded the zip file. Really done now!

Edit 6: Finished up a rough/naive take at merging the features from Handoko's latest version with my modified one. It includes all of the transition types as well as the same ability to load an infinite number of slides. I didn't get around to adapting the more extraneous features such as the slide re-ordering yet, though. Also, the TOpenGLControl now has a TSplitter on both the side and bottom, so you can resize it freely within the form. New zip file is attached.

Edit 7: My version now has all of the same right-click popup-menu-based slide reordering and removal functionality that Handoko's last update did. More interestingly/importantly, I also implemented the ability to save and load your slide/transition lineups to and from file, which Handoko had said was an intended feature. This is accessed through a standard "File" menu at the top of the form. Apart from that, I reworked the way I implemented some of the transitions a little bit as I realized I had caused weird scaling problems in certain edge cases. Again, I've attached a new zip file.
« Last Edit: September 17, 2017, 11:05:48 pm by Akira1364 »

Handoko

  • Hero Member
  • *****
  • Posts: 5486
  • My goal: build my own game engine using Lazarus
Re: Graphics Contest 2017, please vote now!
« Reply #247 on: August 07, 2017, 04:29:51 am »
Yes, it works. Thank you for the improvement. But it did not work correctly. The image flipped upside down.
« Last Edit: August 07, 2017, 04:31:49 am by Handoko »

Akira1364

  • Hero Member
  • *****
  • Posts: 563
Re: Graphics Contest 2017, please vote now!
« Reply #248 on: August 07, 2017, 04:43:12 am »
Can you upload the image that was displaying upside-down? Would be interested in testing it... by default BGRA-format images will in fact display upside down when loaded into OpenGL, so I simply inverted your original texture coordinates (which were presumably intended for RGBA), and that was enough to have them display JPEG, PNG, BMP, TGA, GIF and other files correctly for me (on Windows, at least.) Obviously you're on Linux, so there might be something additional going on there that isn't going on on Windows. Either way it's probably an easy fix!
« Last Edit: August 07, 2017, 04:58:15 am by Akira1364 »

Handoko

  • Hero Member
  • *****
  • Posts: 5486
  • My goal: build my own game engine using Lazarus
Re: Graphics Contest 2017, please vote now!
« Reply #249 on: August 07, 2017, 04:56:32 am »
I tested several images (*.tif, png, jpg), all of them are upside down. Also the color blue became pale orange as you can see the logo of Lazarus below. Tested on Lazarus 1.6.4 64-bit BGRABitmap 9.5 Ubuntu Mate 16.10.

Previously, my code called BGRAtoRGBA procedure to fix the color issue.

Akira1364

  • Hero Member
  • *****
  • Posts: 563
Re: Graphics Contest 2017, please vote now!
« Reply #250 on: August 07, 2017, 04:59:02 am »
Figured it out. It seems on Linux, BGRABitmap invokes its own built-in bit-reordering method by default when you load images. At line 30 of "uniGraphics.pas", change it to look like the following:

Code: Pascal  [Select][+][-]
  1. {$IFDEF WINDOWS}
  2.   TexCoords: array[0..7] of SmallInt = (0, -1, 1, -1, 1, 0, 0, 0);
  3. {$ELSE}
  4.   TexCoords: array[0..7] of SmallInt = (0, 1, 1, 1, 1, 0, 0, 0);
  5. {$ENDIF}

And at roughly line 415 of the same unit, in the "CreateOpenGLTexture" function, change it to:

Code: Pascal  [Select][+][-]
  1. {$IFDEF WINDOWS}
  2.   glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, TempBitmap.Width, TempBitmap.Height, 0, GL_BGRA, GL_UNSIGNED_BYTE, TempBitmap.Data);
  3. {$ELSE}
  4.   glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, TempBitmap.Width, TempBitmap.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, TempBitmap.Data);
  5. {$ENDIF}
« Last Edit: August 07, 2017, 05:39:13 am by Akira1364 »

lainz

  • Hero Member
  • *****
  • Posts: 4738
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: Graphics Contest 2017, please vote now!
« Reply #251 on: August 07, 2017, 04:42:44 pm »
sudoku, relogio & duplo6 are the projects more voted (2 votes each). We need more votes to define this!

Eugene Loza

  • Hero Member
  • *****
  • Posts: 729
    • My games in Pascal
Re: Graphics Contest 2017, please vote now!
« Reply #252 on: August 07, 2017, 04:57:07 pm »
I wish I could give two votes, that'd be
"sudoku" by user137
"furiouspaladin" by handoko

still can't decide which one I liked better... It's so hard to make "one-in-all-out" vote...
Thou I couldn't test
"starsfieldshooter" by turrican (can't run)
"educrace" by lulu
yet.
My FOSS games in FreePascal&CastleGameEngine: https://decoherence.itch.io/ (Sources: https://gitlab.com/EugeneLoza)

lainz

  • Hero Member
  • *****
  • Posts: 4738
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: Graphics Contest 2017, please vote now!
« Reply #253 on: August 07, 2017, 05:00:10 pm »
I wish I could give two votes, that'd be
"sudoku" by user137
"furiouspaladin" by handoko

still can't decide which one I liked better... It's so hard to make "one-in-all-out" vote...
Thou I couldn't test
"starsfieldshooter" by turrican (can't run)
"educrace" by lulu
yet.

That's not possible now, I can't edit the poll to accept more than one vote right now, that options was available only when I created the poll.

bylaardt

  • Sr. Member
  • ****
  • Posts: 310
Re: Graphics Contest 2017, please vote now!
« Reply #254 on: August 07, 2017, 05:47:18 pm »
sudoku, relogio & duplo6 are the projects more voted (2 votes each). We need more votes to define this!
I haven't voted yet.
Deadline is september 21, right?
glslideshow and educrace still evolving. Give them some time to finish. Both are nice projects.

 

TinyPortal © 2005-2018