• HTML:GetHTMLMaterial() not working properly
    2 replies, posted
So hi all, I would like to make a shop plate with a shop logo. I already made my cam.Start3D2D and it's working. But i can't find anyway to get the texture. Indead, the texture is an image file located on a website. So i'm using a fake HTML without frames and withut showing it. But when i try to retrieve the generated texture, if the panel is not displayed at screen, GetHTMLMaterial returns nil. So i need a way to display any website on a cam.Start3D2D. Does any one knows a way to do it ? [code] --This function is called everytime the page has changed for the player who view it (it gens the texture) function ENT:ChangePage(newPage) local tempFrame = vgui.Create("DFrame") tempFrame:SetSize(558, 290) local browser = vgui.Create("HTML", tempFrame) browser:SetPaintedManually(false) browser:SetSize(558, 290) browser:SetMouseInputEnabled(false) browser:OpenURL(newPage) tempFrame:Show() print(browser) self.Texture = browser self.WebPage = newPage tempFrame:Close() end --My cam.Start3D2D cam.Start3D2D(DrawPos, DrawAngles, 0.4) surface.SetDrawColor(0, 0, 0, 255) surface.DrawRect(0, 0, 558, 290) draw.RoundedBox(4, 0, 0, 558, 30, Color(0, 0, 70, 200)) draw.SimpleText("Page : " .. self.WebPage, "TargetID", 0, 0, Color(255, 255, 255, 255)) if (self.Texture:IsValid() and self.Texture != nil and self.Texture:GetHTMLMaterial() != nil) then render.SetMaterial(self.Texture:GetHTMLMaterial()) render.DrawQuad(Vector(0, 0, 0), Vector(558, 0, 0), Vector(558, 290, 0), Vector(0, 290, 0)) end cam.End3D2D() [/code]
You must do[code] browser:SetPaintedManually(true ) /*draw here*/ browser:SetPaintedManually( false )[/code] As far as I remember. [editline]2nd August 2014[/editline] Or you can try doing browser:PaintAt( x, y, w, h )
Thank you, You helped me alot ! Now my shop plate is working ! I can display everything !! (Ex : wiki.garrysmod.com google.fr garrysmod.org even YouTube, but streaming website does not work...)
Sorry, you need to Log In to post a reply to this thread.