[prev in list] [next in list] [prev in thread] [next in thread]
List: wine-patches
Subject: Re: [dx40] specular enable
From: Raphaël Junqueira <fenix () club-internet ! fr>
Date: 2003-05-28 21:38:51
[Download RAW message or body]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Le Samedi 24 Mai 2003 17:59, Ann and Jason Edmeades a écrit :
> I've been having some opengl education from Lucho who has indicated to
> me how specular enable was wrong. I have checked his comments against
> all references and they appear correct, and moreover it doesnt break
> anything either, so here's the code.
>
> Changelog
>
> Correct specular enable renderstate
>
> Jason
Update patch for avoiding conflits with dx37->dx39(bis) patches
Raphael
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
iD8DBQE+1Sxrp7NA3AmQTU4RAm/iAJ9/cjCiRJjbAtPCe8bqVMfae6qaDQCfYKVj
MjCLn2ByMABx26Kei813TYg=
=Wqgz
-----END PGP SIGNATURE-----
["dx40.speccolor.bis" (text/plain)]
Les sous-répertoires ../winefree/dlls/d3d8/CVS et dlls/d3d8/CVS sont identiques.
diff -u ../winefree/dlls/d3d8/device.c dlls/d3d8/device.c
--- ../winefree/dlls/d3d8/device.c 2003-05-28 23:31:22.000000000 +0200
+++ dlls/d3d8/device.c 2003-05-28 23:37:26.000000000 +0200
@@ -2429,8 +2429,11 @@
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, (float*) \
&This->UpdateStateBlock->material.Diffuse); checkGLcall("glMaterialfv");
- glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, (float*) \
&This->UpdateStateBlock->material.Specular);
- checkGLcall("glMaterialfv");
+ /* Only change material color if specular is enabled, otherwise it is set to \
black */ + if (This->StateBlock->renderstate[D3DRS_SPECULARENABLE]) {
+ glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, (float*) \
&This->UpdateStateBlock->material.Specular); + checkGLcall("glMaterialfv");
+ }
glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, (float*) \
&This->UpdateStateBlock->material.Emissive); checkGLcall("glMaterialfv");
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, \
This->UpdateStateBlock->material.Power); @@ -3048,13 +3051,48 @@
case D3DRS_SPECULARENABLE :
{
+ /* Originally this used \
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL,GL_SEPARATE_SPECULAR_COLOR) + \
and (GL_LIGHT_MODEL_COLOR_CONTROL,GL_SINGLE_COLOR) to swap between enabled/disabled + \
specular color. This is wrong: + Seperate specular color means the \
specular colour is maintained seperately, whereas + single color means \
it is merged in. However in both cases they are being used to + some \
extent. + To disable specular color, set it explicitly to black and \
turn off GL_COLOR_SUM_EXT + NOTE: If not supported dont give FIXME as \
very minimal impact and very few people are + yet running 1.4!
+ */
if (Value) {
- glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, \
GL_SEPARATE_SPECULAR_COLOR);
- checkGLcall("glLightModel \
(GL_LIGHT_MODEL_COLOR_CONTROL,GL_SEPARATE_SPECULAR_COLOR);"); + \
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, (float*) \
&This->UpdateStateBlock->material.Specular); + \
checkGLcall("glMaterialfv"); +#if defined(GL_VERSION_1_4)
+ glEnable(GL_COLOR_SUM);
+#elif defined(GL_EXT_secondary_color)
+ glEnable(GL_COLOR_SUM_EXT);
+#elif defined(GL_ARB_vertex_program)
+ glEnable(GL_COLOR_SUM_ARB);
+#else
+ TRACE("Specular colors cannot be enabled in this version of \
opengl\n"); +#endif
+ checkGLcall("glEnable(GL_COLOR_)\n");
} else {
- glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SINGLE_COLOR);
- checkGLcall("glLightModel \
(GL_LIGHT_MODEL_COLOR_CONTROL,GL_SINGLE_COLOR);");
- }
+ float black[4] = {0.0, 0.0, 0.0, 0.0};
+
+ /* for the case of enabled lighting: */
+ glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, &black[0]);
+ checkGLcall("glMaterialfv");
+
+ /* for the case of disabled lighting: */
+#if defined(GL_VERSION_1_4)
+ glDisable(GL_COLOR_SUM);
+#elif defined(GL_EXT_secondary_color)
+ glDisable(GL_COLOR_SUM_EXT);
+#elif defined(GL_ARB_vertex_program)
+ glDisable(GL_COLOR_SUM_ARB);
+#else
+ TRACE("Specular colors cannot be disabled in this version of \
opengl\n"); +#endif
+ checkGLcall("glDisable(GL_COLOR_)\n");
+ }
}
break;
diff -u ../winefree/dlls/d3d8/directx.c dlls/d3d8/directx.c
--- ../winefree/dlls/d3d8/directx.c 2003-05-28 23:31:22.000000000 +0200
+++ dlls/d3d8/directx.c 2003-05-28 23:34:20.000000000 +0200
@@ -875,6 +875,9 @@
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
checkGLcall("glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);");
+ glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL,GL_SEPARATE_SPECULAR_COLOR);
+ checkGLcall("glLightModel \
(GL_LIGHT_MODEL_COLOR_CONTROL,GL_SEPARATE_SPECULAR_COLOR);"); +
/*
* Initialize openGL extension related variables
* with Default values
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic