surface.DrawRect translucide

hello guys, i make a DrawRec and i dont know why, we can saw some world detail entity …

http://img4.hostingpics.net/pics/194064Sanstitre.jpg

Did you know why ? I don’t found with google or search barr ^^"



include("shared.lua")

function ENT:Initialize()
end

function ENT:Draw()
	self:DrawModel()
	
	local DrawPos = self:LocalToWorld(Vector(57, -125, 90)) 
	local DrawAngles = self:GetAngles()
	DrawAngles:RotateAroundAxis(self:GetAngles():Forward(), 90)
	DrawAngles:RotateAroundAxis(self:GetAngles():Up(), 180)
	
	cam.Start3D2D(DrawPos, DrawAngles, 1)
		surface.SetDrawColor(255, 255, 255, 255)
		surface.DrawRect(0, 0, 70, 100)
		
	cam.End3D2D()
end




AddCSLuaFile( "shared.lua" )
AddCSLuaFile( "cl_init.lua" )
include( "shared.lua" )

if SERVER then

	function ENT:Initialize()
		self:SetModel("models/sligwolf/bus_bendi/bus_stop_001.mdl")
		self:PhysicsInit(SOLID_VPHYSICS)
		self:SetMoveType(MOVETYPE_VPHYSICS)
		self:SetSolid(SOLID_VPHYSICS)
		self:SetUseType(SIMPLE_USE)
		local phys = self:GetPhysicsObject()
		self:DropToFloor()
		
		Nyhu_Bus_Stop=Nyhu_Bus_Stop or {}
		Nyhu_Bus_Stop[#Nyhu_Bus_Stop+1] = self
		
		for i=1,#Nyhu_Bus_Stop do
			if !IsValid(Nyhu_Bus_Stop*) then
				table.remove(Nyhu_Bus_Stop,i)
			end
		end
	end

	function ENT:SpawnFunction( ply, tr )
		local SpawnAngles = ply:EyeAngles()
		SpawnAngles.x = 0
		SpawnAngles.y = SpawnAngles.y+180
		
		if (!tr.Hit ) then return end
		local Nyhu_Bus_Stop = ents.Create( "Nyhu_Bus_Stop" )
		Nyhu_Bus_Stop:SetPos( tr.HitPos + tr.HitNormal * 16 )
		Nyhu_Bus_Stop:SetAngles(SpawnAngles)
		Nyhu_Bus_Stop:Spawn()
		Nyhu_Bus_Stop:Activate()
		return Nyhu_Bus_Stop
	end
	
	function ENT:OnTakeDamage()
		return false
	end 
end


i make some npc with same structure and i haven’t this…“bug” =X

It’s not a “bug”, you must use RENDERMODE_BOTH for 3d2d stuff.

BOTH dosen’t work. I search and i try that https://wiki.garrysmod.com/page/Enums/RENDERMODE

But no one work. I try to put self:SetRenderMode( x ) everywhere (on init and on draw (not at same time ^^) )

Sorry, my bad, it’s RENDERGROUP.

… i try that :

self.SetRenderGroup(RENDERGROUP_BOTH )
self:SetRenderGroup(RENDERGROUP_BOTH )

self.GetRenderGroup(RENDERGROUP_BOTH )
self:GetRenderGroup(RENDERGROUP_BOTH )

self.RenderGroup(RENDERGROUP_BOTH )
self:RenderGroup(RENDERGROUP_BOTH )

Same problème. What is the rigth syntax? i’m lost =/

Read the page I linked.

Sorry, ive a bad english… i try to find a bascical exempl for deconstruct him… no success. I think there is a grammatical subtlety i dont understand… (google trad =X )

i need to use ClientsideModel() on my SWEP:Draw ?

edit : i dont want a “spoon” lua code who work direclty with all i want to do. Juste want an exemple to deconstruct him and reconstruct my lua with good method ^^.

Just do on cl_init.lua file top

ENT.RenderGroup = RENDERGROUP_BOTH

Thanks a lot! it’s work! i put this tipe on my data base n_n.