File: win.hpp

package info (click to toggle)
3ddesktop 0.2.8-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,096 kB
  • ctags: 686
  • sloc: cpp: 5,996; sh: 3,222; makefile: 78
file content (81 lines) | stat: -rw-r--r-- 2,098 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//
//  Copyright (C) 2002 Brad Wasson <bard@systemtoolbox.com>
//
//  This file is part of 3ddesktop.
//
//  3ddesktop is free software; you can redistribute it and/or modify it
//  under the terms of the GNU General Public License as published by
//  the Free Software Foundation; either version 2, or (at your option)
//  any later version.
//
//  3ddesktop is distributed in the hope that it will be useful, but
//  WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with 3ddesktop; see the file COPYING.   If not, write to
//  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
//

#include <GL/glx.h>
#include <Imlib2.h>

class GLWindow {
private:
    Display *display;
    int screen;
    Window win;
    GLXContext ctx;
    XSetWindowAttributes attr;
    XF86VidModeModeInfo deskMode;
    XF86VidModeModeInfo fullscreenMode;

    XVisualInfo *vi;
    Cursor empty_cursor;

    Bool fullscreen;

    int x, y;
    
    unsigned int width, height;
    unsigned int screen_width, screen_height;
    unsigned int depth;    

    unsigned char *screenshot_data;
    Imlib_Context imlib_context;
    //Imlib_Image imgfinal;
    //Imlib_Image img;

public:
    GLWindow ();
    ~GLWindow ();

    int open_display();

    int create_GL_window(char *title, Bool fullscreen);
    int kill_GL_window();

    int hide_GL_window();
    int unhide_GL_window();

    void resize_scene();
    void resize_scene(int w, int h);

    int get_best_texture_size (int current_size);

    int grab_screenshot_data_portion(int x1, int y1, int x2, int y2);
    int grab_screenshot_data();
    
    int load_screenshot_data(GLuint *texture);

    unsigned int get_width();
    unsigned int get_height();
    unsigned int get_screen_width();
    unsigned int get_screen_height();
    Window get_window();
    Display *get_display();
    
    unsigned char *get_screenshot_data_ptr(void);

};