File: 3Dcontext.h

package info (click to toggle)
pdp 1%3A0.14.1%2Bdarcs20180201-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 3,228 kB
  • sloc: ansic: 22,424; asm: 2,088; makefile: 537; perl: 145; sh: 108; cpp: 4
file content (94 lines) | stat: -rw-r--r-- 3,192 bytes parent folder | download | duplicates (4)
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
82
83
84
85
86
87
88
89
90
91
92
93
94
/*
 *   3d render context object
 *   Copyright (c) 2003-2013 by Tom Schouten <tom@zwizwa.be>
 *
 *   This program 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 of the License, or
 *   (at your option) any later version.
 *
 *   This program 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 this program; if not, write to the Free Software
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 */


/* the 3d render context packet: platform independent data structure
   and method prototypes */


#ifndef __zl_3dcontext_h__
#define __zl_3dcontext_h__

#include <stdint.h>
#include "zl/xwindow.h"

typedef struct zl_3Dcontext
{
    uint32_t encoding;            /* the kind of render context */
    uint32_t width;               /* context width */
    uint32_t height;              /* context height */
    uint32_t sub_width;           /* portion that is currently used */
    uint32_t sub_height;
    union {
        zl_xwindow *xwindow;
    } drawable;              /* context's drawable (i.e. Window, GLXPbuffer, ...) */
    void *context;           /* context's context object */

} zl_3Dcontext;

#define ZL_3DCONTEXT_WINDOW  1  /* window context packet id */
#define ZL_3DCONTEXT_PBUFFER 2  /* pbuf context packet id */


/* all symbols are C-style */
#ifdef __cplusplus
extern "C"
{
#endif
    uint32_t zl_3Dcontext_width(zl_3Dcontext *c);
    uint32_t zl_3Dcontext_height(zl_3Dcontext *c);
    uint32_t zl_3Dcontext_subwidth(zl_3Dcontext *c);
    uint32_t zl_3Dcontext_subheight(zl_3Dcontext *c);
    float zl_3Dcontext_subaspect(zl_3Dcontext *c);

    /* setters */
    void zl_3Dcontext_set_subwidth(zl_3Dcontext *c, uint32_t w);
    void zl_3Dcontext_set_subheight(zl_3Dcontext *c, uint32_t h);

    /* render context activation and initialization */
    void zl_3Dcontext_set_rendering_context(zl_3Dcontext *c);
    void zl_3Dcontext_unset_rendering_context(zl_3Dcontext *c);
    void zl_3Dcontext_setup_3d_context(zl_3Dcontext *c);
    void zl_3Dcontext_setup_2d_context(zl_3Dcontext *c);

    /* constructors */
    zl_3Dcontext* zl_3Dcontext_pbuf_new(uint32_t width, uint32_t height, uint32_t depth);
    zl_3Dcontext* zl_3Dcontext_win_new(void);

    /* window specific methods, just return window instance? */
    void zl_3Dcontext_win_resize(zl_3Dcontext *c, int width, int height);
    void zl_3Dcontext_win_cursor(zl_3Dcontext *c, int toggle);
    void zl_3Dcontext_for_parsed_events(zl_3Dcontext *c, zl_receiver recever, void *context);
    void zl_3Dcontext_win_swapbuffers(zl_3Dcontext *c);

    /* converters */
    void zl_3Dcontext_snap_to_bitmap(zl_3Dcontext *c, int w, int h, void *data);

    void zl_3Dcontext_free(zl_3Dcontext *c);

    /* global setup */
    void zl_3Dcontext_glx_setup(void);


#ifdef __cplusplus
}
#endif

#endif