Jump to content

3D dxDraw


dugasz1

Recommended Posts

Posted

Hello everybody.
I would like to draw in 3D. I use DxDrawMaterialLine3D for it.
So i have a background image but i want to write text to it and draw recentagles to it. Is it possible? Can i somehow set the dxDrawText output to my background texture?

Sorry for lot of questions and thanks for the answers! :)

Posted

You can most definitely draw text in 3D as well, you'll want to check out getScreenFromWorldPosition for that. The same applies for drawing DX shapes such as rectangles. :)

  • Like 1

If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.

Posted

Yup, the wonders of render targets :) It should be far more optimized as well :D

If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.

Posted (edited)

Yes the other important benefit and then i don't need to do the math of transformations :D

Edited by dugasz1

Sorry for lot of questions and thanks for the answers! :)

Posted (edited)

And another question about rendertargets. How can i make a texture from my rendertarget ? Or is it possible ? because i want to delete my render target just keep the texture and draw it?

local renderT = dxCreateRenderTarget(400,400, true)
dxSetRenderTarget(renderT)
dxDrawText("Hello world", 0,0 200,200)
dxDrawRecentagle(0,0,200,200, tocolor(255,255,255,255))
--etc..
dxSetRenderTarget()
local createdTexture = --get somehow the texture
destroyElement(renderT)

dxDrawMaterialLine3D(0, 0, 5, 0, 0, 5-2, createdTexture, 2)   --Draw it

 

Edited by dugasz1

Sorry for lot of questions and thanks for the answers! :)

Posted
    local renderT = dxCreateRenderTarget(400,400, true)
    dxSetRenderTarget(renderT)
    dxDrawText("Hello world", 0,0 200,200)
    dxDrawRecentagle(0,0,200,200, tocolor(255,255,255,255))
    --etc..
    dxSetRenderTarget()

    dxDrawMaterialLine3D(0, 0, 5, 0, 0, 5-2,renderT, 2)   --Draw it
    destroyElement(renderT)

 

Wolf Inc Discord

Youtube channel
Github

Posted

I know but i wanted to create as texture but know i checked it uses the same part of memory so never mind.
Thank you.

Sorry for lot of questions and thanks for the answers! :)

Posted
2 hours ago, CodyL said:

    local renderT = dxCreateRenderTarget(400,400, true)
    dxSetRenderTarget(renderT)
    dxDrawText("Hello world", 0,0 200,200)
    dxDrawRecentagle(0,0,200,200, tocolor(255,255,255,255))
    --etc..
    dxSetRenderTarget()

    dxDrawMaterialLine3D(0, 0, 5, 0, 0, 5-2,renderT, 2)   --Draw it
    destroyElement(renderT)

 

dx drawing functions need to render event, and when you destroyed render you will cause an bug

skype : 011101000110111000110110011001010110110000110000001110010011000000111001

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...