Skip to main content
GameDev.net gamedev.net
🔒 Locked

Using the StretchRect() method

Started by shvalb Jan 24, 2005 at 7:05 AM 1 replies 5.6k views
Original Post
shvalb
shvalb
Hi. I created a 6 vertices and filled a VertexBuffer with values in order to create a rectangle and also put a texture on it. My question is: How do I use the StretchRect() method in order to stretch my rectange so it feets the window (150*150 pixels) ??? Don't know why but the StretchRect() method keeps failing to me, I pasted the hexadecimal code but I don't know how to check what it mean: 0x8876086c I understand that this method requires some support of the video adapter, I saw that there is D3DDEVCAPS2 - driver capability flags, one of the flags is named: D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES How do I check if my video card supports stretching ?? Thanks
mrmrcoleman
mrmrcoleman
I think you might be confusing Windows GDI with Dirct3D. If you have a vertexbuffer, then use setstreamsource to select it. Use settexture to apply a texture to the vertices. Then you use drawprimitive to render the vertices with the texture on it.

Obviously there is a bit more to it than that though! Check out Drunken Hyenas excellent tutorials for more information.

Kind regards.

Mark Coleman
S1CA
S1CA
1) There is a program called "DirectX Error Lookup" which you'll find in the DirectX Utilities folder of the DirectX SDK. You can paste error codes into that to find out what they mean.

You can also use the DXGetErrorDescription9()
DXGetErrorString9() functions to get the same information programatically

0x8876086c is D3DERR_INVALIDCALL which is usually returned when you pass bad values for the parameters of a Direct3D function; a hypothetical example of a bad parameter would be an rectangle that had a "right" member that was greater than the "left" member.


2) If you use the DEBUG Direct3D runtime (check out the FAQ for this forum!), with the output level up high, then when D3D returns the error it will also [usually] send an explanation for *why* the error happend to the output window of your debugger.


3) as mentioned by mrmrcoleman, if you're passing a vertex buffer to StretchRect(), then that would be "invalid" (and you would have got compiler errors too - unless you casted them away...). StretchRect() works with surfaces...

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.