Textures in d3d8

Klaus Niederkrueger kniederk at MI.Uni-Koeln.DE
Wed Oct 16 18:17:47 CDT 2002


Hi,

After thinking for a very long time, I finally started to hack on Wine.
But after two days I already have my doubts that stop me from continuing
and I hope someone can help me.

I decided that IDirect3DDevice8Impl_SetRenderState has so many different
arguments that there should be one for me. I chose D3DRS_WRAP0 and what I
wrote was

    case D3DRS_WRAP0                     :
        /* Three doubts: Does Windows GL_CLAMP if D3DWRAP is disabled?
	   Does "U" correspond to "S", "V" to "T", and "W" to "R"?
	   Do I have to set this parameter for all of GL_TEXTURE_1D,
	   GL_TEXTURE_2D, and  GL_TEXTURE_3D ? */
        if ((Value & D3DWRAPCOORD_0) || (Value & D3DWRAP_U)) {
	    glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_REPEAT);
	    checkGLcall("glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S,
"
			"GL_REPEAT);");
	    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
	    checkGLcall("glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,
"
			"GL_REPEAT);");
	    glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_REPEAT);
	    checkGLcall("glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S,
"
			"GL_REPEAT);");
	} else {
	    glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_CLAMP);
	    checkGLcall("glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S,
"
			"GL_CLAMP);");
	    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
	    checkGLcall("glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,
"
			"GL_CLAMP);");
	    glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_CLAMP);
	    checkGLcall("glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S,
"
			"GL_CLAMP);");
	}
	if ((Value & D3DWRAPCOORD_1) || (Value & D3DWRAP_V)) {
	    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
	    checkGLcall("glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,
"
			"GL_REPEAT);");
	    glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_REPEAT);
	    checkGLcall("glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T,
"
			"GL_REPEAT);");
	} else {
	    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
	    checkGLcall("glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,
"
			"GL_CLAMP);");
	    glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_CLAMP);
	    checkGLcall("glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T,
"
			"GL_CLAMP);");
	}
	if ((Value & D3DWRAPCOORD_2) || (Value & D3DWRAP_W)) {
	    glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_REPEAT);
	    checkGLcall("glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R,
"
			"GL_REPEAT);");
	} else {
	    glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP);
	    checkGLcall("glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R,
"
			"GL_CLAMP);");
	}
	WARN("What to do for D3DWRAPCOORD_3 in OpenGL?");
	WARN("Does not work if using multiple textures! Use ActiveTexture!");
        break;


I think if the program just uses one Texture this should work, but I have
some doubts:

OpenGL has different TextureModes (1D, 2D, 3D) and WRAP is set
independently for each of these. In Windows this setting changes all modes
at one or not?

What is the last texture coordinate doing in Windows? I have heard of
3D-Textures, but 4D?

Does not-wrapping correspond to GL_CLAMP under OpenGL?

I would be happy if you answer my questions. I guess I can look it up
somewhere, but reading through the specification takes so much time :-(

And do you think the code above works? I'm new to wine and I would be
happy for any clue.

Thanks

	Klaus




More information about the wine-devel mailing list