• Render Target Issues
    0 replies, posted
So well basicly im triying to render the player view on an specific texture of his weapon The problem is that instead of drawing it on the weapon it draws it on the Screen on the left corner So well if anyone got some spare tiem to help me heres the code [LUA] include("shared.lua") if SERVER then SWEP.RenderTarget = GetRenderTarget( "materials/models/weapons/v_models/m4tactical/acog.vmt", 64, 64, false ) SWEP.Font = surface.CreateFont( "7 SEGMENTAL DIGITAL DISPLAY", 50, 400, true, false, "7segment", false, false ) local mat mat = Material( "materials/models/weapons/v_models/m4tactical/acog.vmt" ) mat:SetMaterialTexture( "$basetexture", SWEP.RenderTarget ) mat = Material( "materials/models/weapons/v_models/m4tactical/acog.vmt" ) mat:SetMaterialTexture( "$basetexture", SWEP.RenderTarget ) mat = Material( "materials/models/weapons/v_models/m4tactical/acog.vmt" ) mat:SetMaterialVector( "$tint", Vector( 1.2, 0, 0 ) ) local color_red = Color( 189, 000, 000, 255 ) end function SWEP:ViewModelDrawn( ) local old old = render.GetRenderTarget( ) render.SetRenderTarget( self.RenderTarget ) render.SetViewPort( 0, 0, 64, 64 ) render.Clear( 255, 000, 000, 255, true ) cam.Start2D( ) surface.SetDrawColor( color_black ) surface.DrawRect( 0, 00, 64, 7 ) surface.DrawRect( 0, 57, 64, 7 ) draw.DrawText( string.format( "%02d", self:Clip1( ) ), "7segment", 0, 7, color_black, TEXT_ALIGN_LEFT ) cam.End2D( ) render.SetViewPort( 0, 0, ScrW( ), ScrH( ) ) render.SetRenderTarget( old ) end [/LUA] they are on my swep cl_init.lua
Sorry, you need to Log In to post a reply to this thread.