wined3d: Activate GL_ARB_texture_rectangle.

This commit is contained in:
Stefan Dösinger 2007-11-28 20:35:04 +01:00 committed by Alexandre Julliard
parent 8964336b37
commit d09cbcec91
4 changed files with 24 additions and 5 deletions

View File

@ -891,10 +891,20 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateTexture(IWineD3DDevice *iface, U
/** FIXME: add support for real non-power-two if it's provided by the video card **/
/* Precalculated scaling for 'faked' non power of two texture coords */
object->baseTexture.pow2Matrix[0] = (((float)Width) / ((float)pow2Width));
object->baseTexture.pow2Matrix[5] = (((float)Height) / ((float)pow2Height));
object->baseTexture.pow2Matrix[10] = 1.0;
object->baseTexture.pow2Matrix[15] = 1.0;
if(GL_SUPPORT(ARB_TEXTURE_RECTANGLE) &&
(Width != pow2Width || Height != pow2Height)) {
object->baseTexture.pow2Matrix[0] = (float)Width;
object->baseTexture.pow2Matrix[5] = (float)Height;
object->baseTexture.pow2Matrix[10] = 1.0;
object->baseTexture.pow2Matrix[15] = 1.0;
object->target = GL_TEXTURE_RECTANGLE_ARB;
} else {
object->baseTexture.pow2Matrix[0] = (((float)Width) / ((float)pow2Width));
object->baseTexture.pow2Matrix[5] = (((float)Height) / ((float)pow2Height));
object->baseTexture.pow2Matrix[10] = 1.0;
object->baseTexture.pow2Matrix[15] = 1.0;
object->target = GL_TEXTURE_2D;
}
TRACE(" xf(%f) yf(%f)\n", object->baseTexture.pow2Matrix[0], object->baseTexture.pow2Matrix[5]);
/* Calculate levels for mip mapping */

View File

@ -3505,6 +3505,14 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_PrivateSetup(IWineD3DSurface *iface) {
This->glRect.right = 0;
This->glRect.bottom = 0;
} else {
/* Check this after the oversize check - do not make an oversized surface a texture_rectangle one */
if(This->Flags & SFLAG_NONPOW2 && GL_SUPPORT(ARB_TEXTURE_RECTANGLE)) {
This->glDescription.target = GL_TEXTURE_RECTANGLE_ARB;
This->pow2Width = This->currentDesc.Width;
This->pow2Height = This->currentDesc.Height;
This->Flags &= ~SFLAG_NONPOW2;
}
/* No oversize, gl rect is the full texture size */
This->Flags &= ~SFLAG_OVERSIZE;
This->glRect.left = 0;

View File

@ -207,7 +207,7 @@ static UINT WINAPI IWineD3DTextureImpl_GetTextureDimensions(IWineD3DTexture *ifa
IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface;
TRACE("(%p)\n", This);
return GL_TEXTURE_2D;
return This->target;
}
static void WINAPI IWineD3DTextureImpl_ApplyStateChanges(IWineD3DTexture *iface,

View File

@ -948,6 +948,7 @@ typedef struct IWineD3DTextureImpl
UINT width;
UINT height;
UINT target;
} IWineD3DTextureImpl;