ref: 3b961717be648d0810bb364e3cacbd4be8f7ce0b
parent: 892f234fe310efceac0cf20aed5f4c80c92b5909
author: David <gek@katherine>
date: Sun Feb 14 16:04:32 EST 2021
Using GL types in code
--- a/src/api.c
+++ b/src/api.c
@@ -136,7 +136,7 @@
glTexCoord4f(v[0],v[1],0,1);
}
-void glEdgeFlag(int flag)
+void glEdgeFlag(GLint flag)
{
GLParam p[2];
@@ -148,7 +148,7 @@
/* misc */
-void glShadeModel(int mode)
+void glShadeModel(GLint mode)
{
GLParam p[2];
@@ -160,7 +160,7 @@
gl_add_op(p);
}
-void glCullFace(int mode)
+void glCullFace(GLint mode)
{
GLParam p[2];
@@ -174,7 +174,7 @@
gl_add_op(p);
}
-void glFrontFace(int mode)
+void glFrontFace(GLint mode)
{
GLParam p[2];
@@ -188,7 +188,7 @@
gl_add_op(p);
}
-void glPolygonMode(int face,int mode)
+void glPolygonMode(GLint face,GLint mode)
{
GLParam p[3];
@@ -207,7 +207,7 @@
/* glEnable / glDisable */
-void glEnable(int cap)
+void glEnable(GLint cap)
{
GLParam p[3];
@@ -218,7 +218,7 @@
gl_add_op(p);
}
-void glDisable(int cap)
+void glDisable(GLint cap)
{
GLParam p[3];
@@ -231,7 +231,7 @@
/* glBegin / glEnd */
-void glBegin(int mode)
+void glBegin(GLint mode)
{
GLParam p[2];
@@ -252,7 +252,7 @@
/* matrix */
-void glMatrixMode(int mode)
+void glMatrixMode(GLint mode)
{
GLParam p[2];
@@ -349,7 +349,7 @@
}
-void glViewport(int x,int y,int width,int height)
+void glViewport(GLint x,GLint y,GLint width,GLint height)
{
GLParam p[5];
@@ -362,8 +362,8 @@
gl_add_op(p);
}
-void glFrustum(double left,double right,double bottom,double top,
- double near,double farv)
+void glFrustum(GLdouble left,GLdouble right,GLdouble bottom,GLdouble top,
+ GLdouble near,GLdouble farv)
{
GLParam p[7];
@@ -380,7 +380,7 @@
/* lightening */
-void glMaterialfv(int mode,int type,GLfloat *v)
+void glMaterialfv(GLint mode,GLint type,GLfloat *v)
{
GLParam p[7];
GLint i,n;
@@ -398,7 +398,7 @@
gl_add_op(p);
}
-void glMaterialf(int mode,int type,GLfloat v)
+void glMaterialf(GLint mode,GLint type,GLfloat v)
{
GLParam p[7];
GLint i;
@@ -412,7 +412,7 @@
gl_add_op(p);
}
-void glColorMaterial(int mode,int type)
+void glColorMaterial(GLint mode,GLint type)
{
GLParam p[3];
@@ -423,7 +423,7 @@
gl_add_op(p);
}
-void glLightfv(int light,int type,GLfloat *v)
+void glLightfv(GLint light,GLint type,GLfloat *v)
{
GLParam p[7];
GLint i;
@@ -438,7 +438,7 @@
}
-void glLightf(int light,int type,GLfloat v)
+void glLightf(GLint light,GLint type,GLfloat v)
{
GLParam p[7];
GLint i;
@@ -452,7 +452,7 @@
gl_add_op(p);
}
-void glLightModeli(int pname,int param)
+void glLightModeli(GLint pname,GLint param)
{
GLParam p[6];
@@ -467,7 +467,7 @@
gl_add_op(p);
}
-void glLightModelfv(int pname,GLfloat *param)
+void glLightModelfv(GLint pname,GLfloat *param)
{
GLParam p[6];
GLint i;
@@ -481,7 +481,7 @@
/* clear */
-void glClear(int mask)
+void glClear(GLint mask)
{
GLParam p[2];
@@ -504,7 +504,7 @@
gl_add_op(p);
}
-void glClearDepth(double depth)
+void glClearDepth(GLdouble depth)
{
GLParam p[2];
@@ -538,7 +538,7 @@
}
-void glBindTexture(int target,int texture)
+void glBindTexture(GLint target,GLint texture)
{
GLParam p[3];
@@ -549,7 +549,7 @@
gl_add_op(p);
}
-void glTexEnvi(int target,int pname,int param)
+void glTexEnvi(GLint target,GLint pname,GLint param)
{
GLParam p[8];
@@ -565,7 +565,7 @@
gl_add_op(p);
}
-void glTexParameteri(int target,int pname,int param)
+void glTexParameteri(GLint target,GLint pname,GLint param)
{
GLParam p[8];
@@ -581,7 +581,7 @@
gl_add_op(p);
}
-void glPixelStorei(int pname,int param)
+void glPixelStorei(GLint pname,GLint param)
{
GLParam p[3];
@@ -659,7 +659,7 @@
/* nothing to do */
}
-void glHint(int target,int mode)
+void glHint(GLint target,GLint mode)
{
GLParam p[3];
@@ -672,7 +672,7 @@
/* Non standard functions */
-void glDebug(int mode)
+void glDebug(GLint mode)
{
GLContext *c=gl_get_context();
c->print_flag=mode;
--- a/src/clear.c
+++ b/src/clear.c
@@ -18,9 +18,9 @@
{
GLint mask=p[1].i;
GLint z=0;
- GLint r=(int)(c->clear_color.v[0]*65535);
- GLint g=(int)(c->clear_color.v[1]*65535);
- GLint b=(int)(c->clear_color.v[2]*65535);
+ GLint r=(GLint)(c->clear_color.v[0]*65535);
+ GLint g=(GLint)(c->clear_color.v[1]*65535);
+ GLint b=(GLint)(c->clear_color.v[2]*65535);
/* TODO : correct value of Z */
--- a/src/clip.c
+++ b/src/clip.c
@@ -16,11 +16,11 @@
/* coordinates */
winv=1.0/v->pc.W;
- v->zp.x= (int) ( v->pc.X * winv * c->viewport.scale.X
+ v->zp.x= (GLint) ( v->pc.X * winv * c->viewport.scale.X
+ c->viewport.trans.X );
- v->zp.y= (int) ( v->pc.Y * winv * c->viewport.scale.Y
+ v->zp.y= (GLint) ( v->pc.Y * winv * c->viewport.scale.Y
+ c->viewport.trans.Y );
- v->zp.z= (int) ( v->pc.Z * winv * c->viewport.scale.Z
+ v->zp.z= (GLint) ( v->pc.Z * winv * c->viewport.scale.Z
+ c->viewport.trans.Z );
/* color */
//if (c->lighting_enabled) {
@@ -40,15 +40,15 @@
/* texture */
if (c->texture_2d_enabled) {
- v->zp.s=(int)(v->tex_coord.X * (ZB_POINT_S_MAX - ZB_POINT_S_MIN)
+ v->zp.s=(GLint)(v->tex_coord.X * (ZB_POINT_S_MAX - ZB_POINT_S_MIN)
+ ZB_POINT_S_MIN);
- v->zp.t=(int)(v->tex_coord.Y * (ZB_POINT_T_MAX - ZB_POINT_T_MIN)
+ v->zp.t=(GLint)(v->tex_coord.Y * (ZB_POINT_T_MAX - ZB_POINT_T_MIN)
+ ZB_POINT_T_MIN);
}
}
-static void gl_add_select1(GLContext *c,int z1,int z2,int z3)
+static void gl_add_select1(GLContext *c,GLint z1,GLint z2,GLint z3)
{
GLuint min,max;
min=max=z1;
@@ -248,7 +248,7 @@
}
static void gl_draw_triangle_clip(GLContext *c,
- GLVertex *p0,GLVertex *p1,GLVertex *p2,int clip_bit);
+ GLVertex *p0,GLVertex *p1,GLVertex *p2,GLint clip_bit);
void gl_draw_triangle(GLContext *c,
GLVertex *p0,GLVertex *p1,GLVertex *p2)
@@ -302,7 +302,7 @@
}
static void gl_draw_triangle_clip(GLContext *c,
- GLVertex *p0,GLVertex *p1,GLVertex *p2,int clip_bit)
+ GLVertex *p0,GLVertex *p1,GLVertex *p2,GLint clip_bit)
{
GLint co,c_and,co1,cc[3],edge_flag_tmp,clip_mask;
GLVertex tmp1,tmp2,*q[3];
--- a/src/get.c
+++ b/src/get.c
@@ -1,6 +1,6 @@
#include "zgl.h"
-void glGetIntegerv(int pname,int *params)
+void glGetIntegerv(GLint pname,GLint *params)
{
GLContext *c=gl_get_context();
@@ -32,7 +32,7 @@
}
}
-void glGetFloatv(int pname, GLfloat *v)
+void glGetFloatv(GLint pname, GLfloat *v)
{
GLint i;
GLint mnr = 0; /* just a trick to return the correct matrix */
--- a/src/image_util.c
+++ b/src/image_util.c
@@ -5,7 +5,7 @@
*/
void gl_convertRGB_to_5R6G5B(unsigned short *pixmap,GLubyte *rgb,
- GLint xsize,int ysize)
+ GLint xsize,GLint ysize)
{
GLint i,n;
GLubyte *p;
@@ -43,7 +43,7 @@
#define INTERP_NORM_BITS 16
#define INTERP_NORM (1 << INTERP_NORM_BITS)
-static inline GLint GLinterpolate(int v00,int v01,int v10,int xf,int yf)
+static inline GLint GLinterpolate(GLint v00,GLint v01,GLint v10,GLint xf,GLint yf)
{
return v00+(((v01-v00)*xf + (v10-v00)*yf) >> INTERP_NORM_BITS);
}
@@ -53,8 +53,8 @@
* TODO: more accurate resampling
*/
-void gl_resizeImage(GLubyte *dest,int xsize_dest,int ysize_dest,
- GLubyte *src,int xsize_src,int ysize_src)
+void gl_resizeImage(GLubyte *dest,GLint xsize_dest,GLint ysize_dest,
+ GLubyte *src,GLint xsize_src,GLint ysize_src)
{
GLubyte *pix,*pix_src;
GLfloat x1,y1,x1inc,y1inc;
@@ -70,10 +70,10 @@
for(y=0;y<ysize_dest;y++) {
x1=0;
for(x=0;x<xsize_dest;x++) {
- xi=(int) x1;
- yi=(int) y1;
- xf=(int) ((x1 - floor(x1)) * INTERP_NORM);
- yf=(int) ((y1 - floor(y1)) * INTERP_NORM);
+ xi=(GLint) x1;
+ yi=(GLint) y1;
+ xf=(GLint) ((x1 - floor(x1)) * INTERP_NORM);
+ yf=(GLint) ((y1 - floor(y1)) * INTERP_NORM);
if ((xf+yf) <= INTERP_NORM) {
for(j=0;j<3;j++) {
@@ -104,8 +104,8 @@
/* resizing with no GLinterlating nor nearest pixel */
-void gl_resizeImageNoInterpolate(GLubyte *dest,int xsize_dest,int ysize_dest,
- GLubyte *src,int xsize_src,int ysize_src)
+void gl_resizeImageNoInterpolate(GLubyte *dest,GLint xsize_dest,GLint ysize_dest,
+ GLubyte *src,GLint xsize_src,GLint ysize_src)
{
GLubyte *pix,*pix_src,*pix1;
GLint x1,y1,x1inc,y1inc;
@@ -114,8 +114,8 @@
pix=dest;
pix_src=src;
- x1inc=(int)((GLfloat) ((xsize_src)<<FRAC_BITS) / (GLfloat) (xsize_dest));
- y1inc=(int)((GLfloat) ((ysize_src)<<FRAC_BITS) / (GLfloat) (ysize_dest));
+ x1inc=(GLint)((GLfloat) ((xsize_src)<<FRAC_BITS) / (GLfloat) (xsize_dest));
+ y1inc=(GLint)((GLfloat) ((ysize_src)<<FRAC_BITS) / (GLfloat) (ysize_dest));
y1=0;
for(y=0;y<ysize_dest;y++) {
--- a/src/init.c
+++ b/src/init.c
@@ -131,7 +131,7 @@
c->current_shade_model=GL_SMOOTH;
c->cull_face_enabled=0;
c->zb->dostipple = 0;
- for(int i = 0; i < 128; i++)
+ for(GLint i = 0; i < 128; i++)
c->zb->stipplepattern[i] = 0xFF;
/* clear */
c->clear_color.v[0]=0;
--- a/src/light.c
+++ b/src/light.c
@@ -165,10 +165,10 @@
c->ambient_light_model.v[i] = p[2+i].f;
break;
case GL_LIGHT_MODEL_LOCAL_VIEWER:
- c->local_light_model=(int)v[0];
+ c->local_light_model=(GLint)v[0];
break;
case GL_LIGHT_MODEL_TWO_SIDE:
- c->light_model_two_side = (int)v[0];
+ c->light_model_two_side = (GLint)v[0];
break;
default:
tgl_warning("glopLightModel: illegal pname: 0x%x\n", pname);
@@ -185,7 +185,7 @@
else return a;
}
-void gl_enable_disable_light(GLContext *c,int light,int v)
+void gl_enable_disable_light(GLContext *c,GLint light,GLint v)
{
GLLight *l=&c->lights[light];
if (v && !l->enabled) {
@@ -203,7 +203,7 @@
//FEATURES
int zEnableSpecular = 1; //Enable specular lighting
-void glSetEnableSpecular(int s){
+void glSetEnableSpecular(GLint s){
zEnableSpecular = s;
}
/* non optimized lightening model */
@@ -314,7 +314,7 @@
/* testing specular buffer code */
/* dot_spec= pow(dot_spec,m->shininess);*/
specbuf = specbuf_get_buffer(c, m->shininess_i, m->shininess);
- idx = (int)(dot_spec*SPECULAR_BUFFER_SIZE);
+ idx = (GLint)(dot_spec*SPECULAR_BUFFER_SIZE);
if (idx > SPECULAR_BUFFER_SIZE) idx = SPECULAR_BUFFER_SIZE;
dot_spec = specbuf->buf[idx];
lR+=dot_spec * l->specular.v[0] * m->specular.v[0];
--- a/src/list.c
+++ b/src/list.c
@@ -33,7 +33,7 @@
}
-static void delete_list(GLContext *c,int list)
+static void delete_list(GLContext *c,GLint list)
{
GLParamBuffer *pb,*pb1;
GLList *l;
@@ -61,7 +61,7 @@
delete_list(gl_get_context(), list);
}
-static GLList *alloc_list(GLContext *c,int list)
+static GLList *alloc_list(GLContext *c,GLint list)
{
GLList *l;
GLParamBuffer *ob;
@@ -195,7 +195,7 @@
-void glNewList(GLuint list,int mode)
+void glNewList(GLuint list,GLint mode)
{
GLList *l;
GLContext *c=gl_get_context();
@@ -237,7 +237,7 @@
return (l != NULL);
}
-GLuint glGenLists(int range)
+GLuint glGenLists(GLint range)
{
GLContext *c=gl_get_context();
GLint count,i,list;
--- a/src/memory.c
+++ b/src/memory.c
@@ -10,12 +10,12 @@
free(p);
}
-void *gl_malloc(int size)
+void *gl_malloc(GLint size)
{
return malloc(size);
}
-void *gl_zalloc(int size)
+void *gl_zalloc(GLint size)
{
return calloc(1, size);
}
--- a/src/misc.c
+++ b/src/misc.c
@@ -9,7 +9,7 @@
GLContext *c=gl_get_context();
ZBuffer *zb = c->zb;
- for(int i = 0; i < TGL_POLYGON_STIPPLE_BYTES; i++)
+ for(GLint i = 0; i < TGL_POLYGON_STIPPLE_BYTES; i++)
{
zb->stipplepattern[i] = b[i];
}
--- a/src/quick.sh
+++ b/src/quick.sh
@@ -7,6 +7,6 @@
#sed -i 's/float/GLfloat/g' *.c *.h
#sed -i 's/char/GLbyte/g' *.c *.h
#sed -i 's/unsigned GLbyte/GLubyte/g' *.c *.h
-#sed -i 's/ int/ GLint/g' *.c *.h
+sed -i 's/double/GLdouble/g' *.c *.h
#gcc *.c -o executable.out -lglut -lGL -lm -lGLU
--- a/src/select.c
+++ b/src/select.c
@@ -1,6 +1,6 @@
#include "zgl.h"
-int glRenderMode(int mode)
+int glRenderMode(GLint mode)
{
GLContext *c=gl_get_context();
GLint result=0;
@@ -39,7 +39,7 @@
return result;
}
-void glSelectBuffer(int size,GLuint *buf)
+void glSelectBuffer(GLint size,GLuint *buf)
{
GLContext *c=gl_get_context();
--- a/src/texture.c
+++ b/src/texture.c
@@ -4,7 +4,7 @@
#include "zgl.h"
-static GLTexture *find_texture(GLContext *c,int h)
+static GLTexture *find_texture(GLContext *c,GLint h)
{
GLTexture *t;
@@ -16,7 +16,7 @@
return NULL;
}
-void* glGetTexturePixmap(int text, GLint level, GLint* xsize, GLint* ysize){
+void* glGetTexturePixmap(GLint text, GLint level, GLint* xsize, GLint* ysize){
GLTexture* tex;
GLContext *c=gl_get_context();
assert(text >= 0 && level < MAX_TEXTURE_LEVELS);
@@ -27,7 +27,7 @@
return tex->images[level].pixmap;
}
-static void free_texture(GLContext *c,int h)
+static void free_texture(GLContext *c,GLint h)
{
GLTexture *t,**ht;
GLImage *im;
@@ -51,7 +51,7 @@
gl_free(t);
}
-GLTexture *alloc_texture(GLContext *c,int h)
+GLTexture *alloc_texture(GLContext *c,GLint h)
{
GLTexture *t,**ht;
@@ -78,7 +78,7 @@
c->current_texture=find_texture(c,0);
}
-void glGenTextures(int n, GLuint *textures)
+void glGenTextures(GLint n, GLuint *textures)
{
GLContext *c=gl_get_context();
GLint max,i;
@@ -99,7 +99,7 @@
}
-void glDeleteTextures(int n, const GLuint *textures)
+void glDeleteTextures(GLint n, const GLuint *textures)
{
GLContext *c=gl_get_context();
GLint i;
--- a/src/vertex.c
+++ b/src/vertex.c
@@ -218,7 +218,7 @@
/* quick fix to avoid crashes on large polygons */
if (n >= c->vertex_max) {
GLVertex *newarray;
- c->vertex_max <<= 1; /* just double size */
+ c->vertex_max <<= 1; /* just GLdouble size */
newarray = gl_malloc(sizeof(GLVertex) * c->vertex_max);
if (!newarray) {
gl_fatal_error("unable to allocate GLVertex array.\n");
--- a/src/zbuffer.c
+++ b/src/zbuffer.c
@@ -10,7 +10,7 @@
//#include "../include/GL/gl.h"
#include "../include/zbuffer.h"
-ZBuffer *ZB_open(int xsize, GLint ysize, GLint mode,
+ZBuffer *ZB_open(GLint xsize, GLint ysize, GLint mode,
GLint nb_colors,
GLubyte *color_indexes,
GLint *color_table,
@@ -149,7 +149,7 @@
#endif
for (y = 0; y < zb->ysize; y++) {
#if TGL_FEATURE_NO_COPY_COLOR
- for(int i = 0; i < zb->xsize; i++)
+ for(GLint i = 0; i < zb->xsize; i++)
{
if((*(q+i) & TGL_COLOR_MASK) != TGL_NO_COPY_COLOR)
*(((PIXEL*)p1) + i) = *(q+i);
@@ -503,7 +503,7 @@
/* count must be a multiple of 4 and >= 4 */
//Gek's note: Should never be used.
-void memset_RGB24(void *adr,int r, GLint v, GLint b,long count)
+void memset_RGB24(void *adr,GLint r, GLint v, GLint b,long count)
{
long i, n;
register long v1,v2,v3,*pt=(long *)(adr);
--- a/src/zdither.c
+++ b/src/zdither.c
@@ -32,8 +32,8 @@
/* we build the color table and the lookup table */
-void ZB_initDither(ZBuffer *zb,int nb_colors,
- GLubyte *color_indexes,int *color_table)
+void ZB_initDither(ZBuffer *zb,GLint nb_colors,
+ GLubyte *color_indexes,GLint *color_table)
{
GLint c,r,g,b,i,index,r1,g1,b1;
@@ -45,7 +45,7 @@
for(i=0;i<nb_colors;i++) color_table[i]=0;
zb->nb_colors=nb_colors;
- zb->ctable=gl_malloc(nb_colors * sizeof(int));
+ zb->ctable=gl_malloc(nb_colors * sizeof(GLint));
for (r = 0; r < _R; r++) {
for (g = 0; g < _G; g++) {
@@ -79,7 +79,7 @@
}
#if 0
-int ZDither_lookupColor(int r,int g,int b)
+int ZDither_lookupColor(GLint r,GLint g,GLint b)
{
GLubyte *ctable=zdither_color_table;
return ctable[_MIX(_DITH0(_R, r), _DITH0(_G, g),_DITH0(_B, b))];
--- a/src/zgl.h
+++ b/src/zgl.h
@@ -272,7 +272,7 @@
/* opaque structure for user's use */
void *opaque;
/* resize viewport function */
- GLint (*gl_resize_viewport)(struct GLContext *c,int *xsize,int *ysize);
+ GLint (*gl_resize_viewport)(struct GLContext *c,GLint *xsize,GLint *ysize);
/* depth test */
GLint depth_test;
@@ -305,22 +305,22 @@
/* light.c */
void gl_add_select(GLContext *c,GLuint zmin,GLuint zmax);
-void gl_enable_disable_light(GLContext *c,int light,int v);
+void gl_enable_disable_light(GLContext *c,GLint light,GLint v);
void gl_shade_vertex(GLContext *c,GLVertex *v);
void glInitTextures(GLContext *c);
void glEndTextures(GLContext *c);
-GLTexture *alloc_texture(GLContext *c,int h);
+GLTexture *alloc_texture(GLContext *c,GLint h);
/* image_util.c */
void gl_convertRGB_to_5R6G5B(unsigned short *pixmap,GLubyte *rgb,
- GLint xsize,int ysize);
+ GLint xsize,GLint ysize);
void gl_convertRGB_to_8A8R8G8B(GLuint *pixmap, GLubyte *rgb,
GLint xsize, GLint ysize);
-void gl_resizeImage(GLubyte *dest,int xsize_dest,int ysize_dest,
- GLubyte *src,int xsize_src,int ysize_src);
-void gl_resizeImageNoInterpolate(GLubyte *dest,int xsize_dest,int ysize_dest,
- GLubyte *src,int xsize_src,int ysize_src);
+void gl_resizeImage(GLubyte *dest,GLint xsize_dest,GLint ysize_dest,
+ GLubyte *src,GLint xsize_src,GLint ysize_src);
+void gl_resizeImageNoInterpolate(GLubyte *dest,GLint xsize_dest,GLint ysize_dest,
+ GLubyte *src,GLint xsize_src,GLint ysize_src);
GLContext *gl_get_context(void);
--- a/src/zmath.c
+++ b/src/zmath.c
@@ -135,7 +135,7 @@
/* Inversion of a general nxn matrix.
Note : m is destroyed */
-int Matrix_Inv(GLfloat *r,GLfloat *m,int n)
+int Matrix_Inv(GLfloat *r,GLfloat *m,GLint n)
{
GLint i,j,k,l;
GLfloat max,tmp,t;
@@ -203,7 +203,7 @@
Matrix_Inv(&a->m[0][0],&tmp.m[0][0],4);
}
-void gl_M4_Rotate(M4 *a,GLfloat t,int u)
+void gl_M4_Rotate(M4 *a,GLfloat t,GLint u)
{
GLfloat s,c;
GLint v,w;
--- a/src/zmath.h
+++ b/src/zmath.h
@@ -42,13 +42,13 @@
void gl_M4_Mul(M4 *c,M4 *a,M4 *b);
void gl_M4_MulLeft(M4 *c,M4 *a);
void gl_M4_Transpose(M4 *a,M4 *b);
-void gl_M4_Rotate(M4 *c,GLfloat t,int u);
+void gl_M4_Rotate(M4 *c,GLfloat t,GLint u);
int gl_V3_Norm(V3 *a);
V3 gl_V3_New(GLfloat x,GLfloat y,GLfloat z);
V4 gl_V4_New(GLfloat x,GLfloat y,GLfloat z,GLfloat w);
-int gl_Matrix_Inv(GLfloat *r,GLfloat *m,int n);
+int gl_Matrix_Inv(GLfloat *r,GLfloat *m,GLint n);
#endif
// __ZMATH__
--- a/src/ztext.c
+++ b/src/ztext.c
@@ -18,8 +18,8 @@
for (y=0; y < 8; y++) {
set = bitmap[x] & 1 << y;
if(set)
- for(int i = 0; i < mult; i++)
- for(int j = 0; j < mult; j++)
+ for(GLint i = 0; i < mult; i++)
+ for(GLint j = 0; j < mult; j++)
glPlotPixel(y*mult + i + _x, x*mult + j + _y, p);
}
}
@@ -26,7 +26,7 @@
}
-void glPlotPixel(int x, GLint y, GLuint p){
+void glPlotPixel(GLint x, GLint y, GLuint p){
// int x = p[1].i;
// int y = p[2].i;
// GLuint p = p[3].ui;
@@ -48,7 +48,7 @@
int xoff = 0;
int yoff = 0;
int mult = textsize;
- for(int i = 0; text[i] != '\0' && y+7 < h; i++){
+ for(GLint i = 0; text[i] != '\0' && y+7 < h; i++){
if(text[i] != '\n' && text[i] < 127 && xoff+x < w)
{
renderGLbyte(font8x8_basic[text[i]],x+xoff,y+yoff, p);
--- a/src/ztriangle.c
+++ b/src/ztriangle.c
@@ -288,10 +288,10 @@
GLfloat ss,tt;\
ss=(sz * zinv);\
tt=(tz * zinv);\
- s=(int) ss;\
- t=(int) tt;\
- dsdx= (int)( (dszdx - ss*fdzdx)*zinv );\
- dtdx= (int)( (dtzdx - tt*fdzdx)*zinv );\
+ s=(GLint) ss;\
+ t=(GLint) tt;\
+ dsdx= (GLint)( (dszdx - ss*fdzdx)*zinv );\
+ dtdx= (GLint)( (dtzdx - tt*fdzdx)*zinv );\
fz+=fndzdx;\
zinv=1.0 / fz;\
}\
@@ -313,10 +313,10 @@
GLfloat ss,tt;\
ss=(sz * zinv);\
tt=(tz * zinv);\
- s=(int) ss;\
- t=(int) tt;\
- dsdx= (int)( (dszdx - ss*fdzdx)*zinv );\
- dtdx= (int)( (dtzdx - tt*fdzdx)*zinv );\
+ s=(GLint) ss;\
+ t=(GLint) tt;\
+ dsdx= (GLint)( (dszdx - ss*fdzdx)*zinv );\
+ dtdx= (GLint)( (dtzdx - tt*fdzdx)*zinv );\
}\
while (n>=0) { \
PUT_PIXEL(0);/*the_x += PSZB;*/ \
@@ -370,8 +370,8 @@
zz=z >> ZB_POINT_Z_FRAC_BITS; \
if (ZCMP(zz,pz[_a],_a)) { \
zinv= 1.0 / (GLfloat) z; \
- s= (int) (sz * zinv); \
- t= (int) (tz * zinv); \
+ s= (GLint) (sz * zinv); \
+ t= (GLint) (tz * zinv); \
pp[_a]=texture[((t & 0x3FC00000) | s) >> 14]; \
pz[_a]=zz; \
} \
--- a/src/ztriangle.h
+++ b/src/ztriangle.h
@@ -73,25 +73,25 @@
#ifdef INTERP_Z
d1 = p1->z - p0->z;
d2 = p2->z - p0->z;
- dzdx = (int) (fdy2 * d1 - fdy1 * d2);
- dzdy = (int) (fdx1 * d2 - fdx2 * d1);
+ dzdx = (GLint) (fdy2 * d1 - fdy1 * d2);
+ dzdy = (GLint) (fdx1 * d2 - fdx2 * d1);
#endif
#ifdef INTERP_RGB
d1 = p1->r - p0->r;
d2 = p2->r - p0->r;
- drdx = (int) (fdy2 * d1 - fdy1 * d2);
- drdy = (int) (fdx1 * d2 - fdx2 * d1);
+ drdx = (GLint) (fdy2 * d1 - fdy1 * d2);
+ drdy = (GLint) (fdx1 * d2 - fdx2 * d1);
d1 = p1->g - p0->g;
d2 = p2->g - p0->g;
- dgdx = (int) (fdy2 * d1 - fdy1 * d2);
- dgdy = (int) (fdx1 * d2 - fdx2 * d1);
+ dgdx = (GLint) (fdy2 * d1 - fdy1 * d2);
+ dgdy = (GLint) (fdx1 * d2 - fdx2 * d1);
d1 = p1->b - p0->b;
d2 = p2->b - p0->b;
- dbdx = (int) (fdy2 * d1 - fdy1 * d2);
- dbdy = (int) (fdx1 * d2 - fdx2 * d1);
+ dbdx = (GLint) (fdy2 * d1 - fdy1 * d2);
+ dbdy = (GLint) (fdx1 * d2 - fdx2 * d1);
#endif
@@ -98,13 +98,13 @@
#ifdef INTERP_ST
d1 = p1->s - p0->s;
d2 = p2->s - p0->s;
- dsdx = (int) (fdy2 * d1 - fdy1 * d2);
- dsdy = (int) (fdx1 * d2 - fdx2 * d1);
+ dsdx = (GLint) (fdy2 * d1 - fdy1 * d2);
+ dsdy = (GLint) (fdx1 * d2 - fdx2 * d1);
d1 = p1->t - p0->t;
d2 = p2->t - p0->t;
- dtdx = (int) (fdy2 * d1 - fdy1 * d2);
- dtdy = (int) (fdx1 * d2 - fdx2 * d1);
+ dtdx = (GLint) (fdy2 * d1 - fdy1 * d2);
+ dtdy = (GLint) (fdx1 * d2 - fdx2 * d1);
#endif
#ifdef INTERP_STZ