Jump to content

PostRender in C++


ErhanK
 Share

Recommended Posts

Hi, I have a question. How can I use "PostRender" in c++ for drawing a rectangle like this lua script? I did but, screen is flickering. I think this is must be in PostRender

--This function will be called after the world is rendered, before the screen is refreshed.
--Use this to perform any 2D drawing you want the entity to display.
function Script:PostRender(context)
	local window = context:GetWindow()

	context:SetBlendMode(Blend.Alpha)
	--draw selection rectangle
	if ( self.beginSelectPos ~= nil and self.endSelectPos ~= nil ) then
		
		context:SetColor(1,0,0,0.5)
    	context:DrawRect(self.beginSelectPos.x, self.beginSelectPos.y, self.endSelectPos.x-self.beginSelectPos.x, self.endSelectPos.y-self.beginSelectPos.y)
    	context:SetColor(0,0,0,0)
	end
  
  

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...