|
Post by PeterMaria on Jun 30, 2015 14:58:26 GMT -5
Hello, dim fo=LoadTex("fonts/font02.png") Font(fo) TextMode(TEXT_OVERLAID) locate 11,0 print "SOME RAW TEXTURES"
dim texture(6) glGenTextures(6,texture)
Function RawLoad(id,rawFile$,size) dim i,m,hd if id>5 then id=5: end if dim mem(size*size*3) hd = OpenFileRead(rawFile$) m=size*size*3 for i=0 to m-1 mem(i)=ReadByte(hd) next Closefile(hd) glBindTexture(GL_TEXTURE_2D, texture(id)) glTexImage2D (GL_TEXTURE_2D,0,GL_RGB,SIZE,SIZE,0,GL_RGB,GL_UNSIGNED_BYTE,MEM) glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR) glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR) return texture(id) End Function
Sub Quad2D(x#,y#,z#) glPushMatrix() glTranslatef(x#,y#,z#) glBegin(gl_Quads) glTexCoord2f(0,0):glVertex2f(-1, 1) glTexCoord2f(1,0):glVertex2f( 1, 1) glTexCoord2f(1,1):glVertex2f( 1,-1) glTexCoord2f(0,1):glVertex2f(-1,-1) glEnd() glPopMatrix() End Sub
dim raw1=RawLoad(1,"raw/wall_128.raw", 128) dim raw2=RawLoad(2,"raw/engel_128.raw",128) dim raw3=RawLoad(3,"raw/heart_256.raw",256) dim raw4=RawLoad(4,"raw/cool_256.raw", 256)
glEnable(GL_TEXTURE_2D) while ScankeyDown(27)=0 glClearColor(0,0,0,1) glClear(GL_COLOR_BUFFER_BIT OR GL_DEPTH_BUFFER_BIT) glLoadIdentity()
glBindTexture(GL_TEXTURE_2D,raw1) Quad2D(-1, 1,-4)
glBindTexture(GL_TEXTURE_2D,raw2) Quad2D(1, 1, -4)
glBindTexture(GL_TEXTURE_2D,raw3) Quad2D(-1,-1,-4)
glBindTexture(GL_TEXTURE_2D,raw4) Quad2D(1,-1, -4)
DrawText() swapbuffers() waittimer(10) wend glDeletetextures(6,texture) end
Attachments:things.zip (729.16 KB)
|
|
|
Post by matthew on Jul 1, 2015 11:19:22 GMT -5
Hi Peter, very colourful images. :-)
|
|