Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 02:27:32 +0000



OpenGL support for custom drawings

View Count: 827

[2023-08-14 17:17:22]
onnb - Posts: 662
Hi, this is related to OpenGL support for custom drawing using GDI/OpenGL

We use the drawing function for GDI based drawings in some places. An example of this is the DOM "General Purpose" column but we also use this in many places to draw to custom graphics to chart.

When switching to OpenGL this obviously does not work.

Is there currently support for custom drawing like that when using OpenGL? If there is currently no support, is there anything planned?
[2023-08-15 13:37:43]
Sierra_Chart Engineering - Posts: 17190
Yes this is going to be solved we expect in about 30 days.

An example of what we are developing are these new ACSIL functions which work for GDI and OpenGL:

// 2523
  int (SCDLLCALL* DrawGraphics_MoveTo)(const int XCoordinate, const int YCoordinate);
  int (SCDLLCALL* DrawGraphics_LineTo)(const int XCoordinate, const int YCoordinate, const uint32_t Color, const uint32_t LineWidth, const SubgraphLineStyles LineStyle);

These functions will change somewhat when this functionality is all complete. Be aware of that.

So all graphics drawing will be done through functions like these and not direct to the Windows API any longer.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2023-08-15 13:38:33
[2023-08-22 15:01:04]
onnb - Posts: 662
Understood

We've used sc.p_GDIFunction in many places over the years, both in our code and client projects. Will that function be supported going forward?
[2023-09-22 10:26:33]
Sierra_Chart Engineering - Posts: 17190
Will that function be supported going forward?
Yes this will continue to be supported and will still need to be used. You will just make different function calls which work equally with the Windows GDI and OpenGL.


We expect to release the new ACSIL graphics functions this evening which work equally with the GDI and OpenGL.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2023-09-22 10:27:16
[2023-10-03 21:44:58]
erwinbeckers - Posts: 22
sounds great!!
has this already been released ?
and can we also draw text, rectangles and circles using these new functions?
and is there any documentation about it ?

regards
Erwin
[2023-10-03 22:33:12]
User719512 - Posts: 264

has this already been released ?
and can we also draw text, rectangles and circles using these new functions?
and is there any documentation about it ?

From v2551+ this is working great. See the header files for all the new functions in struct s_Graphics. There is a sample in GDIExample.cpp to get started.
[2023-10-03 22:58:03]
Sierra_Chart Engineering - Posts: 17190
has this already been released ?
Yes. Refer to:
https://www.sierrachart.com/index.php?page=doc/Whats_New.php

and can we also draw text, rectangles and circles using these new functions?
Yes.

and is there any documentation about it ?
There is a code example supplied with Sierra Chart and mentioned in the What is New notes. The functions are the same as the Windows GDI. So refer to the Windows GDI documentation. Generally that will be the guide.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2023-10-04 07:49:07]
erwinbeckers - Posts: 22
Thanks

I installed 2553 and GDIExample is working now with the new functions
However I have 1 question about DrawRectangle.. How can we draw a rectangle without filling it, so just the border?

sc.Graphics.SetBackgroundMode(TRANSPARENT) has no effect and GraphicsBrush.m_BrushColor.Color.RGB.Alpha=0 also doesn't

It looks like DrawRectangle is always a FillRectangle
Date Time Of Last Edit: 2023-10-04 08:13:11
[2023-10-04 09:09:56]
Sierra_Chart Engineering - Posts: 17190
This is how to do it:

  // Yellow brush
  n_ACSIL::s_GraphicsBrush GraphicsBrush;
  GraphicsBrush.m_BrushType = n_ACSIL::s_GraphicsBrush::BRUSH_TYPE_SOLID;
  GraphicsBrush.m_BrushColor.SetRGB(255, 255, 0);

  sc.Graphics.SetBrush(GraphicsBrush);

  n_ACSIL::s_GraphicsPen GraphicsPenForRectangle;
  GraphicsPenForRectangle.m_PenColor.SetColorValue(COLOR_BLUE);
  GraphicsPenForRectangle.m_PenStyle = n_ACSIL::s_GraphicsPen::e_PenStyle::PEN_STYLE_SOLID;
  GraphicsPenForRectangle.m_Width = 5;

  sc.Graphics.SetPen(GraphicsPenForRectangle);

  //Draw a rectangle at the top left of the chart
  sc.Graphics.DrawRectangle( sc.StudyRegionLeftCoordinate + 5, sc.StudyRegionTopCoordinate + 5, sc.StudyRegionLeftCoordinate + 200, sc.StudyRegionTopCoordinate + 200);


  // Hollow Rectangle

  sc.Graphics.ResetBrush();

  n_ACSIL::s_GraphicsBrush HollowBrush;
  HollowBrush.m_BrushType = n_ACSIL::s_GraphicsBrush::BRUSH_TYPE_STOCK;
  HollowBrush.m_BrushStockType = NULL_BRUSH;

  sc.Graphics.SetBrush(HollowBrush);

  //Using existing set pen

  sc.Graphics.DrawRectangle(sc.StudyRegionLeftCoordinate + 300, sc.StudyRegionTopCoordinate + 300, sc.StudyRegionLeftCoordinate + 500, sc.StudyRegionTopCoordinate + 500);

Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2023-10-04 09:18:31
[2023-10-04 09:26:01]
erwinbeckers - Posts: 22
Thank you, works beautiful now :-)

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account