Page 1 of 1

Drawing functions

Posted: Sat Oct 21, 2017 20:21
by Tennax
Hello,
I'm new, only started learning this system and I have few questions
Mostly I using DirectX 9 and functional I'm asking about available using it
Can I use CEGUI rendering system to draw:
1) Primitives (rectangle, circle, triangle and etc.)? (DrawPrimitiveUP)
2) Pictures (with rotation, scalling, color modulation)? (ID3DXSprite)
3) Text (with shadow/border, size calculation)? (ID3DXFont)
Can I draw in different modes:
1) Immediate mode, draw at the moment I called the function, when I working at the main thread?

Code: Select all

example:
renderer.drawTriangleFill(x1, y1, x2, y2, x3, y3, color1, color2, color3);
renderer.drawRectangleContour(x, y, w, h, thickness, color);
...

2) Listing mode, collect commands I need to render at one thread and draw it in main thread?

Code: Select all

example:
RenderList list;
list.pushRectangleFill(x, y, w, h, colorlt, colortr, colorbr, colorlb);
list.pushPicture(texture, x, y, scalex, scaley, rot);
...
renderer.drawList(list);

I have this functional partially only in DirectX 9, but maybe this engine can do it universally?
Is it possible in this engine and if it is how to use it right?
Thank you
P.S. English not my native language, so I'm sorry if I'm not correct

Re: Drawing functions

Posted: Sat Oct 21, 2017 20:54
by Ident
This is not a graphics engine.

You can do 2 and 3 as well with it, not sure if we call exactly the things you said in our D3D9 Renderer though. You can do 1 but if you want to do more advanced stuff than just drawing colored & textured triangles you will be out of luck, we dont support custom shaders in 0.8.X.

Again, it is not a graphics engine. It is a UI toolkit and I would advise against (ab)using it as an engine.

Re: Drawing functions

Posted: Sat Oct 21, 2017 21:19
by Tennax
Thank you for reply
I understand that it's not graphics engine, but thing is that I need GUI + some basic graphics
No, no, I'm not about complex things like custom shaders and other stuff
I will list everything what I would like, and if it does not make it difficult for you to answer, please write what possible
1) Lines - good if every vertex can have own color, good if support any thickness, and if possible antialiasing
2) Triangles - good if every vertex can have own color
3) Rectangle - good if every vertex can have own color with alpha channel support, and if possible rounded corners (not important)
4) Circles - not important and I think it will work too slow, because need more vertices?
5) Images - good if have scalling, rotation and color modulation
6) Texts - with v/h alignment and if possible bounding, i think shadows and borders can be only faked?
P.S. I planning to use CEGUI 0.8.7 only on DirectX 9,10,11

Re: Drawing functions

Posted: Sat Oct 21, 2017 21:29
by Ident
Take a look at the sample browser and play around with the widgets using the CEED Editor. Also look at the code and the API and you will know if this library fits your needs.

Re: Drawing functions

Posted: Sun Oct 22, 2017 08:47
by Tennax
Okay, so I should use CEGUI::GeometryBuffer?
Should I cleanup it every frame before adding new geometry, because overlay I doing must be updated every frame?

Re: Drawing functions

Posted: Sun Oct 22, 2017 08:48
by Ident
Just use the GeometryBuffer API and you should be fine:
http://static.cegui.org.uk/docs/0.8.0/c ... uffer.html

If you got different vertices you will need to clean them up every frame yes. For efficiency's sake you would want to change as little as possible.

Re: Drawing functions

Posted: Sun Oct 22, 2017 09:32
by Tennax
But I still can't draw lines, right?

Re: Drawing functions

Posted: Sun Oct 22, 2017 10:54
by Ident
In 0.8 you can draw lines in the form of a long quad composed of two triangles, which is one way to render a line in any modern rendering engine as welö.

In CEGUI 1.0 there is the possibility to draw lines by specifying start & end points, which is probably what you want. But 1.0 is in development so this is rather experimental and we only provide a D3D11 renderer there (which works with D3D9 hardware).