Adisexe Posted January 28, 2019 Share Posted January 28, 2019 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: And the picture that should load, looks like this: 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 Pirulax Posted January 28, 2019 Discord Moderators Share Posted January 28, 2019 (edited) Well, the problem is probably with the shader. Could you post that as well? Edited January 28, 2019 by Pirulax Link to comment
WorthlessCynomys Posted January 29, 2019 Share Posted January 29, 2019 To render an image in 3D I would use a render target, draw on It with dxDrawImage and I would use that renderTarget as the texture in dxDrawMaterialLine3D. Link to comment
Discord Moderators Pirulax Posted January 29, 2019 Discord Moderators Share Posted January 29, 2019 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
Adisexe Posted February 2, 2019 Author Share Posted February 2, 2019 (edited) It's working now… It was enough to change: with "texture" on "sPicTexture" (in dxSetShaderValue) and draw the image on the entire screen Edited February 2, 2019 by Adisexe Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now