Solved OpenGL hooking issue

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

Liduen

Hacker
Dank Tier VIP
May 19, 2013
702
8,478
33
Hey guys,

I hooked the opengl function
C++:
void WINAPI glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices)
This is my function:
C++:
void WINAPI Hooked_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices)
{
	glColor4f(0.0f, 1.0f, 1.0f, 1.0f);
	(*pglBegin)(GL_LINE_STRIP); // already used: GL_LINE_LOOP, GL_LINES, GL_LINE_STRIP, GL_QUADS -> everytime this weird stuff
	glVertex3f(10.0, 10.0, 0.0);
	glVertex3f(10.0, 20.0, 0.0);
	glVertex3f(20.0, 20.0, 0.0);
	glVertex3f(20.0, 10.0, 0.0);
	(*pglEnd)();
	glColor4f(1.0f, 1.0f, 1.0f, 0.0f);

	//glRectf(10.0f, 10.0f, 50.0f, 50.0f); // -> same problem

	(*pglDrawElements)(mode, count, type, indices);
}
Now I get these random weird rectangles in the game.
Obviously I used GL_QUADS when taking these pictures, but it's the same problem with all the others modes listed above.
I just want to draw the simple rectangle in the upper left corner (as you can see I've managed to do that), but there are also many rectangles I didn't want to draw but got drawn anyway. :confused:


https://i.imgur.com/5MO4hSf.jpg


https://i.imgur.com/8ohWnja.jpg

How can I get rid of these weird rectangles and stuff?

Liduen
 

Liduen

Hacker
Dank Tier VIP
May 19, 2013
702
8,478
33
Okay by using these commands before and after, the problem is solved:

C++:
		glPushMatrix();
		glLoadIdentity();
		glDisable(GL_TEXTURE_2D);

		glColor4f(1.0f, 0.0f, 0.0f, 1.0f);
		(*pglBegin)(GL_TRIANGLE_STRIP);
		glVertex3f...
		(*pglEnd)();

		glPopMatrix();
		glEnable(GL_TEXTURE_2D);
credits: Zooom


But now I'm having heavy fps drops of about 60 fps (from ~125 to ~60).
The more I draw the heavier the fps drops become. Any ideas?


I guess glDrawElements() gets called more than once per frame, therefore I experience these heavy fps drops.
Does somebody know a function which gets called only once per frame?
 
Last edited:

Liduen

Hacker
Dank Tier VIP
May 19, 2013
702
8,478
33
Thats for Direct X. try making an FPS using the function you're currently hooking and compare with the Game FPS
Yes that could be at least a way to determine wether the functions gets called more than once per frame or not.
But I'm pretty sure that it gets called more than once, otherwise I could'nt explain this heavy fps drop.
Therefor this wouldn't really help me.

Maybe I can count the the calls on this function over a second and then only draw my stuff once in one thousand calls...
Maybe I'll try this out tomorow. Thank you for this idea! :)

dmo As the title says I'm hooking openGl here, not directX.
 

Liduen

Hacker
Dank Tier VIP
May 19, 2013
702
8,478
33
Okay so I tested how often the function I hooked gets called.
Calls per second: 195731
Normal game FPS: 125
So I tried to draw only 125 times per seconds just as my normal FPS. This results in heavy flickering because other stuff gets drawn over it too quickly.
I think hooking glDrawElements is not a good idea to draw an ESP.

Does really nobody know a good function to hook in the opengl library, which gets only called once per frame??
 

Liduen

Hacker
Dank Tier VIP
May 19, 2013
702
8,478
33
Yeah I just hooked SwapBuffers from from gdi32.dll and it works perfectly.
I think I tried to hook SwapBuffers in the opengl32.dll back then lol.

Somehow the GL_QUADS and GL_TRIANGLE_STRIP aren't drawn when I'm playing. When I'm in the menu they get drawn. Weird.
But I can live without them- GL_LINE_LOOP ftw. :D

Thank you all for your help!
I'll soon post some screenshots of my hack :D
 
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