removed initialization stuff
[swftools.git] / lib / devices / opengl.c
1 #include <stdlib.h>
2 #include <stdio.h>
3 #include <string.h>
4
5 #include "../gfxdevice.h"
6 #include "../gfxtools.h"
7
8 #include <time.h>
9 #include <GL/gl.h>
10 #include <GL/glut.h>
11
12 #include <setjmp.h>
13
14 typedef struct _fontlist {
15     gfxfont_t*font;
16     char*id;
17     struct _fontlist*next;
18 } fontlist_t;
19
20 typedef struct _internal {
21     gfxfont_t*font;
22     char*fontid;
23     fontlist_t* fontlist;
24     int width, height;
25 } internal_t;
26
27 int opengl_setparameter(struct _gfxdevice*dev, const char*key, const char*value)
28 {
29     return 0;
30 }
31
32 void opengl_startpage(struct _gfxdevice*dev, int width, int height)
33 {
34     internal_t*i = (internal_t*)dev->internal;
35     i->width = width;
36     i->height = height;
37 }
38
39 void opengl_startclip(struct _gfxdevice*dev, gfxline_t*line)
40 {
41     int t;
42     for(t=1;t<100;t++) {
43         glColor3f(1.0,1.0,1.0);
44         glBegin(GL_POLYGON);
45             glVertex3f(-t*10,-t*10,0);
46             glVertex3f(-t*10,t*10,0);
47             glVertex3f(t*10,t*10,0);
48             glVertex3f(t*10,-t*10,0);
49         glEnd();
50     }
51     //glRectf(-50,-50,0.0,0.0);
52 }
53
54 void opengl_endclip(struct _gfxdevice*dev)
55 {
56 }
57
58 void opengl_stroke(struct _gfxdevice*dev, gfxline_t*line, gfxcoord_t width, gfxcolor_t*color, gfx_capType cap_style, gfx_joinType joint_style, gfxcoord_t miterLimit)
59 {
60 }
61
62 void opengl_fill(struct _gfxdevice*dev, gfxline_t*line, gfxcolor_t*color)
63 {
64 }
65
66 void opengl_fillbitmap(struct _gfxdevice*dev, gfxline_t*line, gfximage_t*img, gfxmatrix_t*matrix, gfxcxform_t*cxform)
67 {
68 }
69
70 void opengl_fillgradient(struct _gfxdevice*dev, gfxline_t*line, gfxgradient_t*gradient, gfxgradienttype_t type, gfxmatrix_t*matrix)
71 {
72 }
73
74 void opengl_addfont(struct _gfxdevice*dev, char*fontid, gfxfont_t*font)
75 {
76 }
77
78 void opengl_drawchar(struct _gfxdevice*dev, char*fontid, int glyph, gfxcolor_t*color, gfxmatrix_t*matrix)
79 {
80 }
81
82 void opengl_drawlink(struct _gfxdevice*dev, gfxline_t*line, char*action)
83 {
84 }
85
86 void opengl_endpage(struct _gfxdevice*dev)
87 {
88 }
89
90
91 int opengl_result_save(struct _gfxresult*gfx, char*filename)
92 {
93     return 0;
94 }
95 void* opengl_result_get(struct _gfxresult*gfx, char*name)
96 {
97     return 0;
98 }
99 void opengl_result_destroy(struct _gfxresult*gfx)
100 {
101     free(gfx);
102 }
103
104 gfxresult_t*opengl_finish(struct _gfxdevice*dev)
105 {
106     internal_t*i = (internal_t*)dev->internal;
107     gfxresult_t*result = (gfxresult_t*)malloc(sizeof(gfxresult_t));
108     memset(result, 0, sizeof(gfxresult_t));
109     result->save = opengl_result_save;
110     result->get = opengl_result_get;
111     result->destroy = opengl_result_destroy;
112     return result;
113 }
114
115 void gfxdevice_opengl_init(gfxdevice_t*dev)
116 {
117     internal_t*i = (internal_t*)rfx_calloc(sizeof(internal_t));
118     memset(dev, 0, sizeof(gfxdevice_t));
119
120     dev->internal = i;
121     
122     dev->setparameter = opengl_setparameter;
123     dev->startpage = opengl_startpage;
124     dev->startclip = opengl_startclip;
125     dev->endclip = opengl_endclip;
126     dev->stroke = opengl_stroke;
127     dev->fill = opengl_fill;
128     dev->fillbitmap = opengl_fillbitmap;
129     dev->fillgradient = opengl_fillgradient;
130     dev->addfont = opengl_addfont;
131     dev->drawchar = opengl_drawchar;
132     dev->drawlink = opengl_drawlink;
133     dev->endpage = opengl_endpage;
134     dev->finish = opengl_finish;
135 }