Jump to content

The 3D perspective does not work


Adisexe

Recommended Posts

Hello, I have problem... I would like to make a 3D perspective… The 3D perspective works, but instead of my picture, a white square appears

That's how it looks:

adPIXtQ.jpg

And the picture that should load, looks like this:

tSiwT0l.png

 

debugscript is clean

My code looks like this:

local sx, sy = guiGetScreenSize()
local zoom = sx < 1920 and math.min(2, 1920/sx) or 1
local register_window = dxCreateTexture("images/register_window.png", "argb", true, "clamp")
local ox,oy = 0,0 
local mx,my = 5,5 
local rt = dxCreateRenderTarget(sx,sy,true)
local shader = dxCreateShader("shaders/texture3d.fx")

function updateRotation()
	dxSetRenderTarget(rt, true)
	dxDrawImage(sx/2 - 396.5/zoom, sy/2 - 200/zoom, 793/zoom, 661/zoom, register_window)
	dxSetRenderTarget()
	dxSetShaderValue(shader,"texture",rt) 
	local px,py = getCursorPosition()
	ox,oy = (px-0.5)*mx,(py-0.5)*my 
	dxSetShaderTransform(shader,ox,oy)
	dxDrawImage(sx/2 - 396.5/zoom, sy/2 - 200/zoom, 793/zoom, 661/zoom, shader)
end
addEventHandler("onClientRender", root, updateRotation)

Help me please :C 

Link to comment
  • Discord Moderators

Why'd you use a render target when you could just simply pass the texture that you draw with dxDrawImage anyways?
Btw, if you just want to render a "3D" image to the screen it's enough to use dxSetShaderTransform.

Link to comment

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