Problem with DrawQuadEasy/SetMaterial? Material distorted?
3 replies, posted
Hi, I seem to have an issue rendering my sprites. Here is what I'm doing:
[CODE]cam.Start3D( LocalPlayer():EyePos(), LocalPlayer():EyeAngles() )
if( IsLookingAt( xSprite ) ) then
local sPath = xSpriteInfo[1]:GetName() .. "_mo"
render.SetMaterial( Material( sPath ) )
else
render.SetMaterial( xSpriteInfo[1] )
end
render.DrawQuadEasy( vPos, LocalPlayer():GetAimVector() * -1, xSpriteInfo[2][1], xSpriteInfo[2][2], Color( 255 , 255, 255, 255 ), 180 )
cam.End3D()
[/CODE]
This is how the sprite looks like normally:
[url]https://www.dropbox.com/s/8rgz4dbabpyixyw/Unti2tled.png[/url]
and when trying to render the mouse over version of it (which was created exactly the normal one), this happens:
[url]https://www.dropbox.com/s/tnfs9oialzgajj9/Untitled.png[/url]
[url]https://www.dropbox.com/s/gwwsisk9ruevrw1/Untitled3.png[/url]
the image distorts randomly depending on how you look at it.
Any ideas why this is happening?
It might be because you're calling Material in the draw function, aren't you supposed to only call Material once and then use the IMaterial it returns inside the function?
Invalid shader for material.
Thanks, seemed that both helped.
Sorry, you need to Log In to post a reply to this thread.