opnaiC Posted November 22, 2016 Share Posted November 22, 2016 Hi, How I can fix that black edge on the radar map ? Is there any other way without making the map bigger ? Link to comment
Dzsozi (h03) Posted November 22, 2016 Share Posted November 22, 2016 (edited) addEventHandler('onClientResourceStart', resourceRoot, function() if (texture) then -- should be the texture name of the map dxSetTextureEdge(texture, 'border', tocolor(WaterColor[1], WaterColor[2], WaterColor[3], 255)) -- replace WaterColor[1] (and so on) with the water color of the map, use paint or photoshop and pipette tool to get the rgb numbers of the section end end ) Edited November 22, 2016 by Dzsozi Link to comment
opnaiC Posted November 22, 2016 Author Share Posted November 22, 2016 (edited) 1 hour ago, Dzsozi said: addEventHandler('onClientResourceStart', resourceRoot, function() if (texture) then -- should be the texture name of the map dxSetTextureEdge(texture, 'border', tocolor(WaterColor[1], WaterColor[2], WaterColor[3], 255)) -- replace WaterColor[1] (and so on) with the water color of the map, use paint or photoshop and pipette tool to get the rgb numbers of the section end end) So when I use dxCreateImage can I use this ? Cause I tried it and it isnt working .. Can you explain what do you mean with the argument texture ? This is what I tried: img = dxDrawImage(X - worldW/2, mH/5 + (Y - worldH/2), worldW, worldH, "img/radar_map.jpg", camZ, (x/(6000/worldW)), -(y/(6000/worldH)), tocolor(255, 255, 255, 255)) dxSetTextureEdge(img, "border", tocolor(255, 0, 0, 255)) Edited November 22, 2016 by opnaiC Link to comment
Dzsozi (h03) Posted November 22, 2016 Share Posted November 22, 2016 Try this: addEventHandler('onClientResourceStart', resourceRoot, function() local texture = dxCreateTexture("img/radar_map.jpg") if (texture) then dxSetTextureEdge(texture, 'border', tocolor(WaterColor[1], WaterColor[2], WaterColor[3], 255)) -- replace WaterColor[1] (and so on) with the water color of the map, use paint or photoshop and pipette tool to get the rgb numbers of the section end end ) ... dxDrawImage(X - worldW/2, mH/5 + (Y - worldH/2), worldW, worldH, texture, camZ, (x/(6000/worldW)), -(y/(6000/worldH)), tocolor(255, 255, 255, 255)) Link to comment
opnaiC Posted November 22, 2016 Author Share Posted November 22, 2016 23 minutes ago, Dzsozi said: Try this: addEventHandler('onClientResourceStart', resourceRoot, function() local texture = dxCreateTexture("img/radar_map.jpg") if (texture) then dxSetTextureEdge(texture, 'border', tocolor(WaterColor[1], WaterColor[2], WaterColor[3], 255)) -- replace WaterColor[1] (and so on) with the water color of the map, use paint or photoshop and pipette tool to get the rgb numbers of the section end end)... dxDrawImage(X - worldW/2, mH/5 + (Y - worldH/2), worldW, worldH, texture, camZ, (x/(6000/worldW)), -(y/(6000/worldH)), tocolor(255, 255, 255, 255)) I fixed what you post and its working now like that: Only the first pixel line is green but not the rest. Script: addEventHandler('onClientResourceStart', resourceRoot, function() texture = dxCreateTexture("img/radar_map.jpg") if (texture) then dxSetTextureEdge(texture, "border", tocolor(0, 255, 0)) end end ) ... Link to comment
Dzsozi (h03) Posted November 22, 2016 Share Posted November 22, 2016 Try setting 'border' to 'clamp' Link to comment
opnaiC Posted November 22, 2016 Author Share Posted November 22, 2016 1 minute ago, Dzsozi said: Try setting 'border' to 'clamp' Allready tried the same stuff for the first pixel line Link to comment
Dzsozi (h03) Posted November 22, 2016 Share Posted November 22, 2016 I guess you will have to wait for a reply of a more experienced person, I don't know what could be the problem, sorry. Link to comment
opnaiC Posted November 22, 2016 Author Share Posted November 22, 2016 40 minutes ago, Dzsozi said: I guess you will have to wait for a reply of a more experienced person, I don't know what could be the problem, sorry. Okay I will wait for help Link to comment
LoPollo Posted November 22, 2016 Share Posted November 22, 2016 I'm not an expert, but maybe it does not have effect because you are setting the edge of the texture of the map: the size of the texture and the size of the image are the same. The edge type may only apply to the part of a texture which is empty. Try applying that to the texture you draw the map texture (in you example was called "texture") on (probably a renderTarget?). I'm not expert, but if you have time you can try... it's better to do nothing and be bored Link to comment
opnaiC Posted November 22, 2016 Author Share Posted November 22, 2016 28 minutes ago, LoPollo said: I'm not an expert, but maybe it does not have effect because you are setting the edge of the texture of the map: the size of the texture and the size of the image are the same. The edge type may only apply to the part of a texture which is empty. Try applying that to the texture you draw the map texture (in you example was called "texture") on (probably a renderTarget?). I'm not expert, but if you have time you can try... it's better to do nothing and be bored I think I need some help to get this working because its to hard for me. Link to comment
opnaiC Posted November 23, 2016 Author Share Posted November 23, 2016 Can anybody help ? Link to comment
LoPollo Posted November 23, 2016 Share Posted November 23, 2016 (edited) can you post the code block where you draw the image? i'm not an expert so i think i should do "try and fail" and repeat, if i manage to do something useful i will post here Edited November 23, 2016 by LoPollo Link to comment
opnaiC Posted November 24, 2016 Author Share Posted November 24, 2016 if ( alwaysRenderMap or getElementInterior(localPlayer) == 0 ) then dxSetRenderTarget(rt, true) local x, y = getElementPosition(localPlayer) local X, Y = mW/2 -(x/(6000/worldW)), mH/2 +(y/(6000/worldH)) local camX,camY,camZ = getElementRotation(getCamera()) dxDrawImage(X - worldW/2, mH/5 + (Y - worldH/2), worldW, worldH, "img/radar_map.jpg", camZ, (x/(6000/worldW)), -(y/(6000/worldH)), tocolor(255, 255, 255, 255)) dxSetRenderTarget() end local rt = dxCreateRenderTarget(290, 175) This is how it is now Link to comment
LoPollo Posted November 24, 2016 Share Posted November 24, 2016 try setting the edge of rt to clamp type Link to comment
opnaiC Posted November 24, 2016 Author Share Posted November 24, 2016 8 minutes ago, LoPollo said: try setting the edge of rt to clamp type not working ;( Link to comment
LoPollo Posted November 24, 2016 Share Posted November 24, 2016 Why aren't you drawing the texture you loaded instead of "img/radar_map.jpg"? dxDrawImage(X - worldW/2, mH/5 + (Y - worldH/2), worldW, worldH, "img/radar_map.jpg", camZ, (x/(6000/worldW)), -(y/(6000/worldH)), tocolor(255, 255, 255, 255)) Note: i'm doing test & fail Link to comment
opnaiC Posted November 24, 2016 Author Share Posted November 24, 2016 9 minutes ago, LoPollo said: Why aren't you drawing the texture you loaded instead of "img/radar_map.jpg"? dxDrawImage(X - worldW/2, mH/5 + (Y - worldH/2), worldW, worldH, "img/radar_map.jpg", camZ, (x/(6000/worldW)), -(y/(6000/worldH)), tocolor(255, 255, 255, 255)) Note: i'm doing test & fail addEventHandler('onClientResourceStart', resourceRoot, function() texture = dxCreateTexture("img/radar_map.jpg") if (texture) then dxSetTextureEdge(rt, "border", tocolor(0, 255, 0)) end end ) ... if (not isPlayerMapVisible()) then local mW, mH = dxGetMaterialSize(rt) if ( alwaysRenderMap or getElementInterior(localPlayer) == 0 ) then dxSetRenderTarget(rt, true) local x, y = getElementPosition(localPlayer) local X, Y = mW/2 -(x/(6000/worldW)), mH/2 +(y/(6000/worldH)) local camX,camY,camZ = getElementRotation(getCamera()) dxDrawImage(X - worldW/2, mH/5 + (Y - worldH/2), worldW, worldH, texture, camZ, (x/(6000/worldW)), -(y/(6000/worldH)), tocolor(255, 255, 255, 255)) dxSetRenderTarget() Something is wrong, because only the left border is green .. Link to comment
LoPollo Posted November 24, 2016 Share Posted November 24, 2016 (edited) I'm not able to use the texture edge on a texture with dxDrawImage on a bigger texture. Wiki uses dxDrawImageSection... and it's the only way i get the edge working local useImageInsteadOfScreen = false local imageTexture = useImageInsteadOfScreen and dxCreateRenderTarget ( 300, 300, true ) or dxCreateScreenSource(300, 300) local theRenderTarget = dxCreateRenderTarget( 300, 300, true ) local sx, sy = guiGetScreenSize() sx, sy = sx / 1366, sy / 768 function init() if useImageInsteadOfScreen then dxSetRenderTarget( imageTexture ) --draw what you want on the image dxDrawRectangle( 0, 0, 300, 300 ) dxSetRenderTarget() end dxSetTextureEdge(imageTexture, "clamp") end addEventHandler( "onClientResourceStart", resourceRoot, init ) addEventHandler( "onClientRestore", root, init ) function init2() if not useImageInsteadOfScreen then dxUpdateScreenSource( imageTexture ) end dxSetRenderTarget( theRenderTarget, true ) dxDrawImageSection( 0, 0, 300, 300, -30, -30, 300+60, 300+60, imageTexture ) dxSetRenderTarget() end addEventHandler( "onClientResourceStart", resourceRoot, init2 ) addEventHandler( "onClientRestore", root, init2 ) function render() dxSetRenderTarget() dxDrawImage( 20*sx, 200*sy, 300*sx, 300*sy, theRenderTarget ) end addEventHandler( "onClientRender", root, render) Edited November 24, 2016 by LoPollo Link to comment
opnaiC Posted November 25, 2016 Author Share Posted November 25, 2016 Cant get it working ;( 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