News:

Welcome to the Bridgetek Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ Bridgetek Support

Please refer to our website for detailed information on all our products - Bridgetek - Bridging Technology

Main Menu

Reproducing the demo outline circle in the screen editor

Started by obones, September 02, 2021, 02:45:09 PM

Previous topic - Next topic

obones

In the SampleApp, there is set_07 that displays only the outline of a circle by means of multiple points drawn with different blending functions.

I'm now trying to use this kind of effect in my own system and it does not work at all, nothing is displayed.

I thus went to the EVE Screen Editor application and tried to reproduce ConcentricCircles from set_07 with the following coprocessor list:


CMD_DLSTART()
VERTEX_FORMAT(0)
CLEAR_COLOR_RGB(255, 255, 255)
CLEAR(1, 1, 1)

BEGIN(LINES)
LINE_WIDTH(16)
COLOR_RGB(0x0, 0xFF, 0xFF)
VERTEX2F(200, 200)
VERTEX2F(400, 400)
END()

CLEAR_COLOR_A(0)

BEGIN(POINTS)

COLOR_MASK(0, 0, 0, 1)
BLEND_FUNC(ONE, ONE_MINUS_SRC_ALPHA)

POINT_SIZE(1600)
VERTEX2F(300,300)

BLEND_FUNC(ZERO, ONE_MINUS_SRC_ALPHA)

POINT_SIZE(1400)
VERTEX2F(300, 300)

COLOR_MASK(1, 1, 1, 0)
BLEND_FUNC(DST_ALPHA, ONE)

COLOR_RGB(0, 255, 0)
POINT_SIZE(1800)
VERTEX2F(300, 300)

BLEND_FUNC(SRC_ALPHA, ONE_MINUS_SRC_ALPHA)

END()


I was expecting this to give me a diagonal blue line with a green circle outline drawn on top of it.
But all I get is the blue line, nothing else.

What have I missed?

BRT Community

Hello,

Thank you for your question, would you be able to provide an example of what you are trying to draw on the screen for reference?

Best Regards,
BRT Community

obones

Hello,

In the demo, there is this rendering:



I'm trying to replicate it, to get a green circle outline on top of a blue line, like this:



But with the given set of commands, all I'm getting is the line by itself:



Clearly, I have missed something, but I can't figure out what.

BRT Community

Hello,

The following code will draw the desired circle with the line through it,


BEGIN(LINES)
LINE_WIDTH(48)
COLOR_RGB(0x0, 0xFF, 0xFF)
VERTEX2F(1688, 1384)
VERTEX2F(4768, 5056)
END()

BEGIN(POINTS)


CLEAR_COLOR_A(0)
COLOR_MASK(0, 0, 0, 1)

BLEND_FUNC(ONE, ONE_MINUS_SRC_ALPHA)
POINT_SIZE(1600)
VERTEX2F(3200, 3200)

BLEND_FUNC(ZERO, ONE_MINUS_SRC_ALPHA)
POINT_SIZE(1520)
VERTEX2F(3200, 3200)

COLOR_MASK(1, 1, 1, 0)

BLEND_FUNC(DST_ALPHA, ONE)
COLOR_RGB(3, 182, 0)
POINT_SIZE(1600)
VERTEX2F(3200, 3200)
BLEND_FUNC(SRC_ALPHA, ONE_MINUS_SRC_ALPHA)

END()


However after some investigation it appears as if the CLEAR_COLOR_RGB command is causing the behaviour you are seeing where the circle isn't being drawn. For example if you alter this to black or red the circle is drawn correctly. I believe this sample was designed only to utilise a black background, but I will confirm this with the development team, and in the meantime investigate a solution to this issue.

Best Regards,
BRT Community

Domdom

We can use STENCIL to draw that

EVE_Cmd_wr32(s_pHalContext, BEGIN(LINES));
    EVE_Cmd_wr32(s_pHalContext, COLOR_RGB(0, 0, 255));
    EVE_Cmd_wr32(s_pHalContext, LINE_WIDTH(10)); //inner circle
    EVE_Cmd_wr32(s_pHalContext, VERTEX2F(5*16, 10*16));
    EVE_Cmd_wr32(s_pHalContext, VERTEX2F(500*16, 300*16));

    EVE_Cmd_wr32(s_pHalContext, STENCIL_FUNC(NEVER, 0x00, 0x00));
    EVE_Cmd_wr32(s_pHalContext, STENCIL_OP(INCR, INCR));
    EVE_Cmd_wr32(s_pHalContext, BEGIN(FTPOINTS));
    EVE_Cmd_wr32(s_pHalContext, POINT_SIZE((uint16_t )((C1 - 5) * 16))); //inner circle
    EVE_Cmd_wr32(s_pHalContext, VERTEX2II(240, 136, 0, 0));

    EVE_Cmd_wr32(s_pHalContext, STENCIL_FUNC(NOTEQUAL, 0x01, 0x01));
    EVE_Cmd_wr32(s_pHalContext, POINT_SIZE((uint16_t )((C1) * 16))); //outer circle
    EVE_Cmd_wr32(s_pHalContext, VERTEX2II(240, 136, 0, 0));

    EVE_Cmd_wr32(s_pHalContext, STENCIL_FUNC(EQUAL, 0x01, 0x01));
    EVE_Cmd_wr32(s_pHalContext, STENCIL_OP(KEEP, KEEP));
    EVE_Cmd_wr32(s_pHalContext, COLOR_RGB(R, G, B));
    EVE_Cmd_wr32(s_pHalContext, POINT_SIZE((uint16_t )((C1) * 16)));
    EVE_Cmd_wr32(s_pHalContext, VERTEX2II(240, 136, 0, 0));

    EVE_Cmd_wr32(s_pHalContext, STENCIL_FUNC(ALWAYS, 0x01, 0x01));
    EVE_Cmd_wr32(s_pHalContext, STENCIL_OP(KEEP, KEEP));

    EVE_Cmd_wr32(s_pHalContext, END());



BRT Community

Hello,

Thank you for the suggestion!

Best Regards,
BRT Community