Pour einer concept de Heinz habe je une Weg trouvé, sur alle OpenGL Befehle zuzugreifen. là je pour Treiber pas zwangsläufig alle Erweiterungen vorhanden sommes, muss on sich vorab qui Speicheradresse qui Funktion donner laisser.
dans folgendem Beispiel verwende je deux "neuere" Befehle (OpenGL 1.3 de 2001 statt OpenGL 1.2 de 1998 ) , um Multitexturing, alors deux Texturen übereinander trop realisieren.
malheureusement peux on pas qui integrierten Objekte pour verwenden, weshalb je une Würfel de main erstelle.
ici un Beispiel pour une herkömmlichen Aufruf, quel chez Befehlen ab ca. OpenGL 1.3 pas funktioniert:
oGL("glMultiTexCoord2f", GL_TEXTURE1&, 0.0, 0.0)
so ca va:
glMultiTexCoord2f& = oGL("wglGetProcAddress","glMultiTexCoord2f")
Call(glMultiTexCoord2f&,GL_TEXTURE1&, 0.0, 0.0)
cela Profan Icon gemischt avec dem Stein Icon:
declare tex&[5], xrot!, yrot!, zrot!, cuboid&, hPic&, GL_TEXTURE0&, GL_TEXTURE1&, glActiveTexture&
GL_TEXTURE0& = 33984;
GL_TEXTURE1& = GL_TEXTURE0& + 1;
Proc Cuboid
parameters x!, y!, z!
declare glMultiTexCoord2f&
x! = x! * 0.5 : y! = y! * 0.5 : z! = z! * 0.5
ifnot cuboid&
cuboid& = ogl("StartList")
glMultiTexCoord2f& = oGL("wglGetProcAddress","glMultiTexCoord2f")
ogl("glBegin",~GL_QUADS)
' Front
ogl("glNormal3f",0.0, 0.0, z!)
Call(glMultiTexCoord2f&,GL_TEXTURE1&, 0.0, 0.0) : Call(glMultiTexCoord2f&,GL_TEXTURE0&, 0.0, 0.0) : ogl("glVertex3f",-x!, -y!, z!)
Call(glMultiTexCoord2f&,GL_TEXTURE1&, 1.0, 0.0) : Call(glMultiTexCoord2f&,GL_TEXTURE0&, 1.0, 0.0) : ogl("glVertex3f",x!, -y!, z!)
Call(glMultiTexCoord2f&,GL_TEXTURE1&, 1.0, 1.0) : Call(glMultiTexCoord2f&,GL_TEXTURE0&, 1.0, 1.0) : ogl("glVertex3f",x!, y!, z!)
Call(glMultiTexCoord2f&,GL_TEXTURE1&, 0.0, 1.0) : Call(glMultiTexCoord2f&,GL_TEXTURE0&, 0.0, 1.0) : ogl("glVertex3f",-x!, y!, z!)
' Back
ogl("glNormal3f",0.0, 0.0, -z!)
Call(glMultiTexCoord2f&,GL_TEXTURE1&, 1.0, 0.0) : Call(glMultiTexCoord2f&,GL_TEXTURE0&, 1.0, 0.0) : ogl("glVertex3f",-x!, -y!, -z!)
Call(glMultiTexCoord2f&,GL_TEXTURE1&, 1.0, 1.0) : Call(glMultiTexCoord2f&,GL_TEXTURE0&, 1.0, 1.0) : ogl("glVertex3f",-x!, y!, -z!)
Call(glMultiTexCoord2f&,GL_TEXTURE1&, 0.0, 1.0) : Call(glMultiTexCoord2f&,GL_TEXTURE0&, 0.0, 1.0) : ogl("glVertex3f",x!, y!, -z!)
Call(glMultiTexCoord2f&,GL_TEXTURE1&, 0.0, 0.0) : Call(glMultiTexCoord2f&,GL_TEXTURE0&, 0.0, 0.0) : ogl("glVertex3f",x!, -y!, -z!)
' Top
ogl("glNormal3f",0.0, y!, 0.0)
Call(glMultiTexCoord2f&,GL_TEXTURE1&, 0.0, 1.0) : Call(glMultiTexCoord2f&,GL_TEXTURE0&, 0.0, 1.0) : ogl("glVertex3f",-x!, y!, -z!)
Call(glMultiTexCoord2f&,GL_TEXTURE1&, 0.0, 0.0) : Call(glMultiTexCoord2f&,GL_TEXTURE0&, 0.0, 0.0) : ogl("glVertex3f",-x!, y!, z!)
Call(glMultiTexCoord2f&,GL_TEXTURE1&, 1.0, 0.0) : Call(glMultiTexCoord2f&,GL_TEXTURE0&, 1.0, 0.0) : ogl("glVertex3f",x!, y!, z!)
Call(glMultiTexCoord2f&,GL_TEXTURE1&, 1.0, 1.0) : Call(glMultiTexCoord2f&,GL_TEXTURE0&, 1.0, 1.0) : ogl("glVertex3f",x!, y!, -z!)
' Bottom
ogl("glNormal3f",0.0, -y!, 0.0)
Call(glMultiTexCoord2f&,GL_TEXTURE1&, 1.0, 1.0) : Call(glMultiTexCoord2f&,GL_TEXTURE0&, 1.0, 1.0) : ogl("glVertex3f",-x!, -y!, -z!)
Call(glMultiTexCoord2f&,GL_TEXTURE1&, 0.0, 1.0) : Call(glMultiTexCoord2f&,GL_TEXTURE0&, 0.0, 1.0) : ogl("glVertex3f",x!, -y!, -z!)
Call(glMultiTexCoord2f&,GL_TEXTURE1&, 0.0, 0.0) : Call(glMultiTexCoord2f&,GL_TEXTURE0&, 0.0, 0.0) : ogl("glVertex3f",x!, -y!, z!)
Call(glMultiTexCoord2f&,GL_TEXTURE1&, 1.0, 0.0) : Call(glMultiTexCoord2f&,GL_TEXTURE0&, 1.0, 0.0) : ogl("glVertex3f",-x!, -y!, z!)
' Right
ogl("glNormal3f",x!, 0.0, 0.0)
Call(glMultiTexCoord2f&,GL_TEXTURE1&, 1.0, 0.0) : Call(glMultiTexCoord2f&,GL_TEXTURE0&, 1.0, 0.0) : ogl("glVertex3f",x!, -y!, -z!)
Call(glMultiTexCoord2f&,GL_TEXTURE1&, 1.0, 1.0) : Call(glMultiTexCoord2f&,GL_TEXTURE0&, 1.0, 1.0) : ogl("glVertex3f",x!, y!, -z!)
Call(glMultiTexCoord2f&,GL_TEXTURE1&, 0.0, 1.0) : Call(glMultiTexCoord2f&,GL_TEXTURE0&, 0.0, 1.0) : ogl("glVertex3f",x!, y!, z!)
Call(glMultiTexCoord2f&,GL_TEXTURE1&, 0.0, 0.0) : Call(glMultiTexCoord2f&,GL_TEXTURE0&, 0.0, 0.0) : ogl("glVertex3f",x!, -y!, z!)
' À gauche
ogl("glNormal3f",-x!, 0.0, 0.0)
Call(glMultiTexCoord2f&,GL_TEXTURE1&, 0.0, 0.0) : Call(glMultiTexCoord2f&,GL_TEXTURE0&, 0.0, 0.0) : ogl("glVertex3f",-x!, -y!, -z!)
Call(glMultiTexCoord2f&,GL_TEXTURE1&, 1.0, 0.0) : Call(glMultiTexCoord2f&,GL_TEXTURE0&, 1.0, 0.0) : ogl("glVertex3f",-x!, -y!, z!)
Call(glMultiTexCoord2f&,GL_TEXTURE1&, 1.0, 1.0) : Call(glMultiTexCoord2f&,GL_TEXTURE0&, 1.0, 1.0) : ogl("glVertex3f",-x!, y!, z!)
Call(glMultiTexCoord2f&,GL_TEXTURE1&, 0.0, 1.0) : Call(glMultiTexCoord2f&,GL_TEXTURE0&, 0.0, 1.0) : ogl("glVertex3f",-x!, y!, -z!)
ogl("glEnd")
ogl("EndList")
endif
ogl("DrawList", cuboid&)
ENDPROC
Proc DrawGLScene
oGL("Clear")
oGL("Move", 0, 0, -3)
oGL("Rotate", xrot!, yrot!, zrot!)
oGL("glEnable", ~GL_TEXTURE_2D)
Call(glActiveTexture&, GL_TEXTURE0&)
oGL("glBindTexture", ~GL_TEXTURE_2D, tex&[1])
Call(glActiveTexture&, GL_TEXTURE1&)
oGL("glBindTexture", ~GL_TEXTURE_2D, tex&[0])
Cuboid(1.0, 1.0, 1.0)
oGL("Show")
ENDPROC
windowtitle "Multi Texture"
CLS
oGL("Init", %hWnd, 0.7,0.7,0.7,0)
oGL("Posmode", 1)
glActiveTexture& = oGL("wglGetProcAddress","glActiveTexture")
'Texture aus Icônes
Mcls 32, 32 : startpaint -1 : DrawIcon "A", 0,0 : endpaint
hPic&=create(«PCSI»,0,"& MEMBMP")
tex&[0]=ogl("getTextureBmp",hPic&,1)
DeleteObject hPic&
'Texture aus Icônes
Mcls 32, 32 : startpaint -1 : DrawIcon "STEIN", 0,0 : endpaint
hPic&=create(«PCSI»,0,"& MEMBMP")
tex&[1]=ogl("getTextureBmp",hPic&,1)
DeleteObject hPic&
xrot! = 35
yrot! = 45
WhileNot iskey(27)
sleep 5
yrot! = yrot! + 0.1
DrawGLScene()
Endwhile
Fin
|