OSHGui
OSHGui copied to clipboard
OSHGui with CSGO surface flickering
So I'm currently trying to implement OSHGui using CSGO's surface. I found your implemenation from some years ago. However my menu is just flickering when enabled, here is a video to show it better.
I'm initializing OSHGui like so:
std::vector<OSHGui::Drawing::FontPtr> m_fonts;
OSHGui::Application::Initialize(std::make_unique<CSGORenderer>(interfaces::surface, interfaces::engine));
this->m_fonts.resize(renderer_fonts::FONT_MAX);
this->m_fonts[verdana_7] = std::make_unique<CSGOFont>(interfaces::surface, "Verdana", 7);
To draw the GUI I hook PaintTraverse and call it in MatSystemTopPanel.
void renderer::draw()
{
this->m_render_target = this->get_renderer().GetDefaultRenderTarget();
if (!this->m_render_target)
{
return;
}
this->m_geometry = this->get_renderer().CreateGeometryBuffer();
if (!this->m_geometry)
{
return;
}
this->m_render_target->Draw(*this->m_geometry);
}
I'm probably doing something wrong here and I would really appreciate help.
Kind regards.
Did you try drawing just a square or a line as a test? Does that work?
Did you try drawing just a square or a line as a test? Does that work?
Yes I did. Drawing a line, text, rectangle works completely fine.
Did you draw these with my renderer or directly from the surface?
I tried directly from the surface, which worked. I sadly can't get it working with your renderer.
Would it be possible for you to evaluate me how you have gotten it working or maybe send me the implementation source code?
I use the CSGO renderer only for ESP and other visuals but not for the GUI. My PaintTraverse hook looks like this:
auto panelName = thisPanel->GetName(panel);
if (panelName == "MatSystemTopPanel")
{
using namespace OSHGui;
using namespace OSHGui::Drawing;
static bool once = true;
if (once)
{
once = false;
auto surface = reinterpret_cast<IMatSystemSurface*>(...);
module.rendererCSGO = std::make_unique<CSGORenderer>(surface, module.GetEngine());
module.fontCSGO = std::make_shared<CSGOFont>(surface, _xor_("Arial"), 14);
}
module.rendererCSGO->BeginRendering();
auto geometry = module.rendererCSGO->CreateGeometryBuffer();
{
Graphics g(*geometry);
// draw stuff
if (module.IsIngame())
{
// draw esp
}
}
auto &renderTarget = module.rendererCSGO->GetDefaultRenderTarget();
renderTarget->Activate();
renderTarget->Draw(*geometry);
renderTarget->Deactivate();
module.rendererCSGO->EndRendering();
}
Thanks for the source code!
Well my problem is that the GUI is sometimes randomly crashing due to CSGO's render multi threading, thats why I'm trying to implement it using the surface.
I don't use it for the GUI because my GUI uses some textures and I did not implement that in the CSGO renderer. Normal stuff should just work.
I'm doing the same right now. Just using OSH for the GUI. Though it's crashing the same like in #9