I’ve posted another topec but got no answer any help with this ehings would b appreiated !
Here’s the code !
{$M 1000000 8000000}
Uses tex,wingraph,crt,gl,glu,glut;
const poly1=1;
var poly:array[1…100]of GLuint;
img:texture;
texctrl:GLInt;
buf:PGLByte;
Procedure Init;
Begin
SetOpenGlMode(DirectOn);
GLMatrixMode(GL_PROJECTION);
GLBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
TexLoad(‘mop.tex’,img);
getmem(Buf,mxmy3);
Buf:=@img;
GLClearColor(0,0,0,0);
GLClear (GL_Color_Buffer_bit OR gl_dEPTH_buffer_bit);
glOrtho(0.0,1.0,0.0,1.0,-1.0,1.0);
GlEnable(GL_TEXTURE_2D);
GLGenTextures(1,@texctrl);
glBindTexture(GL_TEXTURE_2D,texctrl);
glTexImage2D(GL_TEXTURE_2D, 0 , GL_RGB, mx, my, 0, GL_RGB, GL_byte, @buf);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
GLTexEnvF(GL_Texture_ENV,GL_TEXTURE_ENV_MODE,GL_DECAL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_Linear);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
end;
Procedure Draw;
Begin
GLNewList(poly1,GL_Compile);
GLENABLE(GL_TEXTURE_2D);
GLBegin(GL_POLYGON);
GLColor4f(1.0,1.0,1.0,1.0);
GLTexCoord2D(0,1);GLVertex3f(0.25,0.25,0.0);
GLTexCoord2D(1,1);GLVertex3f(0.75,0.25,0.0);
GLTexCoord2D(1,0);GLVertex3f(0.75,0.75,0.0);
GLTexCoord2D(0,0);GLVertex3f(0.25,0.75,0.0);
GLEnd();
GLEndList;
GLFlush();
GLDISABLE(GL_TEXTURE_2D);
end;
Begin
InitGraph(d8bit,m640x480,‘TEXTURE TEST 1’);
init;
draw;
GLCallList(Poly1);
updategraph(updatenow);
closegraph;
end;
end.
variable img is an [0…256,0…256,0…2]
It seems that I can’t make it work !
HELP ME PLS !
the result is at www.testimg.20m.com
10x !