//#define ZSTEP (1/65536.0)
#define ZSTEP (1/32.0)
+//#define ZSTEP (1/4.0)
typedef struct _fontlist {
gfxfont_t*font;
}
void CALLBACK endCallback(void)
{
- glEnd();
+ glEnd();
}
void CALLBACK vertexCallback(GLvoid *vertex)
{
}
void CALLBACK combineCallbackTex(GLdouble coords[3], GLdouble *data[4], GLfloat w[4], GLdouble **out)
{
- GLdouble *vertex, *texCoord;
+ GLdouble *vertex;
vertex = (GLdouble *) malloc(5 * sizeof(GLdouble));
vertex[0] = coords[0];
vertex[1] = coords[1];
vertex[2] = coords[2];
- texCoord = &vertex[3];
- vertex[3] = w[0]*data[0][3] + w[1]*data[1][3] + w[2]*data[2][3] + w[3]*data[3][3];
- vertex[4] = w[0]*data[0][4] + w[1]*data[1][4] + w[2]*data[2][4] + w[3]*data[3][4];
+ if(data[2] && data[3]) {
+ vertex[3] = w[0]*data[0][3] + w[1]*data[1][3] + w[2]*data[2][3] + w[3]*data[3][3];
+ vertex[4] = w[0]*data[0][4] + w[1]*data[1][4] + w[2]*data[2][4] + w[3]*data[3][4];
+ } else {
+ vertex[3] = w[0]*data[0][3] + w[1]*data[1][3];
+ vertex[4] = w[0]*data[0][4] + w[1]*data[1][4];
+ }
*out = vertex;
}
void opengl_fill(struct _gfxdevice*dev, gfxline_t*line, gfxcolor_t*color)
{
double z;
- dbg("fill");
+ dbg("fill %02x%02x%02x%02x", color->a, color->r, color->g, color->b);
internal_t*i = (internal_t*)dev->internal;
-
+
glDisable(GL_TEXTURE_2D);
glColor4f(color->r/255.0, color->g/255.0, color->b/255.0, color->a/255.0);
gfxhash_t hash;
GLuint texID;
int width, height;
+ unsigned char*data;
struct _imgopengl*next;
} imgopengl_t;
-imgopengl_t*img2texid = 0;
+static imgopengl_t*img2texid = 0;
-gfxhash_t gfximage_hash(gfximage_t*img)
+static gfxhash_t gfximage_hash(gfximage_t*img)
{
int t;
int size = img->width*img->height*4;
return hash;
}
-imgopengl_t*addTexture(gfximage_t*img)
+static void delTextures()
+{
+ imgopengl_t*i = img2texid;
+ while(i) {
+ imgopengl_t*next = i->next;
+ if(i->data) {
+ glDeleteTextures(1, &i->texID);
+ free(i->data);
+ }
+ memset(i, 0, sizeof(imgopengl_t));
+ free(i);
+ i = next;
+ }
+}
+
+static imgopengl_t*addTexture(gfximage_t*img)
{
gfxhash_t hash = gfximage_hash(img);
imgopengl_t*i = img2texid;
i->height = newheight;
unsigned char*data = malloc(newwidth*newheight*4);
+ i->data = data;
int x,y;
for(y=0;y<img->height;y++) {
for(x=0;x<img->width;x++) {
int len = 0;
double*xyz=0;
gfxline_t*l=0;
- glColor4f(1.0,0,0,1.0);
+ glColor4f(1.0,0,0.7,1.0);
i->currentz ++;
-void opengl_drawlink(struct _gfxdevice*dev, gfxline_t*line, char*action)
+void opengl_drawlink(struct _gfxdevice*dev, gfxline_t*line, const char*action)
{
dbg("link");
}
dbg("endpage");
}
-int opengl_result_save(struct _gfxresult*gfx, char*filename)
+int opengl_result_save(struct _gfxresult*gfx, const char*filename)
{
dbg("result:save");
return 0;
}
-void* opengl_result_get(struct _gfxresult*gfx, char*name)
+void* opengl_result_get(struct _gfxresult*gfx, const char*name)
{
dbg("result:get");
return 0;
{
dbg("result:destroy");
free(gfx);
+ delTextures();
}
gfxresult_t*opengl_finish(struct _gfxdevice*dev)