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 199953 times)

J-G

  • Hero Member
  • *****
  • Posts: 953
Re: Graphics Contest 2017, please vote now!
« Reply #315 on: August 21, 2017, 05:14:06 pm »
These three images were grabbed during the run so you can see how the images are all distorted  -  on my system.

Needless to say that the images all display correctly in Photoshop/CorelDRAW! of course.

ChiAn is a very high res (4800 dpi) 8bit image (B & W)  .PNG
Crayon & Waterloo are 300 dpi RGB  .JPG
Dullcisima a 300 dpi .TIF

My main system (Win 7 Ult 64bit) is dual screen (one Portrait, one Landscape) both 1280 x 1024 and the 'problem' shows for both a 32 and 64 bit compile.

My secondary system (Win 7 Pro 32bit) single screen 1920 x 1080 shows just white rectangles  -  this is most likely the fact that the Video card on that is does not support OpenGL - -  I certainly haven't installed OpenGL drivers for it - just testing to cover all bases!
« Last Edit: August 21, 2017, 05:59:56 pm by J-G »
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Graphics Contest 2017, please vote now!
« Reply #316 on: August 21, 2017, 06:34:37 pm »
Thanks for reporting. I'm currently fixing a Win7 computer (I'm a computer technician), so I can test and reproduce some of the issues you mentioned.

1. The mispositioned text
My guess is CR/LF and/or right anchor issue. That is a multiline combo box with right anchoring. Linux's CR/LF is not the same as in Windows.

2. Missing annotation on slider bars
Both the slider bar are TTrackbar.

3. The thumbnails did not look good
On Linux, those thumbnail images look nicer. On Win7, the image sizes are too big, they reach the edges of the buttons.

4. Output image issue
I cannot reproduce the distorted image effects as yours. I tested the program on an old computer with integrated VGA. Most of the transitions worked well, only on some transitions they appeared totally white. I think it is reasonable because those problem transitions are using OpenGL 1.2 commands, which that VGA cannot support.

Lazarus slogan:
"write once, compile anywhere"

Sounds too easy. Yep, it really compiles on other platforms but the results can be unexpected.  :o

Some of the issues above, I believe are the widgeset bugs. Okay, I will try to fix them one-by-one. Give me some days, lets see what I can do.

J-G

  • Hero Member
  • *****
  • Posts: 953
Re: Graphics Contest 2017, please vote now!
« Reply #317 on: August 21, 2017, 07:12:41 pm »
Thanks for reporting.
You're welcome  -  it's what the Contest is about :)

Quote from: Handoko
Some of the issues above, I believe are the widgeset bugs. Okay, I will try to fix them one-by-one. Give me some days, lets see what I can do.
There's no rush as far as I'm concerned.

Another point I had meant to raise before, is that when I open your project (double click .LPI file), Laz opens but doesn't display the uniGraphics.PAS file nor the 'Form'.

To date I haven't been able to view the form (ToggleFormUnitView [F12] is greyed out) and the option to view the Source Editor just brings up an empty window  - - - unless there has been a compile error.

This means that I cannot set break points to step through the code to determine what exactly might be going on.


FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Graphics Contest 2017, please vote now!
« Reply #318 on: August 21, 2017, 07:19:39 pm »
Have you tried to use Project Inspector?

Lazarus main menu > Project > Project Inspector.

J-G

  • Hero Member
  • *****
  • Posts: 953
Re: Graphics Contest 2017, please vote now!
« Reply #319 on: August 21, 2017, 11:47:16 pm »
Have you tried to use Project Inspector?

Lazarus main menu > Project > Project Inspector.
Obviously not :)   -  With my own projects I haven't needed to ferret about in the sub menus a great deal, the source is simply there.

At least I can now do a little more investigation but I still can't see the [Form] which would allow me to adjust the 'ProportionalScaling' tick box - even the Object Inspector is blank so I can't select the component and change the figures manually (rather than in the GUI).
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: Graphics Contest 2017, please vote now!
« Reply #320 on: August 22, 2017, 03:17:31 am »
Have you tried to use Project Inspector?

Lazarus main menu > Project > Project Inspector.
Obviously not :)   -  With my own projects I haven't needed to ferret about in the sub menus a great deal, the source is simply there.

At least I can now do a little more investigation but I still can't see the [Form] which would allow me to adjust the 'ProportionalScaling' tick box - even the Object Inspector is blank so I can't select the component and change the figures manually (rather than in the GUI).

Easy. Go to Project > Forms> Form1 > open that.

Trying to use the images you provided, the error is on this line:

GraphType:
  // allocate some space
  ADst.CreateData(False);     

So basically there's no enough RAM or Video card RAM.

With other image I get this:

Win32Proc:
    // We cannot trust windows with bmWidthBytes. Use SrcLineBytes which takes
    // DWORD alignment into consideration
    with AWinBmp do
      Result := CopyImageData(bmWidth, bmHeight, SrcLineBytes, bmBitsPixel, bmBits, ARect, SrcLineOrder, ALineOrder, ALineEnd, AData, ADataSize);
    Exit;   

And with other images just the same as you, distorted.


Lulu

  • Full Member
  • ***
  • Posts: 226
Re: Graphics Contest 2017, please vote now!
« Reply #321 on: August 22, 2017, 11:45:16 am »
Hello, I'm not a specialist in OpenGL. In my search about it, I learned that texture size are limited by video card.
You can retrieve the max texture size that the video card can support with:
Code: Pascal  [Select][+][-]
  1. var MaxTexSize: GLInt;
  2. ...
  3. glGetIntegerv(GL_MAX_TEXTURE_SIZE, @MaxTexSize);
  4.  

wishing you a nice life

J-G

  • Hero Member
  • *****
  • Posts: 953
Re: Graphics Contest 2017, please vote now!
« Reply #322 on: August 22, 2017, 12:24:55 pm »
... but I still can't see the [Form] which would allow me to adjust the 'ProportionalScaling' tick box - even the Object Inspector is blank so I can't select the component and change the figures manually (rather than in the GUI).
Easy. Go to Project > Forms> Form1 > open that.
Duh!!  There is so much more to learn once you've got past adding a component :)

Once the form is [Open] of course the object inspector is populated.
Quote from: lainz
Trying to use the images you provided, the error is on this line:

GraphType:
  // allocate some space
  ADst.CreateData(False);     

So basically there's not enough RAM or Video card RAM.
I said that I have a  >:D'destructive streak' >:D  -  since I often want to make a large (A3+) physical print of some of my photographs I do have very large files - this past week I've scanned some new 6x7 slides at 6400 dpi creating files over 600Mb  :o
The three colour files I selected at random are only 1.5, 2 and 3Mb so I'm a little surprised that they cause a 'Memory' problem.

My 9500GT card has 1Gb dedicated RAM.

I must admit that I have become somewhat cavalier over file size since the idea of more that 64Mb of RAM was inconceivable when I bought my 'Nascom' in 1980 :)  and now I'm getting by with 4Gb and 1.2Tb of Drive space. My grandson has a PC with 24Gb and 5Tb !
 
As Lulu has just posted - it might be possible to test for 'oversize' prior to display - better still at browse-selection time - and re-sample the image accordingly . . .  or post a message to say the image is too large.

Quote from: lainz
With other image I get this:

Win32Proc:
    // We cannot trust windows with bmWidthBytes. Use SrcLineBytes which takes
    // DWORD alignment into consideration
    with AWinBmp do
      Result := CopyImageData(bmWidth, bmHeight, SrcLineBytes, bmBitsPixel, bmBits, ARect, SrcLineOrder, ALineOrder, ALineEnd, AData, ADataSize);
    Exit;   

And with other images just the same as you, distorted.
« Last Edit: August 22, 2017, 12:31:35 pm by J-G »
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

J-G

  • Hero Member
  • *****
  • Posts: 953
Re: Graphics Contest 2017, please vote now!
« Reply #323 on: August 22, 2017, 03:17:58 pm »
@ Handoko

Now I can see the code and can 'step through' I've just come across a small issue at Line 512 in frmMain :
Code: Pascal  [Select][+][-]
  1.     Button.Tag           := Int64(Slide);
When I set the target to 32bit this gives a warning :
Conversion between ordinals and pointers is not portable

changing it to Int32(Slide) removes it of course.

I don't know what effect making the change might have but it might be worth determining what the target is prior to the .Tag assignment.
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

Akira1364

  • Hero Member
  • *****
  • Posts: 561
Re: Graphics Contest 2017, please vote now!
« Reply #324 on: August 22, 2017, 06:16:15 pm »
Just played around with Handoko's latest update, and initially had the same distortion/flickering/black screen issue as J-G when loading large images. I was quite certain that it wasn't a problem with my GPU (as it has 8GB vram!) and figured out pretty quickly that it's caused by the following part of TForm1.LoadImageClick (which gets called if the source image is larger than the users monitor):

Code: Pascal  [Select][+][-]
  1. with Image.Picture.Bitmap do
  2.   if (Width > Screen.Width) or (Height > Screen.Height) then
  3.     gls_ScaleDown(Screen.Width, Screen.Height, Image.Picture.Bitmap);

Scaling the actual loaded TBitmap at this point is completely unnecessary and interferes with the calculations in the (correct) OpenGL matrix scaling that happens later on in the DrawScene procedure. It's important to keep in mind that the way OpenGL renders textures has absolutely nothing to do with the size of the original source image. It's entirely dependent on the provided vertex coordinates, the provided texture coordinates, and the coordinates of the current matrix. You can load a texture with an original size of 8192 x 8192 and it will fit on the screen just fine as long as you remember to scale the matrix appropriately, based on the size of the viewport.

Comment out that part of the procedure, and you should have no problems with images of any size.
« Last Edit: August 22, 2017, 06:26:31 pm by Akira1364 »

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Graphics Contest 2017, please vote now!
« Reply #325 on: August 22, 2017, 06:24:44 pm »
Have to merge it with your code? I really like your code, lots of things for me to learn. I've been playing with graphics programming since I was a kid, but OpenGL is relatively new to me.

And I'm sorry with my misunderstanding that I think your code requires newer version of OpenGL to run. I searched the web about vertex array and I got the result of vertex array object, which I thought is the thing you're doing.

Akira1364

  • Hero Member
  • *****
  • Posts: 561
Re: Graphics Contest 2017, please vote now!
« Reply #326 on: August 22, 2017, 06:52:16 pm »
I really like your code, lots of things for me to learn.

Thanks! Like I said before, the whole reason I did it in the first place was basically as a bit of an example for any users here who might be interested in learning OpenGL beyond the absolute base-level early-90's immediate mode stuff.

And I'm sorry with my misunderstanding that I think your code requires newer version of OpenGL to run. I searched the web about vertex array and I got the result of vertex array object, which I thought is the thing you're doing.

Haha, no worries. To be honest, a lot of the way things are named in OpenGL is kind of silly and not very self-explanatory, and can definitely be confusing if you're not especially familiar with it all.
« Last Edit: August 22, 2017, 10:25:21 pm by Akira1364 »

Lulu

  • Full Member
  • ***
  • Posts: 226
Re: Graphics Contest 2017, please vote now!
« Reply #327 on: August 23, 2017, 09:38:45 pm »
Hello :)

I made some changes on Educ'Race and now, it (normally) runs without sound if OpenAL library is not installed.
Could someone try to compile it on Linux and/or Mac please ?
You need this two package:

- BGRABitmapPack ( in BGRABitmap library->bgrabitmappack.lpk )
- LazOpenGLContext ( in Lazarus folder->components->opengl->lazopenglcontext.lpk )

Thanks to test it.

Here the link to download the source (12Mb)
www.lulutech.fr/EducRace/EducRaceSrc.7z
wishing you a nice life

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Graphics Contest 2017, please vote now!
« Reply #328 on: August 24, 2017, 08:24:48 am »
Tested on Lazarus 1.6.4 64-bit on Ubuntu Mate with GeForce 430 VGA machine and I found 4 issues.

1. OGLCScene.pas line #323 - Missing File
It can be fixed easily by typing the file name correctly. Linux is case sensitive.

2. moto.png - File Not Found
After solving issue #1, the program can be compiled successfully. But failed to start with missing texture problem. I renamed the file moto.PNG to moto.png then it started correctly.

3. Texts Issue
Most of the texts were missing their lower part, see the attachment. Some of them can be shown fully but flipped vertically.

4. Missing File
It's a minor issue, the code is still compilable without need to solve this issue. On the Project Inspector, there is a problem item marked with a red line.
Lazarus main menu > Project > Project Inspector


The audio was playing correctly. Where did you get the background music? It's nice.

---edit---
Issue 5: I just noticed, the textures of the cars are flipped vertically too.
« Last Edit: August 24, 2017, 08:35:59 am by Handoko »

Lulu

  • Full Member
  • ***
  • Posts: 226
Re: Graphics Contest 2017, please vote now!
« Reply #329 on: August 24, 2017, 10:17:32 am »
Thanks Handoko for testing it :)

I fixed the case sensitive issues and obsolete file missing in project inspector.

On your screenshoot, sprites are vertically inverted and the color are not respected.
It seems that red green blue components are swapped, but alpha channel is keeped at the right place.
For the inverted sprite, may be there is a issue in vertex order ? I will take a look on your glSlideshow and compare with my code.

I wrote the music with Reason 3.0 for a puppet show  :D
wishing you a nice life

 

TinyPortal © 2005-2018