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

J-G

  • Hero Member
  • *****
  • Posts: 953
Re: Graphics Contest 2017, please vote now!
« Reply #390 on: September 09, 2017, 11:03:12 am »
That is a rather uncommon setup... 6-core AMD Vishera CPU with a graphics card from 2008?
I'm of the opinion that 'if it ain't broke, don't fix it' and when I last needed to upgrade my system, the Video card did all that I asked of it so didn't need replacing. All of the images I've provided have been created/modified in either Photoshop (V7) or CorelDRAW! X5 without issue and I am running the latest drivers (updated due to the OpenGL issues raised).
Quote from: Akira1364
One thing I should clarify though is, are you building the application as a 32-bit or 64-bit executable? If you're building it 32-bit, I'd strongly recommend trying 64, as 64-bit GPU drivers running under 64-bit operating systems are not optimized for 32-bit applications and tend to have a higher number of issues/bugs while running them.
That's an interesting point and I've just done a test compile as a 32bit version -  it threw up 190 warnings and 1 hint, but did compile. Running it was 'painful' - it took about 3 times as long to load any image and didn't solve the 'thumbnail OK but no-show' nor the 'thumbnail non-load' problems - I wouldn't have expected it to really but in the interests of testing....
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 #391 on: September 09, 2017, 02:36:02 pm »
So, you were building it 64-bit to begin with, then? You realize I said "if you're building it 32-bit, try 64", not the other way around? Haha.
« Last Edit: September 09, 2017, 02:39:41 pm by Akira1364 »

J-G

  • Hero Member
  • *****
  • Posts: 953
Re: Graphics Contest 2017, please vote now!
« Reply #392 on: September 09, 2017, 05:21:03 pm »
So, you were building it 64-bit to begin with, then? You realize I said "if you're building it 32-bit, try 64", not the other way around? Haha.
I understood that Akira, I was simply being thorough in testing all possible scenarios.
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 #393 on: September 09, 2017, 07:28:47 pm »
So, you were building it 64-bit to begin with, then? You realize I said "if you're building it 32-bit, try 64", not the other way around? Haha.
I understood that Akira, I was simply being thorough in testing all possible scenarios.

Fair enough. I just thought you might have misread what I said. On a more general note though, there is pretty much no situation where a 32-bit executable will ever perform better than a 64-bit executable on a 64-bit operating system...

Also, one thing we haven't tried yet with regards to your issues is debugging OpenGL itself, which is easier than you might think!

First, download and install the 64-bit version of the GLIntercept logging utility from here:
https://github.com/dtrebilco/glintercept/releases/download/1.3.4/GLInterceptx64_1_3_4.exe
 
Then go to the folder where it was installed (which by default will be C:\Program Files\GLInterceptx64_1_3_4) and copy and paste both "gliConfig.ini" and "OpenGL32.dll" from there into the folder where your 64-bit glSlideShow executable is located. The DLL is a customized debug version which hooks into any application that looks for one by that name (as glSlideShow obviously does) and will generate two log files when the application is closed: "gliInterceptLog.txt" and "gliLog.txt".

So if you run the application, attempt to load and play the slideshow with a few of the images that have not worked for you, and then post the two log files as attachments here it's likely I'll be able to get a good idea of what exactly the problem is.
« Last Edit: September 10, 2017, 02:54:05 am by Akira1364 »

J-G

  • Hero Member
  • *****
  • Posts: 953
Re: Graphics Contest 2017, please vote now!
« Reply #394 on: September 10, 2017, 10:41:29 am »
Also, one thing we haven't tried yet with regards to your issues is debugging OpenGL itself, which is easier than you might think!
With your clear instruction - yes it is! :)

Two .TXT files uploaded to www.crescentcomputing.co.uk/laz/akira since gliInterceptLog.txt is 2252Kb and the attachment limit is 250Kb !

This is the result of loading Chi An, snowflake BW and Beach. All three do appear in the thumbnail but only snowflake displays in the slide show.



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 #395 on: September 10, 2017, 06:02:49 pm »
Ok, so as I suspected the failures are happening when the application calls glTexImage2D in the "TSlideShowRenderer.CreateOpenGLTexture" method.

Line 134 of gliInterceptLog.txt:

Code: Pascal  [Select][+][-]
  1. glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA8,9351,4472,0,GL_BGRA,GL_UNSIGNED_BYTE,0000000021DC0000) glGetError() = GL_INVALID_VALUE

Line 234 of gliInterceptLog.txt:

Code: Pascal  [Select][+][-]
  1. glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA8,8297,5290,0,GL_BGRA,GL_UNSIGNED_BYTE,0000000030840000) glGetError() = GL_INVALID_VALUE

