• IMaterial:SetTexture() Doesn't do a Thing
    3 replies, posted
The result of the following code is the mat_mymaterial is rendered as a screen quad unmodified as if the SetTexture line does nothing. I've pretty much ruled out any of the other lines being screwed up. They should be correct, but I may be wrong. [CODE]local OldRT = render.GetRenderTarget() local CRT= GetRenderTarget("customRenderTarget", ScrW(), ScrH()) render.SetRenderTarget( CRT) render.SetMaterial( MaterialIWantToDraw ) render.DrawScreenQuad() render.SetRenderTarget( OldRT ) mat_mymaterial:SetTexture( "$basetexture", CRT) -- I believe this is the problematic line render.SetMaterial( mat_mymaterial) render.DrawScreenQuad()[/CODE] Yes, there is a reason why I can't render it directly to the normal render target. However, that isn't relevant because this code as is doesn't work so any of the things I want to do further with it won't work either and will just make the code more confusing. Seems to me the SetTexture function just isn't doing it's job and I can't figure out why. It works in render.DrawBloom() according to the source code.
Try setting the render target size to 512x512.
[QUOTE=Robotboy655;49635567]Try setting the render target size to 512x512.[/QUOTE] So I changed this: [CODE]local CRT= GetRenderTarget("customRenderTarget", ScrW(), ScrH())[/CODE] To this: [CODE]local CRT= GetRenderTarget("customRenderTarget", 512, 512)[/CODE] That's what you meant, right? I didn't work :(
bump
Sorry, you need to Log In to post a reply to this thread.