stonesense icon indicating copy to clipboard operation
stonesense copied to clipboard

Add OpenGL Support to Overlay Mode

Open KevinCathcart opened this issue 10 years ago • 6 comments

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.

KevinCathcart avatar Jul 13 '14 00:07 KevinCathcart

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?

PeridexisErrant avatar Jul 14 '14 09:07 PeridexisErrant

@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.

KevinCathcart avatar Jul 15 '14 03:07 KevinCathcart

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.

RosaryMala avatar Jul 15 '14 04:07 RosaryMala

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. :smile:

KevinCathcart avatar Jul 15 '14 04:07 KevinCathcart

@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 caf01fa6dcc287b3e1cec70367e2a5b0e974dfb3), 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.

lethosor avatar May 13 '15 17:05 lethosor

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

myk002 avatar Jun 10 '22 19:06 myk002