A GL_INVALID_VALUE result from glTexImage2D can mean quite a few different things, the relevant one here being that the width or height of the source image is greater than GL_MAX_TEXTURE_SIZE (which varies from GPU to GPU and is exactly what it sounds like, I.E. the maximum supported size in any direction of an OpenGL texture.)

I did a bit of research and it appears that on the Geforce 9500 GT, GL_MAX_TEXTURE_SIZE is 8192. So the first image (which I believe is "Chi An.png") has a width dimension that is 1159 greater than the maximum your GPU supports, and the second one (which I believe is "Beach.png") has a width dimension that is just 105 greater than the maximum.

As to why the TBitBtn thumbnails still work: it's because that part of the application is of course not using OpenGL, just normal software images that only make use of your main system memory. The exact order in which things happen is:

1) An image is loaded from file into a TBGRABitmap.

2) A calculation is done to figure out the necessary "thumbnail size" dimensions based on the width and height of the original image, and a second much smaller TBGRABitmap is generated by calling TBGRABitmap.Resample from the first one with those dimensions.

3) The second smaller TBGRABitmap has its data assigned to the glyph of the next empty TBitBtn, and is then freed.

4) An OpenGL texture is generated from the data of the original full-size TBGRABitmap. The original TBGRABitmap is then also freed.

So overall, there is unfortunately not going to be any way for you to use the very largest of your images in glSlideShow or any other OpenGL application with your current hardware.

I will point out though that GPUs are significantly less expensive in general than they used to be.... For example, you can get a Geforce GTX 1050 Ti for just $200 Canadian (which works out to around £125, since you seem to be from the UK) with 4 gigabytes of GDDR5 memory and a base clock speed of 1290 to 1300 mhz depending on the manufacturer. That is, for comparison, four times as much memory (and it's a much faster type of memory) than the Geforce 9500 GT, and a clock speed that's a little over twice as fast. There's also a variety of other benefits such as full support for modern OpenGL/DirectX/Vulkan specifications, and so on and so forth. GL_MAX_TEXTURE_SIZE is 32768 on all GTX 10 series cards.
« Last Edit: September 10, 2017, 06:47:48 pm by Akira1364 »

J-G

  • Hero Member
  • *****
  • Posts: 953
Re: Graphics Contest 2017, please vote now!
« Reply #396 on: September 10, 2017, 07:49:20 pm »
Well at least you've found a reason  :)   and many thanks for taking the trouble to do the research.   Though it doesn't address the fact that the 3-4.tif image at 10 x 29 px won't load even the thumbnail ????

You couldn't know, Akira, but I am very familiar with the costs of current graphics cards - I specify and build bespoke systems  :D  -  Your estimates don't take account of the fact that we (in the UK) don't get a true dollar conversion rate though, there is always an extra loading simply because the market will stand it :(

GTX 1050 Ti cards with 4Gb are in the range of £170 - £210  - I would of course not pay that much because I buy at 'trade' anyway - but the cost of a new card is not the only consideration.

First - for my real needs, what I have does the job very well, all the images I've put forward display in the two main programs that I use.

Second - I have a pair of ANALOGUE monitors which are perfectly adequate for my needs and all but two of the cards I've researched this afternoon have only one DVI-D connector, though admittedly they also have HDMI which could be converted to VGA if I really wanted to think about changing. And of course the two cards with 2 DVI-D connectors can't be converted to VGA anyway.

This Graphics Contest has been very interesting and thrown up issues that I hadn't previously considered. Most of my customers are home users or very light-weight 'office' with just the occasional 'Music' buff or 'Print Shop'. I did have one 'Video Editor' who was happy to pay for a very high end Matrox Card but he still owes me so I no longer support him  :o
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 #397 on: September 10, 2017, 10:06:08 pm »
Well at least you've found a reason  :)   and many thanks for taking the trouble to do the research.   Though it doesn't address the fact that the 3-4.tif image at 10 x 29 px won't load even the thumbnail ????

No problem!

As far as "3-4.tif" specifically, it definitely has nothing to do with OpenGL if the TBitBtn thumbnail isn't even showing for you, as the procedure is exited immediately if the initial TBGRABitmap fails to load meaning there's no OpenGL texture being created at all.

Again, I was able to use 3-4.tif myself with no issues (as shown in the screenshot I posted before), so the application code as currently written definitely does exactly what it's supposed to. I imagine the problem in your case likely has something to do with an internal difference somewhere in the sources of either the FPC RTL or the Lazarus LCL between the versions you're using and more recent ones.

What I think I might do is alter the loading routine a little bit so that it at least shows a message box containing information about what went wrong in the event of an error (while still not raising a "fatal" exception, as I think it's silly to make a user think they need to close the application just because one image fails to load, and there's no good reason to do so anyways as the code is already written to still properly free any memory allocated by the procedure in that case.)

For now though, you could simply try building the Debug profile of the Lazarus project, and running the application under GDB through Lazarus to see if you can get any more specific information about the problem.

GTX 1050 Ti cards with 4Gb are in the range of £170 - £210  - I would of course not pay that much because I buy at 'trade' anyway - but the cost of a new card is not the only consideration.

Oh yeah, I know it's not exactly going to be a direct price conversion. I was just giving a rough estimate, and the card was just one example... you could even go as far back as something from the 700 series (circa 2013 or so) and be in great shape. Although if you're able to get everything for trade/vendor costs or close to them anyways, I would think you could have your pick of most of what's currently available without breaking the bank.

First - for my real needs, what I have does the job very well, all the images I've put forward display in the two main programs that I use.

I don't doubt that at all, but it's important to keep in mind the difference between software rendering and hardware rendering, and what the use cases for each of them are.

I'm assuming the programs you're referencing here are CorelDraw and Photoshop, which you mentioned previously, both of which do everything at the software level (meaning using system RAM and your CPU, not the graphics card). This makes perfect sense as neither of them have any need to be able to render complex animations at high speed, and for the most part are displaying entirely static windows, so they make use of the (higher in essentially all cases than the GPU) amount of system RAM to get even the largest images on the screen for editing. As such, your graphics card while using those applications is not doing much more than driving the output to your monitor.

An application like glSlideShow, however, would simply not be able to smoothly render the rapidly changing animated frames at an acceptable speed if it was implemented at the software level. (As in, for example, if the rendering itself was done via BGRABitmaps built in drawing methods as opposed to just using BGRABitmap as a way to get images uploaded to the graphics card for use with OpenGL.)

This would of course be due to the latency caused by storing images in system memory versus storing them directly in graphics card memory, and by the fact that the result of the (less optimized, non-parallel) CPU-based drawing commands would just be getting interpreted for display at a raw pixel level by the graphics card (instead of being directly executed, generally in parallel, on the graphics card).

The significant boost in speed you get from hardware APIs like OpenGL does come with certain manufacturer-imposed limitations, however (such as the GL_MAX_TEXTURE_SIZE limit you encountered) most of which exist for reasons related to memory management concerns at the GPU level.

You may have already known some or all of that (or not), but I thought I'd post it anyways for anyone else reading the thread who might not understand the differences, haha.

And of course the two cards with 2 DVI-D connectors can't be converted to VGA anyway.

Not sure what you mean here. There's a variety of "active conversion" DVI-D to VGA adapter cables and dongles available from various manufacturers. They're used quite commonly in a lot of office environments to connect to analog VGA-only projectors.
« Last Edit: September 11, 2017, 05:04:57 am by Akira1364 »

Akira1364

  • Hero Member
  • *****
  • Posts: 561
Re: Graphics Contest 2017, please vote now!
« Reply #398 on: September 14, 2017, 03:52:24 am »
Ok, I just uploaded a new set of files, with a few vaguely noteworthy fixes/improvements/additions:

-Added a checkbox that allows you to enable and disable VSync when supported (if the hardware doesn't support it, the checkbox is "greyed out".) The functionality is fully cross platform, using wglSwapIntervalEXT on Windows and glXSwapIntervalSGI on Unix-like systems.

-Fixed a bug where if you used the reordering popup menu to remove a slide from the lineup, and then added a new one, it would cause an access violation. This was the direct result of an oversight on my part, in that I just straight-up forgot to decrement the "Tag" property of the TBitBtns that weren't the one associated with the slide being removed from the lineup, meaning those values went out of range relative to the array that keeps track of them afterwards.

-Replaced the TOpenPictureDialog with a normal TOpenDialog just to ensure that any bugs that may have been being caused on Linux by TOpenPictureDialog won't happen anymore. This should have no effect on usability as I literally just copied and pasted the filters from TOpenPictureDialog.

-Various other little optimizations here and there. One being that the main form itself now only updates its caption when the current slide index changes, as opposed to every frame, as repainting the form bogs down the rendering loop. The main TOpenGLControl also now calls glViewport directly when necessary and longer uses the "AutoResizeViewport" property, as that property leads to wglMakeCurrent/glXMakeCurrent being called WAY more often that it needs to be. (The needed amount being once or twice at most during the entire time the application is running. Certainly not everytime the viewport is resized!) Additionally, I altered the image loading routines to use somewhat more robust/informative error-checking.

Here's the link to where you can download the zip file, once again:
https://forum.lazarus.freepascal.org/index.php/topic,35313.msg255447.html#msg255447

Also, I'm sort of wondering if it's worth me continuing to poke around at this codebase for at least the next little while? I honestly don't mind doing so at all as it's pretty trivial code for the most part and not really what I would consider "work", but if there's not much interest then I'm not sure I see the point.

If you're someone who'd like me to keep working on it let me know, so I at least know you're out there!
« Last Edit: September 14, 2017, 04:39:11 pm by Akira1364 »

J-G

  • Hero Member
  • *****
  • Posts: 953
Re: Graphics Contest 2017, please vote now!
« Reply #399 on: September 15, 2017, 12:39:53 am »
I can tell that you’ve felt abandoned Akira :)    I’ve been out of the loop for a few days on an urgent mechanical design project.

My interest in glslideshow was originally to see how images could be manipulated but it later became an issue about why some images wouldn’t load and later still how my hardware fell short.

I currently have no real need to manipulate images quickly - as in animation - but I am looking at Blender which would change that considerably but I have a number of 'irons-in-the-fire' which may mean that the interest in Blender doesn't get very far!

I’ve just compiled and run your latest incarnation and tried to load the 3-4.tif image which reports ‘Offset outside of stream at position 164' - all the other music time signature files also fail reporting the same error at position 166, 167 or 169. You may understand the meaning of E.message  - I couldn’t possibly comment :)

At least you’ve reminded me of the issue of ‘software’ versus ‘hardware’ rendering. Although I was aware of the difference I hadn’t felt a need to investigate the ‘detail’.

As far as DVI-D to VGA is concerned - again I haven’t needed to look for such an adaptor for some time so was quoting from old memory and we all know that in this industry yesterdays information is history !
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 #400 on: September 15, 2017, 06:26:52 am »
I can tell that you’ve felt abandoned Akira :)    I’ve been out of the loop for a few days on an urgent mechanical design project.

