Jump to content

GUI context problems


Ywa
 Share

Recommended Posts

Hi folks,

 

I'm trying to draw some text on top of my 3D world. I have my rendering code after my world update & render, but it still only shows my 2D stuff with a black background. I've read about PostRender hooks, but it only seems to be available to entities. How can I fix this to work with my normal game logic? Because adding a chat via an entity doesn't seem to make much sense to me.

 

Thanks in advance.

Link to comment
Share on other sites

Well I did that to test if it made any difference, but it doesn't. Still a red box with a black background. Removing the 3 lines of code renders my 3D world just fine.

 

This is my pivot code. Pivot is created after creating a world and before loading a map.

function Script:PostRender(Context)
--local Context = App.Context
Context:Clear()
Context:SetColor(1,0,0)
Context:DrawRect(20,20,100,100)
end

Link to comment
Share on other sites

No - world rendering does not need that. The examples where they were clearing the context was just a simple way to clear the screen to prevent smearing of variable or moving 2D items like text or rectangles but those same examples do not have a world being rendered. When the world is rendered it will overwrite every pixel in its context/buffer - effectively "clearing" the last render or 2D item drawn.

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

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...