Video Tutorial How to make an OpenGL ESP Tutorial

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat


Cesspool Admin
Jan 21, 2014
How to make an OpenGL ESP Tutorial

85% of games do rendering with Direct3d thanks to MIcrosoft's monopoly, but some games you hack may use OpenGL. If you're doing an ESP or other drawing you want to use whatever rendering API is used by the game. Then you just hook it and draw. Alternatively you can do an OpenGL transparent overlay window and draw on top of it.

Learn how to make an OpenGL ESP in this tutorial. This is an extension of our previous videos: Trampoline Hook SwapBuffers and the OpenGL Drawing videos. We'll build on those tutorials and add an Open ESP for Assault Cube. We will use all the skills learned from our previous videos in this OpenGL ESP Tutorial. You can download the full source from our forum.

SwapBuffers Hook for OpenGL ESP
In the case of an OpenGL ESP you will want to hook SwapBuffers. In rendering a game, there is a frame that is presented on the screen and then there is a backbuffer that is also being drawn to, when the frame is finished drawing you call SwapBuffers and it puts the back buffer onto the screen. So if you draw in a SwapBuffers hook, all the drawing is already done on the screen, so you're guaranteed to be drawing on top of the frame, and any OpenGL stuff you do will not affect the next frame.
swap buffers hook here

Vector3 class from FruitSmiles which I pasted:
class Vector3

    float x, y, z;

    Vector3() {};
    Vector3(const float x, const float y, const float z) : x(x), y(y), z(z) {}
    Vector3 operator + (const Vector3& rhs) const { return Vector3(x + rhs.x, y + rhs.y, z + rhs.z); }
    Vector3 operator - (const Vector3& rhs) const { return Vector3(x - rhs.x, y - rhs.y, z - rhs.z); }
    Vector3 operator * (const float& rhs) const { return Vector3(x * rhs, y * rhs, z * rhs); }
    Vector3 operator / (const float& rhs) const { return Vector3(x / rhs, y / rhs, z / rhs); }
    Vector3& operator += (const Vector3& rhs) { return *this = *this + rhs; }
    Vector3& operator -= (const Vector3& rhs) { return *this = *this - rhs; }
    Vector3& operator *= (const float& rhs) { return *this = *this * rhs; }
    Vector3& operator /= (const float& rhs) { return *this = *this / rhs; }
    float Length() const { return sqrtf(x * x + y * y + z * z); }
    Vector3 Normalize() const { return *this * (1 / Length()); }
    float Distance(const Vector3& rhs) const { return (*this - rhs).Length(); }
A sample of code from the OpenGL ESP Tutorial :
#include "stdafx.h"
#include "esp.h"

bool ESP::IsTeamGame()
    if ((*gameMode == 0 || *gameMode == 4 || *gameMode == 5 || *gameMode == 7 || *gameMode == 11 || *gameMode == 13 ||
        *gameMode == 14 || *gameMode == 16 || *gameMode == 17 || *gameMode == 20 || *gameMode == 21))
        return true;
    else return false;

bool ESP::IsEnemy(ent* e)
    if (localPlayer->team == e->team)
        return false;
    else return true;

bool ESP::IsValidEnt(ent* ent)
    if (ent)
        if (ent->vTable == 0x4E4A98 || ent->vTable == 0x4E4AC0)
            return true;
    return false;

void ESP::DrawESPBox(ent* e, vec3 screen, GL::Font& font)
    const GLubyte* color = nullptr;

    if (IsTeamGame() && !IsEnemy(e))
        color = rgb::green;
    else color = rgb::red;

    float dist = localPlayer->pos.Distance(e->pos);

    float scale = (GAME_UNIT_MAGIC / dist) * (viewport[2] / VIRTUAL_SCREEN_WIDTH);
    float x = screen.x - scale;
    float y = screen.y - scale * PLAYER_ASPECT_RATIO;
    float width = scale * 2;
    float height = scale * PLAYER_ASPECT_RATIO * 2;

    GL::DrawOutline(x, y, width, height, 2.0f, color);

    float textX = font.centerText(x, width, strlen(e->name) * ESP_FONT_WIDTH);
    float textY = y - ESP_FONT_HEIGHT / 2;
    font.Print(textX, textY, color, "%s", e->name);

void ESP::Draw(GL::Font& font)
    glGetIntegerv(GL_VIEWPORT, viewport);

    for (int i = 0; i < (*numOfPlayers); i++)
        if (IsValidEnt(entlist->ents[i]))
            ent* e = entlist->ents[i];
            vec3 center = e->head;
            center.z = center.z - EYE_HEIGHT + PLAYER_HEIGHT / 2;

            vec3 screenCoords;

            if (WorldToScreen(center, screenCoords, matrix, viewport[2], viewport[3]))
                DrawESPBox(e, screenCoords, font);


Last edited:


Full Member
May 10, 2020
I have been noticing that you always create the function definitions manually in the source files and I'm not sure if you do this for a particular reason. An alternative would be once you declare a bunch of functions in the header, then you select all these declarations, right click on them -> Quick Actions and Refactorings -> Create Declaration / Definition. Then in the source file Visual Studio will create function stubs for all the declarations.
  • Like
Reactions: Kleon742
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods League of Legends Accounts