English
Source / code snippets

OpenGL Multi Texture + current Functions

 

Sven
Bader
after a idea of Heinz have I a lane found, on any OpenGL command access. there according to driver not zwangsläufig any extensions present are, must one itself beforehand The Speicheradresse the function give let.

In folgendem example use I two "neuere" command (OpenGL 1.3 of 2001 instead of OpenGL 1.2 of 1998 ) , circa Multitexturing, means two Textures übereinander To release.

unfortunately can not The integrierten Objects for use, and so I a die by hand create.

here an example for a conventional appeal, which with command ex ca. OpenGL 1.3 not functions:
oGL("glMultiTexCoord2f", GL_TEXTURE1&, 0.0, 0.0)

so goes it:
glMultiTexCoord2f& = oGL("wglGetProcAddress","glMultiTexCoord2f")
Call(glMultiTexCoord2f&,GL_TEXTURE1&, 0.0, 0.0)

the Profan Icon mixed with the stone 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!)
        ' Left
        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 from Icons
Mcls 32, 32 : startpaint -1 :  DrawIcon "A", 0,0 : endpaint
hPic&=create("HPIC",0,"&MEMBMP")
tex&[0]=ogl("getTextureBmp",hPic&,1)
DeleteObject hPic&
'Texture from Icons
Mcls 32, 32 : startpaint -1 : DrawIcon "STEIN", 0,0 : endpaint
hPic&=create("HPIC",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

End

69 kB
Hochgeladen:09/20/21
Downloadcounter75
Download
 
09/20/21  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

1.576 Views

Untitledvor 0 min.
Sven Bader02/17/23
Ernst05/29/22
p.specht11/21/21
R.Schneider11/20/21
More...

Themeninformationen

this Topic has 1 subscriber:

Sven Bader (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie