Skip to content

Egp screens locked to pixel grid #3460

@raven1934

Description

@raven1934

Hey, longtime user of e2 less experienced about egp, I was wondering if it would be possible to consider adding an option for egp emitter screen to not be locked to integer values for positions positions on screen. I am unsure if the render plane is made with 3d2d plane but the tool itself has option for using RT (render texture) for the emitters so I'm unsure if this means it can render within "infinite" bounds of the 3d2d screen with float values for screen positions.

In my case this issue manifests as I'm using emitter to generate a view reticle in front of the player and possibly bogey tracking and due to nonfloat positions the shapes "snap" to positions instead of smoothly indicating the position on the hud. I tried to mitigate the issue by egpScale and egpResolution functions and while this seems to affect the size of the objects by scaling and translating the space of the render area, it still doesnt seem to get rid of the snapping issue.

I'll attach example code here:

@name EGPTester
@inputs 
@outputs 
@persist WLGraphics:wirelink
@strict
 
if(first())
{
    EGPEmitter=sentSpawn("gmod_wire_egp_emitter",entity():toWorld(vec(0,0,0)),ang(0,0,0),1)
    EGPEmitter:parentTo(entity())    
         
    WLGraphics=EGPEmitter:wirelink()
      
    WLGraphics:egpClear()
    WLGraphics:egpResolution(vec2(-4096,-4096),vec2(4096,4096))
    WLGraphics:egpBox(1,vec2(0,0),vec2(1024,1024))
    WLGraphics:egpMaterial(1,"sprites/reticle")
    WLGraphics:egpAngle(1,45)
    WLGraphics:egpFiltering(1,_TEXFILTER_POINT)
}

WLGraphics:egpPos(1,WLGraphics:egpPos(1)+vec2(1,1))
#WLGraphics:egpScale(vec2(-500000,500000),vec2(-500000,500000))

runOnTick(1)

If you use this code it will recenter the midpoint to the mid of the visible plane and reindex it to have 4096 halfbound lengths, but sadly this change in resolution wont affect the renderTexture/3d2d plane size... Resulting if you scale the bound values up or down it correspondingly increases or reduces the time when the shape will snap to its place on screen. Any insight to how the screens resolution can be increased in reality or how to get the non-integer positioning working is very appreciated.

Thanks, Raven1934

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions