Author Topic: OpenGL renderer for Windows  (Read 539 times)  Share 

Crimson Wizard

  • Local Moderator
  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
OpenGL renderer for Windows
« on: 10 May 2017, 23:24 »
I finally seem to make OpenGL work in any display mode under Windows:
http://www.mediafire.com/file/9gm6xt1d88xt45k/acwin-3.4.1-opengl.zip
http://www.mediafire.com/file/vh847jgpeqt6wq7/acwin-3.4.1-opengl2.zip
http://www.mediafire.com/file/5qsa7vi6d1ra27e/acwin-3.4.1-opengl3.zip


"OpenGL" should be available in drivers list in winsetup.

I believe understand making scenes in 3D better now... and also learnt that with 3D it is so much easier to do a lot of unnecessary and duplicating operations, with coordinate translations and camera positioning countering each other. Until you change something you do not notice that.


If I can find time, I may try to make it work on Linux too, because Linux port was suffering from lack of hardware-accelerated renderer all those years.
« Last Edit: 18 May 2017, 17:50 by Crimson Wizard »

abstauber

  • Cavefish
  • Mittens Knight
  • still mowing the lawn
  • abstauber worked on a game that was nominated for an AGS Award!abstauber worked on a game that won an AGS Award!
Re: OpenGL renderer for Windows
« Reply #1 on: 11 May 2017, 07:42 »
Great news! At a first glance, it seems to run just fine.

Gurok

  • Rottwheelers
  • When life hands you lemons, combine them with the mop
    • I can help with AGS tutoring
    •  
    • Best Innovation Award Winner 2016, for improving and extending the AGS scripting language
    •  
    • I can help with proof reading
    •  
    • I can help with scripting
    •  
  • Gurok worked on a game that was nominated for an AGS Award!Gurok worked on a game that won an AGS Award!
Re: OpenGL renderer for Windows
« Reply #2 on: 11 May 2017, 14:32 »
This is really amazing, CW. I'm very impressed. REALLY amazing. Possibly solves a bunch of video card compatibility problems. I want to stress this before I tell you all the weird things I came across.

