• Amused
  • Angry
  • Annoyed
  • Awesome
  • Bemused
  • Cocky
  • Cool
  • Crazy
  • Crying
  • Down
  • Drunk
  • Embarrased
  • Enraged
  • Friendly
  • Geeky
  • Godly
  • Happy
  • Hateful
  • Hungry
  • Innocent
  • Meh
  • Piratey
  • Poorly
  • Sad
  • Secret
  • Shy
  • Sneaky
  • Tired
  • Wtf
  • At Work
  • CodenzHub
  • Coding
  • Deejaying
  • Donating
  • Drinking
  • Eating
  • Editing
  • Hacking
  • Hate Mailing
  • Jamin'
  • Lagging
  • Live Streaming
  • Lurking
  • No Status
  • Pawning
  • PC Gaming
  • PS Gaming
  • Raging
  • Reversing
  • Sipping
  • Sleeping
  • Steam Gaming
  • Trolling
  • TwitchStreamer
  • Vodka!
  • Watching TV/Movie
  • Xbox Gaming
  • Youtuber
  • Zombies
  • Results 1 to 7 of 7
    1. #1
      Newbie
      Learning to hack games!
       
      Feeling Normal
       
      g3m3c's Avatar
      Join Date
      Aug 2017
      Posts
      10
      Thanks (-->)
      0
      Thanks (<--)
      0

      Drawing functions in OpenGL does not draw in wglSwapBuffers

      How to Call Game Functions
      Code:
      void FillBox(int x, int y, int w, int h, BYTE r, BYTE g, BYTE b, BYTE a = 255)
      {
      	glPushMatrix();
      	glLoadIdentity();
      	glDisable(GL_TEXTURE_2D);
      	glEnable(GL_BLEND);
      	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
      	glColor4ub(r, g, b, a);
      	glBegin(GL_QUADS);
      	glVertex2i(x, y);
      	glVertex2i(x + w, y);
      	glVertex2i(x + w, y + h);
      	glVertex2i(x, y + h);
      	glEnd();
      	glDisable(GL_BLEND);
      	glEnable(GL_TEXTURE_2D);
      	glPopMatrix();
      }
      
      BOOL WINAPI wglSwapBuffers(HDC hdc)
      {
      	FillBox(50, 50, 100, 100, 255, 000, 000);
      	add_log("wglSwapBuffers!\n");
      	return owglSwapBuffers(hdc);
      }
      Why does not it show up?

      Game: Counter-Strike 1.6

    2. #2
      Newbie
      Learning to hack games!
       
      Feeling Normal
       
      speedy9's Avatar
      Join Date
      Jan 2017
      Posts
      4
      Thanks (-->)
      0
      Thanks (<--)
      0
      are you sure your wglSwapBuffers hook is working? How did you hook it?

    3. #3
      Newbie
      Learning to hack games!
       
      Feeling Normal
       
      g3m3c's Avatar
      Join Date
      Aug 2017
      Posts
      10
      Thanks (-->)
      0
      Thanks (<--)
      0
      Quote Originally Posted by speedy9 View Post
      are you sure your wglSwapBuffers hook is working? How did you hook it?
      Yes, I have 100% sure that it is working, I made the hook using MS Detours, including until I added a log function inside the hook and it worked perfectly, the problem is that nothing draws in wglSwapBuffers, however the same code works in glBegin, glEnable.

    4. #4
      Newbie
      Learning to hack games!
       
      Feeling Normal
       
      speedy9's Avatar
      Join Date
      Jan 2017
      Posts
      4
      Thanks (-->)
      0
      Thanks (<--)
      0
      try saving/restoring renderstates
      Code:
      void FillBox(int x, int y, int w, int h, BYTE r, BYTE g, BYTE b, BYTE a = 255)
      {
      	// save OpenGL state
      	glPushAttrib(GL_ALL_ATTRIB_BITS);
      
      	glPushMatrix();
      	//..
      	glPopMatrix();
      
      	// restore OpenGL state 
      	glPopAttrib();
      }

    5. #5
      Newbie
      Learning to hack games!
       
      Feeling Normal
       
      g3m3c's Avatar
      Join Date
      Aug 2017
      Posts
      10
      Thanks (-->)
      0
      Thanks (<--)
      0
      Quote Originally Posted by speedy9 View Post
      try saving/restoring renderstates
      Code:
      void FillBox(int x, int y, int w, int h, BYTE r, BYTE g, BYTE b, BYTE a = 255)
      {
      	// save OpenGL state
      	glPushAttrib(GL_ALL_ATTRIB_BITS);
      
      	glPushMatrix();
      	//..
      	glPopMatrix();
      
      	// restore OpenGL state 
      	glPopAttrib();
      }
      Did not work, continues the same thing without showing anything.

    6. #6
      Administrator
      Hacked By Jesus
       
      Sipping
       
      [GH]Rake's Avatar
      Join Date
      Jan 2014
      Location
      USA
      Posts
      3,831
      Thanks (-->)
      958
      Thanks (<--)
      1151
      @g3m3c when you draw 2d you need to setup an orthagraphic view matrix

      Draw in between these 2 functions, every game is different and will need minor modification, your glOrtho() has to match the one the game uses, they have different ranges -1 +1 etc...


      void GL::SetupOrtho()
      {
      glPushAttrib(GL_ALL_ATTRIB_BITS);
      glPushMatrix();
      GLint viewport[4];
      glGetIntegerv(GL_VIEWPORT, viewport);
      glViewport(0, 0, viewport[2], viewport[3]);
      glMatrixMode(GL_PROJECTION);
      glLoadIdentity();
      glOrtho(0, viewport[2], viewport[3], 0, -1, 1);
      glMatrixMode(GL_MODELVIEW);
      glLoadIdentity();
      glDisable(GL_DEPTH_TEST);
      }

      void GL::RestoreGL()
      {
      glPopMatrix();
      glPopAttrib();
      }

    7. #7
      Newbie
      Learning to hack games!
       
      Feeling Normal
       
      g3m3c's Avatar
      Join Date
      Aug 2017
      Posts
      10
      Thanks (-->)
      0
      Thanks (<--)
      0
      Advertise on GuidedHacking
      Quote Originally Posted by [GH]Rake View Post
      @g3m3c when you draw 2d you need to setup an orthagraphic view matrix

      Draw in between these 2 functions, every game is different and will need minor modification, your glOrtho() has to match the one the game uses, they have different ranges -1 +1 etc...


      void GL::SetupOrtho()
      {
      glPushAttrib(GL_ALL_ATTRIB_BITS);
      glPushMatrix();
      GLint viewport[4];
      glGetIntegerv(GL_VIEWPORT, viewport);
      glViewport(0, 0, viewport[2], viewport[3]);
      glMatrixMode(GL_PROJECTION);
      glLoadIdentity();
      glOrtho(0, viewport[2], viewport[3], 0, -1, 1);
      glMatrixMode(GL_MODELVIEW);
      glLoadIdentity();
      glDisable(GL_DEPTH_TEST);
      }

      void GL::RestoreGL()
      {
      glPopMatrix();
      glPopAttrib();
      }
      Thank you brother, problem solved :P

    Similar Game Hacker Threads

    1. [Release] OpenGL Drawing Class
      By Solaire in forum Direct-X, OpenGL
      Replies: 7
      Last Post: 03-18-2016, 06:05 PM
    2. [Help] OpenGL drawing issue
      By [GH]Rake in forum Direct-X, OpenGL
      Replies: 8
      Last Post: 02-09-2016, 10:16 PM
    3. [Source Code] [OpenGL] Draw a crosshair
      By [GH]Rake in forum Direct-X, OpenGL
      Replies: 3
      Last Post: 05-27-2015, 02:54 PM
    4. Replies: 2
      Last Post: 05-26-2015, 08:18 AM
    5. Drawing In OpenGL
      By Solaire in forum Direct-X, OpenGL
      Replies: 3
      Last Post: 01-27-2015, 07:00 PM