MrRendroc / gldirect

Updating the open source GLDirect v5, a Direct3D Device Driver for Mesa
14 stars 1 forks source link

Fog still not appearing in games #1

Closed MrRendroc closed 1 year ago

MrRendroc commented 1 year ago

Fog is not appearing in MOHAA and other games. This has been a problem since gldirect 5.0 was released.
I have compiled this Direct3D device driver using VS 2022, and it works the same as the 2007 release. Still no fog. I was unable to track down anything that was missing or not enabled. @mohabhassan do you have any suggestions for how to enable fog and/or any other extensions?

mohabhassan commented 1 year ago

Not sure how'd you know I'm the one with that fix. Yes, fog support is inside the gldirect codebase but it was a simple boolean enable flag iirc that makes fog work in Mohaa and similar games.

MrRendroc commented 1 year ago

Thanks for responding! I found your post on the x-null forum but the website you posted the fix on is no longer valid so I thought I'd try to fix it myself.

I've been looking around for anywhere the ctx->Fog gets enabled but couldn't find anything that affected it. The Mesa code has this: { OFF, "GL_EXT_fog_coord", F(EXT_fog_coord) }, I think it gets enabled later but to be sure I added it to the enabled extensions list anyway.
const char *gld_enable_extensions[] = { "GL_EXT_texture_env_add", // Quake 3 "GL_ARB_texture_env_add", // Quake 3 "GL_EXT_fog_coord", ...but still no fog. I compiled and used the Debug version and it's outputting HLSL with fog calculations in it, but since I'm not seeing it in the game I keep digging.

Should I be looking for another/different extension? Is it something other than GL_EXT_fog_coord that I should be looking at, or some other part of the code?

I will take your word for a simple boolean, I am just having a tough time finding which one will do the trick. Thanks again!

MrRendroc commented 1 year ago

It was hard to find because it didn't look like it had anything to do with the fog. It was a commented-out section in gld5_shaders.c that had to do with SM 3.x / DX 9.0b.

mohabhassan commented 1 year ago

Glad I could be of help! Great work.