Some of my notes:
 - The very first time I used it, OpenGL blanked the whole screen for a split second even though I chose to run the game windowed. I wasn't able to replicate this afterwards
 - When running a 320x200 game, I cannot select my native resolution for full screen (1920x1200). The highest resolution listed is 1920x1080. The native resolution used to be listed at the top as Desktop Resolution. Running in a window and choosing to stretch to fit screen lists 1920x1138, which is the desktop work area. This seems correct though, as it's windowed
 - I chose to run in OpenGL at 640x480, full screen. Any time there was a screenshot overlaid (my game uses screenshots a lot), the screenshot appeared vertically squished. In windowed-mode, screenshots were slightly distorted (maybe off by one pixel), but otherwise displayed correctly (aspect ratio was fine)
 - Alt+tabbing out of a full-screen OpenGL game leaves me with the game running in a borderless window on my desktop. Alt+tabbing back in restores the borderless window to its full screen glory -- http://i.imgur.com/hzHgjKJ.jpg
 - Alt+Enter from OpenGL full screen gives me a blank window (no output). This breaks OpenGL completely. Alt+Enter again will give me a full-screen display of white
    o Note: I'm guessing you just haven't implemented Alt+Enter support for this driver
 - In OpenGL windowed or full screen, there is a line of distortion running down the centre of the screen. One of the centre columns is duplicated (seen here on the left of the mouse cursor where there's a double-width line)

 - Or here again, with the shape of the "o" and "Y" in the prompt:

 - The same is true vertically, see "Load Game":

 - In OpenGL full screen, there is a standard Windows cursor visible in the letterbox portion of the screen
 - Why is DirectX 5 called Allegro/DX5? Don't Direct3D and DirectX 5 both use Allegro (audio, keyboard, etc.)? I don't want to get into bikeshedding, but the old name was fine by me

Again, I am very much impressed with how well it all works. Please keep going! I would love to help, but it isn't really my area of expertise.
« Last Edit: 11 May 2017, 14:49 by Gurok »

Crimson Wizard

  • Local Moderator
  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
Re: OpenGL renderer for Windows
« Reply #3 on: 11 May 2017, 16:47 »
- When running a 320x200 game, I cannot select my native resolution for full screen (1920x1200). The highest resolution listed is 1920x1080. The native resolution used to be listed at the top as Desktop Resolution.

This seem to be a winsetup issue in recent 3.4.1 Beta, also reported here:
http://www.adventuregamestudio.co.uk/forums/index.php?topic=54681.msg636560801#msg636560801

arj0n

  • Mittens Vassal
  • why do meteors always land in craters?
  • arj0n worked on a game that was nominated for an AGS Award!
Re: OpenGL renderer for Windows
« Reply #4 on: 11 May 2017, 20:35 »
Great job, CW!

Scavenger

  • Cavefish
  • In Four Glorious Colours!
    • I can help with animation
    •  
    • I can help with backgrounds
    •  
    • I can help with characters
    •  
    • I can help with scripting
    •  
  • Scavenger worked on a game that was nominated for an AGS Award!Scavenger worked on a game that won an AGS Award!
Re: OpenGL renderer for Windows
« Reply #5 on: 15 May 2017, 11:04 »
I tried it out with one of my games, it worked better than I expected it to! There were a lot of bugs, however.

  • LightLevels don't work at all.
  • Palette colour 0 never works as a walkbehind colour, regardless what the mask says. It is always drawn behind characters.
  • FLCs don't play at all.
  • Changing the palette ends up with weirdly discoloured sprites sometimes, no effect at others: I believe this room fades the palette to white.
  • If additional background frames have a different palette to the main background frame, it doesn't get changed, like so
  • Any colours addressing palette slots is miscoloured, like this text box and this dynamic sprite box (the floor should be purple, I literally just cleared a sprite to that colour)
  • As expected, changing a palette slot's colour doesn't work correctly, but... it did seem to work for some things. It's inconsistent.

Crimson Wizard

  • Local Moderator
  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
Re: OpenGL renderer for Windows
« Reply #6 on: 15 May 2017, 13:02 »
I tried it out with one of my games, it worked better than I expected it to! There were a lot of bugs, however.

8-bit games won't work properly with OpenGL or Direct3D yet; the fact that they run with OpenGL now is a fortunate side effect of another fix.
I believe there may be ways to deal with all those problems, but they are not my priority for the nearest release (unless someone else makes necessary fixes in time).

One thing though, FLC playback is currently broken in general, but that's related to updating AGS to Allegro 4.4.2. I am currently working on the fix.
« Last Edit: 15 May 2017, 13:44 by Crimson Wizard »

Crimson Wizard

  • Local Moderator
  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
Re: OpenGL renderer for Windows
« Reply #7 on: 16 May 2017, 23:05 »
For the reference, I made this game that displays room with 1-pixel wide boundaries and random straight lines across the screen to test pixel distortion and other similar issues:
https://www.dropbox.com/s/e6pzj2dlk8malsg/test_precisesize.zip?dl=0

Crimson Wizard

  • Local Moderator
  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
Re: OpenGL renderer for Windows
« Reply #8 on: 17 May 2017, 18:56 »
Uploaded new version:
http://www.mediafire.com/file/vh847jgpeqt6wq7/acwin-3.4.1-opengl2.zip

What has changed:
- Fixed mode switch; (mode reinitialization was breaking all sprites)
- Fixed pixel distortion, and missing rightmost and topmost pixel rows (OpenGL);
- Restored FLIC playback functionality (at least on Windows for now).

Regarding FLIC, I found out that it runs about double speed compared to software renderer (DD5). I know nothing about how it works, so ignore that for now... but what if its speed relies on speed of rendering too? That would not be easy to fix.

Other known issues:
- Direct3D misses bottom and rightmost pixel rows when rendering is done to texture (as opposed to "Render sprites at screen resolution" mode). I could not yet find the reason of this, but suspect is may have something to do with uneven scaling or floating point number mistakes when texture is stretched to screen (not sure). Curiously, if texture is made double size, this mistake goes away, but that would defeat the purpose of this mode.
- Alt+tabbing from OpenGL fullscreen makes OpenGL window stay. ... I just realized that could be because I do not remove "TOPMOST" window flag. I will look into this again.
- System cursor visible on black borders even in fullscreen mode. That is simply because OpenGL does not have "real" fullscreen mode, but renders on borderless window stretched to whole screen. Frankly IDK how to fix this. I tried ShowCursor(FALSE) on Windows, but that just did not work (that's an old API anyway).
- Something bad with screenshots, as reported by Gurok. Have not looked into that yet.
« Last Edit: 17 May 2017, 18:58 by Crimson Wizard »

Snarky

  • Local Moderator
  • Mittens Earl
  • Private Insultant
    • I can help with proof reading
    •  
    • I can help with translating
    •  
Re: OpenGL renderer for Windows
« Reply #9 on: 18 May 2017, 10:28 »
- System cursor visible on black borders even in fullscreen mode. That is simply because OpenGL does not have "real" fullscreen mode, but renders on borderless window stretched to whole screen. Frankly IDK how to fix this. I tried ShowCursor(FALSE) on Windows, but that just did not work (that's an old API anyway).

Can you avoid the issue by clamping the cursor position to the game region of the screen, like it would be in "real" fullscreen?

tzachs

  • AGS Baker
  • Mittens Vassal
  • Parking Goat- games that goats like!
    • I can help with translating
    •  
  • tzachs worked on a game that was nominated for an AGS Award!
Re: OpenGL renderer for Windows
« Reply #10 on: 18 May 2017, 14:48 »
- System cursor visible on black borders even in fullscreen mode. That is simply because OpenGL does not have "real" fullscreen mode, but renders on borderless window stretched to whole screen. Frankly IDK how to fix this. I tried ShowCursor(FALSE) on Windows, but that just did not work (that's an old API anyway).

I don't think this is true, actually. OpenGL does not control the window as far as I understand, you control the window yourself (or with a library). You can see in my engine, for example, I use OpenGL on Windows and I support both modes.
As for hiding the cursor, I believe the library I use (OpenTK) just sets an empty bitmap as the cursor.

Crimson Wizard

  • Local Moderator
  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
Re: OpenGL renderer for Windows
« Reply #11 on: 18 May 2017, 15:17 »
- System cursor visible on black borders even in fullscreen mode. That is simply because OpenGL does not have "real" fullscreen mode, but renders on borderless window stretched to whole screen. Frankly IDK how to fix this. I tried ShowCursor(FALSE) on Windows, but that just did not work (that's an old API anyway).

I don't think this is true, actually. OpenGL does not control the window as far as I understand, you control the window yourself

Well, this is what I meant. Probably worded it wrongly. I am creating the window myself, and modifying its style myself too.
« Last Edit: 18 May 2017, 15:19 by Crimson Wizard »

Crimson Wizard

  • Local Moderator
  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
Re: OpenGL renderer for Windows
« Reply #12 on: 18 May 2017, 17:50 »
Another update:
http://www.mediafire.com/file/5qsa7vi6d1ra27e/acwin-3.4.1-opengl3.zip

- Fixed screenshots not working (probably);
- Hide OpenGL window when tabbing out of fullscreen.


NicolaGs

  • Going nowhere fast
Re: OpenGL renderer for Windows
« Reply #13 on: 18 May 2017, 21:08 »
The issue I reported in the latest beta thread about missing resolutions is fixed ! :)