Results 1 to 8 of 8

Thread: Grabbing screenshot of fullscreen game

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2011
    Posts
    3

    Grabbing screenshot of fullscreen game

    Hey all,

    is there anyone who knows how to do this ( it's for counter-strike 1.6 ). I was looking for this but I couldn't find anywhere full code or explanation. I need this in C#.
    Just to say that I am complete beginner in C#

  2. #2
    Member Contributor
    Join Date
    Aug 2011
    Posts
    75

    Re: Grabbing screenshot of fullscreen game

    Maybe look here:

    http://eonstrife.wordpress.com/2007/...l-application/

    I'm also a bit interested in this topic...

  3. #3
    Member Contributor
    Join Date
    Aug 2011
    Posts
    75

    Re: Grabbing screenshot of fullscreen game

    Or from here:

    http://www.flashbang.se/archives/155

    Code :
     
    void screenshot (char filename[160],int x, int y)
    {
     
    // get the image data
    long imageSize = x * y * 3;
    unsigned char *data = new unsigned char[imageSize];
    glReadPixels(0,0,x,y, GL_BGR,GL_UNSIGNED_BYTE,data);
     
    // split x and y sizes into bytes
    int xa= x % 256;
    int xb= (x-xa)/256;
     
    int ya= y % 256;
    int yb= (y-ya)/256;
     
    //assemble the header
    unsigned char header[18]={0,0,2,0,0,0,0,0,0,0,0,0,(char)xa,(char)xb,(char)ya,(char)yb,24,0};
     
    // write header and data to file
    fstream File(filename, ios::out | ios::binary);
    File.write (reinterpret_cast(header), sizeof (char)*18);
    File.write (reinterpret_cast(data), sizeof (char)*imageSize);
    File.close();
     
    delete[] data;
    data=NULL;
    }

    I just get these errors:

    view.cpp:128:31: error: expected < before ( token
    view.cpp:128:31: error: expected type-specifier before ( token
    view.cpp:128:31: error: expected > before ( token
    view.cpp:129:31: error: expected < before ( token
    view.cpp:129:31: error: expected type-specifier before ( token
    view.cpp:129:31: error: expected > before ( token

    At these lines:
    Code :
    File.write (reinterpret_cast(header), sizeof (char)*18);
    File.write (reinterpret_cast(data), sizeof (char)*imageSize);

    I don't understand this error. However, I don't understand reinterpret_cast... Anyone?

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    1,135

    Re: Grabbing screenshot of fullscreen game

    First of all, why would you want to program a feature that already exists? What's it exactly that you want to do? Taking screenshots is already an implemented feature of the Half-Life engine.

  5. #5
    Junior Member Newbie
    Join Date
    Dec 2011
    Posts
    3

    Re: Grabbing screenshot of fullscreen game

    Quote Originally Posted by thokra
    First of all, why would you want to program a feature that already exists? What's it exactly that you want to do? Taking screenshots is already an implemented feature of the Half-Life engine.
    I am trying to make simple Anti Cheat with SS capture and upload to FTP...

  6. #6
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    1,135

    Re: Grabbing screenshot of fullscreen game

    So, if I get you correctly, you want to take screenshots from some running OpenGL app with a seperate app written in C#?

  7. #7
    Junior Member Newbie
    Join Date
    Dec 2011
    Posts
    3

    Re: Grabbing screenshot of fullscreen game

    Yes

  8. #8
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    1,135

    Re: Grabbing screenshot of fullscreen game

    Since I'ver never done this before I'm not quite sure how to realize this exactly. But since you need to read portions of the framebuffer of the OpenGL app you'll either have to integrate your tool with the application directly, or use a shared context so you can access video memory. I doubt this is going to be easy to integrate with the Half-Life engine.

Similar Threads

  1. OpenGL screenShot a game
    By sYnced7 in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 04-29-2013, 09:37 AM
  2. Fullscreen Setup: SuperBible vs. OpenGL Game Progrmmer Books
    By asdf asdf in forum OpenGL: Windows
    Replies: 2
    Last Post: 10-08-2004, 11:21 AM
  3. Taking a screenshot of a moving object and antialias the screenshot
    By pmatos in forum OpenGL: Advanced Coding
    Replies: 6
    Last Post: 11-24-2003, 06:43 AM
  4. Fullscreen game in a window?
    By fengli in forum OpenGL: User Software
    Replies: 0
    Last Post: 08-11-2002, 07:20 AM
  5. glut game-mode window/fullscreen switching?
    By shurcool in forum OpenGL: General
    Replies: 8
    Last Post: 05-17-2002, 08:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean