Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OpenGL Support to Overlay Mode #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

KevinCathcart
Copy link
Contributor

This pull request add support for using stonesense overlay in OpenGL rendering modes. Standard and VBO modes are supported, and probably some others (untested). Only tested on Windows, although I have no reason to expect issues on other platforms.

The OpenGL code has been successfully tested on my machine, and I expect it to work on most machines, since I only use really old OpenGL fixed-function pipeline features. Basically if windowed stonesense can run with "[RENDERER:OPENGL]" on the machine, this should work too.

Some notes: It is compatible with the multilevel version of the Text Will Be Text plugin. Please don't try to go changing how the the interposing code works without verifying compatibility with TWBT and VBO mode. The regular vtable interpose method will not work. That said don't hesitate to replace the header definition for renderer_opengl with an auto-generated one if from DFHack if one gets added.

This pull request also incorporates the code my previous one (#20) because there is some overlap in changes.

The OpenGL code used is probably substandard, and using a single
GL_TEXTURE_RECTANGLE for the overlay may not be ideal but
it seems to work, although really old graphics cards or
software mode GL may not like it.

There is definately room for improvement by a GL expert.
@PeridexisErrant
Copy link
Contributor

Would it be possible to get a build of this for windows dfhack-r5, to hold us over until the stonesense rewrite is complete and 40.x compatibility comes in?

@KevinCathcart
Copy link
Contributor Author

@PeridexisErrant:

I really don't like providing builds myself, but while Japa is busy getting his approach to conversion fully nailed down I'll provide a build: https://github.com/KevinCathcart/stonesense/releases/tag/OpenGL

You want dist.zip of course. I've included just the stonesense dll as you already have the other files. There are two actually two builds inside, one is a "debug" build, which is what I've done most of my testing with. The release build is smaller, and should work the same, but It has not been as heavily tested.

The build supports 2D modes and the OpenGL modes. It is incompatible with rendermax, although it is only a problem if you have both enabled at the same time. So rendermax users should do "rendermax dsiable" before doing "stonesense overlay", and they should close the stonesense popup window before re-enabling rendermax.

You might want to change the default SEGMENTSIZE_Z up to around 4 or 5, so that you have multilevel visibility in the overlay. Also remeber that this has pixel accurate mouse clicking now, but not every tile can be clicked on. Only those tiles that correspond the the ones hidden by the overlay can be clicked. I'd like to get rid of that limitation, but not quite yet. I want to understand how mouse support for TwbT nextgen will be handled first to avoid reintroducing additional incompatibilities.

@RosaryMala
Copy link
Member

Yeah, I'm working on the conversion, and it'll take another week or so, maybe. At least for the RAW conversion, at any rate. the conversion to an external app will take longer, but I'm doing things to it's still usable in the mean time.

@KevinCathcart
Copy link
Contributor Author

That is good.

Nevertheless I really don't want to put any more work into improving the current overlay when about 98% of the remaining improvements I would want to make will need to be scrapped with the external app conversion, even if we went for in-process overlays.

My interest mostly revolve around making the overlay better. Depending on the sort of timeframe you think the out of process conversion may take, it might be reasonable to merge this pull request as a stopgap after you get the RAW conversion and basic DF2014 support added.

In any case let me know when you have the a mostly working external conversion, and unless I somehow lose interest in DF by that time, I'd be happy to help get the overlay feature reimplemented. In the meantime, I might try some additional reverse engineering of the game, or gasp even actually spend some time playing it. 😄

@lethosor
Copy link
Member

@KevinCathcart This doesn't appear to be possible to merge automatically at the moment, but it looks promising. I've experienced rather nasty issues when using Stonesense with PRINT_MODE:STANDARD (which led to caf01fa), so it would be nice to merge this.
Out of curiosity, what sorts of issues were present in OpenGL print modes on other platforms? If we can't merge this before the next release, it might be a good idea to disable Stonesense in affected print modes on other platforms as well.

@myk002
Copy link
Member

myk002 commented Jun 10, 2022

this looks interesting, but is too complex to dig into right now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants