Team Spartan Cookies & Milk Forums
UV issue in drawTexturedRect - Printable Version

+- Team Spartan Cookies & Milk Forums (https://teamscm.co.uk)
+-- Forum: Garry's Mod (https://teamscm.co.uk/forum-4.html)
+--- Forum: Starfall (https://teamscm.co.uk/forum-7.html)
+--- Thread: UV issue in drawTexturedRect (/thread-3378.html)

Pages: 1 2


RE: UV issue in drawTexturedRect - Tomeno - 12-07-2020

Found a material that doesn't seem to work with Material();
--@highres true
local mat = Material("spacebuild/hazard2.vmt")
local tex = render.getTextureID("spacebuild/hazard2.vmt")
hook( "render", "render", function()
render.clear()
render.setMaterial(mat)
render.setColor(255, 255, 255, 255)
render.drawTexturedRect(0, 0, 512, 512)
render.setTexture(tex)
render.setColor(255, 255, 255, 255)
render.drawTexturedRect(512, 0, 512, 512)
end)
If you remove the .vmt from the end of the material path for "tex", it'll stop drawing as well. The presence of an extension has no effect on "mat".

EDIT: I thought I tried it, but using setTexture with "mat" makes it draw now... Must be my fault then.
EDIT 2: Oh. It only works in a HUD, and it has lighting applied. Doesn't work on a screen.


RE: UV issue in drawTexturedRect - Person8880 - 12-07-2020

That material is using the "VertexLitGeneric" shader so it won't render properly on a screen. That's a case where you do want to use render.getTextureID(), as it sets up the appropriate shader for it to render without lighting.

The following works fine for me:
--@highres
local tex = render.getTextureID("spacebuild/hazard2")
hook( "render", "render", function()
render.clear()
render.setTexture(tex)
render.setColor(255, 255, 255, 255)
render.drawTexturedRect(512, 0, 512, 512)
end)
The file extension doesn't seem to make a difference, it resolves to the same material either way.


RE: UV issue in drawTexturedRect - Tomeno - 12-07-2020

Ah. Using the material as a Texture without an extension doesn't work for me, but it seems to for other people.


RE: UV issue in drawTexturedRect - Person8880 - 12-07-2020

Might be worth restarting the game, as it may be holding on to a previous instance of the material from before the fixes.