• Panel.GetHTMLMaterial() returns nil
    2 replies, posted
I need this function to draw a 3D HTML plane, but everytime I use it gives me the error "IMaterial expected, got nil", does anybody have this problem?
[code]function ENT:DrawTheater() cam.Start3D2D( self:GetPos() + ( self:GetForward() * ( Lounge.TheaterWidth / -2 ) / Lounge.Scale ) + ( self:GetRight() * ( Lounge.TheaterHeight/ -2 ) / Lounge.Scale ), self:GetAngles(), Lounge.TheaterRes ) surface.SetDrawColor( 0, 0, 0, 255 ) surface.DrawRect( 0, 0, ( Lounge.TheaterWidth / Lounge.TheaterRes ) / Lounge.Scale, ( Lounge.TheaterHeight / Lounge.TheaterRes ) / Lounge.Scale ) if Lounge.TheaterScreen and IsValid( Lounge.TheaterScreen ) and Lounge.TheaterScreen:GetHTMLMaterial() then surface.SetDrawColor( 255, 255, 255, 255 ) surface.SetMaterial( Lounge.TheaterScreen:GetHTMLMaterial() ) surface.DrawTexturedRect( 0, 0, ( Lounge.TheaterWidth / Lounge.TheaterRes ) / Lounge.Scale, ( Lounge.TheaterHeight / Lounge.TheaterRes ) / Lounge.Scale ) end cam.End3D2D() end[/code] Just made something very similar to what you want recently. Sometimes the material is nil during page loads, so you just have to make sure it's not nil before drawing. Hope the code provides you a nice base to work off of.
Thank you blackops.
Sorry, you need to Log In to post a reply to this thread.