Haha, I wouldn't say abandoned.... When I said "you" in the last post I meant "you" generally as in "you, the person reading this post, who could be anyone." Sorry if you thought it was directed specifically your way. Basically I just meant that there seem to be a lot more people viewing the thread than commenting in it! And it would be nice to have input from as many different people as possible.

I’ve just compiled and run your latest incarnation and tried to load the 3-4.tif image which reports ‘Offset outside of stream at position 164' - all the other music time signature files also fail reporting the same error at position 166, 167 or 169. You may understand the meaning of E.message  - I couldn’t possibly comment :)

I'll have to look into that. Sounds like something from FPReadTiff again...

« Last Edit: September 16, 2017, 03:23:57 am by Akira1364 »

Handoko

  • Hero Member
  • *****
  • Posts: 5150
  • My goal: build my own game engine using Lazarus
Re: Graphics Contest 2017, please vote now!
« Reply #401 on: September 15, 2017, 09:23:30 am »
I would be more interested in smoother animation. Akira, you know a lot in OpenGL, can you please help me solve this issue?

I guess you already know, in my version I do not increase TTimer's Interval to make the animation slower. It increases StepsTotal to make to movement smaller. And that's the problem.

If you set the Moving Speed to the maximum ( =500, see the attached screenshot ), you will notice the image quality is bad. The issue is something similar to antialiasing problem. It will be very noticeable on images that has line pattern with high contrast color (snowflake BW.png).
 
The animation basically is okay. It is texture antialiasing issue. I thought by using 4x multisampling will solve it, but I am wrong.

Do you know how to solve the bad texture resizing quality problem?
« Last Edit: September 15, 2017, 09:34:12 am by Handoko »

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: Graphics Contest 2017, please vote now!
« Reply #402 on: September 15, 2017, 05:54:14 pm »
I think that is about filtering (GL_LINEAR would be one of the smooth options) and perhaps even mipmapping would make it better.

Example of mipmapping: https://textureingraphics.files.wordpress.com/2011/12/mipmap1.png

Handoko

  • Hero Member
  • *****
  • Posts: 5150
  • My goal: build my own game engine using Lazarus
Re: Graphics Contest 2017, please vote now!
« Reply #403 on: September 15, 2017, 06:01:14 pm »
I checked my source code. It's already using GL_LINEAR. The gls_PrepareOpenGLForPainting procedure is in uniGraphics.pas line #181: 

Code: Pascal  [Select][+][-]
  1. procedure gls_PrepareOpenGLForPainting;
  2. begin
  3.   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
  4.   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
  5.   glClearColor(BackgroundR, BackgroundG, BackgroundB, 1);
  6.   glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
  7.   glLoadIdentity;
  8. end;

Did I do something wrong?

Akira1364

  • Hero Member
  • *****
  • Posts: 561
Re: Graphics Contest 2017, please vote now!
« Reply #404 on: September 15, 2017, 11:57:23 pm »
I'll post a detailed explanation about this along with a new upload of my version that includes/demonstrates it when I'm at home in a couple of hours.
« Last Edit: September 16, 2017, 05:01:29 am by Akira1364 »

 

TinyPortal © 2005-2018