opnaiC

[HELP] Radar black edge on map

Recommended Posts

Hi,

How I can fix that black edge on the radar map ? Is there any other way without making the map bigger ?

FmvnduT.png

Share this post


Link to post
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 by Dzsozi

Share this post


Link to post
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 by opnaiC

Share this post


Link to post

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

 

Share this post


Link to post
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:

YOjjHDk.png

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
)

...

 

Share this post


Link to post
1 minute ago, Dzsozi said:

Try setting 'border' to 'clamp'

Allready tried the same stuff for the first pixel line

Share this post


Link to post
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

Share this post


Link to post

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 xD

Share this post


Link to post
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 xD

I think I need some help to get this working because its to hard for me.

Share this post


Link to post

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 by LoPollo

Share this post


Link to post
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

Share this post


Link to post
8 minutes ago, LoPollo said:

try setting the edge of  rt to clamp type

not working ;(

Share this post


Link to post

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

Share this post


Link to post
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()

kbZISON.png

Something is wrong, because only the left border is green ..

Share this post


Link to post

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 by LoPollo

Share this post


Link to post

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.