Français
Wünsche et Anregungen

Wunsch: plus Performance pour Jeux

 
je benenne ici simple la fois Funktionswünsche quelle aider peut cela XProfan-Spieleprogrammierer plus Performance dedans qui Programme erreichen peut. (Performance ist chez Spielen oui souvent wichtiger comme z.B. chez einer kleineren Datenbankanwendung.)

Würde mich freuen si aussi autre ici qui une ou bien autre concept pour Roland hinterlassen würden.

• Rechteckintersektionskontrolle (ggf. avec Überlappungsfaktor comme Float)
• Distance zweier Punkte (2D & 3D) (  [...]  )
KompilierenMarqueSéparation
• Bound (normalisieren?) bound(x,-30,30)
KompilierenMarqueSéparation
cela mag zwar alles kleinlich wirken, mais es pouvoir déjà une erheblichen Geschwindigkeitsunterschied aus si on sur solche native Helfer zurückgreifen pourrait, et besonders chez Spielen zählt chaque µ.
 
05.11.2007  
 



prochaine Part - unterthema OpenGL.

Folgende Funktionen - si nativ Umgesetzt - könnten dem XProfan-OGL-Spieleentwickler deutlich plus freude beim Programmieren verschaffen!
KompilierenMarqueSéparation
ogl.rectangle(float x,y,xx,yy,bool filled){

    if filled {

        /*
        xx:=xx-x
        yy:=yy-y+1
        x:=x+xx/2+1
        y:=y+yy/2
        ogl(move,x,y-1,)
        ogl(quad,xx+1,0-yy)
        ogl(move,-x,-y+1,0)
        */
        ogl(glBegin,GL_QUADS)
        oGL(glTexCoord2f,0.0,1.0)
        ogl(glVertex3f,x,y,)
        oGL(glTexCoord2f,1.0,1.0)
        ogl(glVertex3f,xx,y,)
        oGL(glTexCoord2f,1.0,0.0)
        ogl(glVertex3f,xx,yy,)
        oGL(glTexCoord2f,0.0,0.0)
        ogl(glVertex3f,x,yy,)
        ogl(glEnd)

    } else {

        ogl(glBegin,GL_LINE_LOOP)
        ogl(glVertex3f,x,y,)
        ogl(glVertex3f,xx,y,)
        ogl(glVertex3f,xx,yy,)
        ogl(glVertex3f,x,yy,)
        ogl(glEnd)

    }<
}

et cet:
KompilierenMarqueSéparation
et puis aufbauend cet:
KompilierenMarqueSéparation
et aussi si unübersichtlich erscheint - desto wichtiger cet: (benötigte Texturdatei im Anhang)
KompilierenMarqueSéparation
de cette entier trop schweigen:
KompilierenMarqueSéparation
et quoi simple:
KompilierenMarqueSéparation
et quoi wichtiges!:
KompilierenMarqueSéparation

769 kB
Hochgeladen:05.11.2007
Downloadcounter142
Download
1.024 kB
Hochgeladen:05.11.2007
Downloadcounter337
Download
 
05.11.2007  
 



Unterthema Vektorkollisionen/Winkelfunktionen:

Ok je attends besser seulement einmal jusqu'à Roland qui Gespräche trop o.g. Sujets aufgenommen hat.
 
05.11.2007  
 




Frank
Abbing
je erdreiste mich aussi la fois...

Ogl: ombre Nr.1
KompilierenMarqueSéparation
 {$iq}
declare time&, frames%
declare ende%,x!
declare g_fSpinX_L!,g_fSpinY_L!
g_fSpinX_L! =   0.0
g_fSpinY_L! = -10.0
declare g_fSpinX_R!,g_fSpinY_R!
g_fSpinX_R! = 0.0
g_fSpinY_R! = 0.0
declare g_floorQuad#
dim g_floorQuad#,96
long g_floorQuad#, 0 = single(0.0), single(1.0), single(0.0), single(-5.0), single(0.0), single(-5.0)
long g_floorQuad#,24 = single(0.0), single(1.0), single(0.0), single(-5.0), single(0.0), single(5.0)
long g_floorQuad#,48 = single(0.0), single(1.0), single(0.0), single(5.0), single(0.0), single(5.0)
long g_floorQuad#,72 = single(0.0), single(1.0), single(0.0), single(5.0), single(0.0), single(-5.0)
declare g_shadowMatrix![16],g_lightPosition![4]
g_lightPosition![0] = 2.0
g_lightPosition![1] = 6.0
g_lightPosition![2] = 0.0
g_lightPosition![3] = 1.0
declare g_lightPosition#
dim g_lightPosition#,16
declare shadowPlane![4],v0![3],v1![3],v2![3]
declare g_shadowMatrix#
dim g_shadowMatrix#,128

proc init

    oGL(Init, %hWnd, 0.35, 0.53, 0.7, 1)
    oGL(PosMode, 1)

endproc

proc buildShadowMatrix

    Calculate the dot-product between the plane and the lights position
    declare dotp!
    dotp! = shadowPlane![0] * g_lightPosition![0] + shadowPlane![1] * g_lightPosition![1] + shadowPlane![1] * g_lightPosition![2] + shadowPlane![3] * g_lightPosition![3]
    First column
    g_shadowMatrix![0]  = dotp! - g_lightPosition![0] * shadowPlane![0]
    g_shadowMatrix![4]  = 0.0   - g_lightPosition![0] * shadowPlane![1]
    g_shadowMatrix![8]  = 0.0   - g_lightPosition![0] * shadowPlane![2]
    g_shadowMatrix![12] = 0.0   - g_lightPosition![0] * shadowPlane![3]
    Second column
    g_shadowMatrix![1]  = 0.0   - g_lightPosition![1] * shadowPlane![0]
    g_shadowMatrix![5]  = dotp! - g_lightPosition![1] * shadowPlane![1]
    g_shadowMatrix![9]  = 0.0   - g_lightPosition![1] * shadowPlane![2]
    g_shadowMatrix![13] = 0.0   - g_lightPosition![1] * shadowPlane![3]
    Third column
    g_shadowMatrix![2]  = 0.0   - g_lightPosition![2] * shadowPlane![0]
    g_shadowMatrix![6]  = 0.0   - g_lightPosition![2] * shadowPlane![1]
    g_shadowMatrix![10] = dotp! - g_lightPosition![2] * shadowPlane![2]
    g_shadowMatrix![14] = 0.0   - g_lightPosition![2] * shadowPlane![3]
    Fourth column
    g_shadowMatrix![3]  = 0.0   - g_lightPosition![3] * shadowPlane![0]
    g_shadowMatrix![7]  = 0.0   - g_lightPosition![3] * shadowPlane![1]
    g_shadowMatrix![11] = 0.0   - g_lightPosition![3] * shadowPlane![2]
    g_shadowMatrix![15] = dotp! - g_lightPosition![3] * shadowPlane![3]
    Alles jetzt in die Bereichsvariable schreiben
    (sollte man natürlich direkt machen, aber so ist es erstmal übersichtlicher...)
    float g_shadowMatrix#, 0 = g_shadowMatrix![0],g_shadowMatrix![1],g_shadowMatrix![2],g_shadowMatrix![3]
    float g_shadowMatrix#,32 = g_shadowMatrix![4],g_shadowMatrix![5],g_shadowMatrix![6],g_shadowMatrix![7]
    float g_shadowMatrix#,64 = g_shadowMatrix![8],g_shadowMatrix![9],g_shadowMatrix![10],g_shadowMatrix![11]
    float g_shadowMatrix#,96 = g_shadowMatrix![12],g_shadowMatrix![13],g_shadowMatrix![14],g_shadowMatrix![15]

endproc

proc findPlane

    declare vec0![3], vec1![3]
    Need 2 vectors to find cross product
    vec0![0] = v1![0] - v0![0]
    vec0![1] = v1![1] - v0![1]
    vec0![2] = v1![2] - v0![2]
    vec1![0] = v2![0] - v0![0]
    vec1![1] = v2![1] - v0![1]
    vec1![2] = v2![2] - v0![2]
    Find cross product to get A, B, and C of plane equation
    shadowPlane![0] =   vec0![1] * vec1![2] - vec0![2] * vec1![1]
    shadowPlane![1] = -(vec0![0] * vec1![2] - vec0![2] * vec1![0])
    shadowPlane![2] =   vec0![0] * vec1![1] - vec0![1] * vec1![0]
    shadowPlane![3] = -(shadowPlane![0] * v0![0] + shadowPlane![1] * v0![1] + shadowPlane![2] * v0![2])

endproc

proc renderObject

    oGL(Push)
    oGL(glTranslatef, 0.0, 2.5, 0.0)
    oGL(glRotatef, -g_fSpinY_R!, 1.0, 0.0, 0.0)
    oGL(glRotatef, -g_fSpinX_R!, 0.0, 1.0, 0.0)
    oGL(Rotate, 90, 0, 0)
    oGL(Cuboid, 2, 2, 2)
    oGL(Move, 0, -2, 2)
    oGL(Sphere, 1.2, 16, 16)
    oGL(Pop)

endproc

proc render

    To define a plane that matches the floor, we need to 3 vertices from it
    v0![0] = double(long(g_floorQuad#,12))
    v0![1] = double(long(g_floorQuad#,16))
    v0![2] = double(long(g_floorQuad#,20))
    v1![0] = double(long(g_floorQuad#,36))
    v1![1] = double(long(g_floorQuad#,40))
    v1![2] = double(long(g_floorQuad#,44))
    v2![0] = double(long(g_floorQuad#,60))
    v2![1] = double(long(g_floorQuad#,64))
    v2![2] = double(long(g_floorQuad#,68))
    findPlane
    Build a shadow matrix using the lights current position and the plane
    buildShadowMatrix
    oGL(Clear)
    oGL(glClear, ~GL_COLOR_BUFFER_BIT | ~GL_DEPTH_BUFFER_BIT)
    Place the view
    oGL(glMatrixMode, ~GL_MODELVIEW)
    oGL(glLoadIdentity)
    oGL(glTranslatef, 0.0, -2.0, -15.0)
    oGL(glRotatef, -g_fSpinY_L!, 1.0, 0.0, 0.0)
    oGL(glRotatef, -g_fSpinX_L!, 0.0, 1.0, 0.0)
    Create a shadow by rendering the teapot using the shadow matrix.
    oGL(glDisable, ~GL_DEPTH_TEST)
    oGL(glDisable, ~GL_LIGHTING)
    oGL(glColor3f, 0.2, 0.4, 0.6) Shadows color
    oGL(Push)
    oGL(glMultMatrixd, g_shadowMatrix#)
    renderObject
    oGL(Pop)
    oGL(glEnable, ~GL_DEPTH_TEST)
    oGL(glEnable, ~GL_LIGHTING)
    Render the lights position as a sphere...
    oGL(glDisable, ~GL_LIGHTING)
    oGL(Push)
    long g_lightPosition#,0 = single(g_lightPosition![0]),single(g_lightPosition![1]),single(g_lightPosition![2]),single(g_lightPosition![3])
    oGL(glLightfv, ~GL_LIGHT0, ~GL_POSITION, g_lightPosition#)
    Place a sphere to represent the light
    oGL(glTranslatef, g_lightPosition![0], g_lightPosition![1], g_lightPosition![2])
    oGL(glColor3f, 1.0, 1.0, 0.5)
    oGL(Sphere,0.1, 8, 8)
    oGL(Pop)
    oGL(glEnable, ~GL_LIGHTING)
    oGL(glColor3f, 1.0, 0.3, 0.0) Objektss color
    Render normal teapot
    renderObject
    oGL(Show)

endproc

-----------------------------------------------------------------------------------
Cls
init
time&   = &GetTickCount
frames% = 0
ende%   = 0
SetTimer 10

whilenot ende%

    WaitInput

    if IsKey(27)

        ende% = 1

    elseif IsKey(38)

        g_lightPosition![3] = g_lightPosition![3] + 0.1

    elseif IsKey(40)

        g_lightPosition![3] = g_lightPosition![3] - 0.1

    elseif IsKey(37)

        g_lightPosition![2] = g_lightPosition![2] - 0.1

    elseif IsKey(39)

        g_lightPosition![2] = g_lightPosition![2] + 0.1

    endif

    render
    SetText %hWnd, str$(g_lightPosition![2]) + , +str$(g_lightPosition![3])

wend

KillTimer
dispose g_floorQuad#
dispose g_lightPosition#
Fin
 
05.11.2007  
 




Frank
Abbing
Ogl: ombre Nr.2
KompilierenMarqueSéparation
 {$iq}
declare time&, frames%
declare ende%,x!,xx!,yy!,zz!
declare g_fSpinX_L!,g_fSpinY_L!
g_fSpinX_L! =   0.0
g_fSpinY_L! = -10.0
declare g_fSpinX_R!,g_fSpinY_R!
g_fSpinX_R! = 0.0
g_fSpinY_R! = 0.0
declare g_floorQuad#
dim g_floorQuad#,96
long g_floorQuad#, 0 = single(0.0), single(1.0), single(0.0), single(-5.0), single(0.0), single(-5.0)
long g_floorQuad#,24 = single(0.0), single(1.0), single(0.0), single(-5.0), single(0.0), single(5.0)
long g_floorQuad#,48 = single(0.0), single(1.0), single(0.0), single(5.0), single(0.0), single(5.0)
long g_floorQuad#,72 = single(0.0), single(1.0), single(0.0), single(5.0), single(0.0), single(-5.0)
declare g_shadowMatrix![16],g_lightPosition![4]
g_lightPosition![0] = 2.0
g_lightPosition![1] = 20.0
g_lightPosition![2] = 0.0
g_lightPosition![3] = 1.0
declare g_lightPosition#
dim g_lightPosition#,16
declare shadowPlane![4],v0![3],v1![3],v2![3]
declare g_shadowMatrix#
dim g_shadowMatrix#,128

proc init

    oGL(Init, %hWnd, 0.35, 0.53, 0.7, 1)
    oGL(PosMode, 1)

endproc

proc buildShadowMatrix

    Calculate the dot-product between the plane and the lights position
    declare dotp!
    dotp! = shadowPlane![0] * g_lightPosition![0] + shadowPlane![1] * g_lightPosition![1] + shadowPlane![1] * g_lightPosition![2] + shadowPlane![3] * g_lightPosition![3]
    First column
    g_shadowMatrix![0]  = dotp! - g_lightPosition![0] * shadowPlane![0]
    g_shadowMatrix![4]  = 0.0   - g_lightPosition![0] * shadowPlane![1]
    g_shadowMatrix![8]  = 0.0   - g_lightPosition![0] * shadowPlane![2]
    g_shadowMatrix![12] = 0.0   - g_lightPosition![0] * shadowPlane![3]
    Second column
    g_shadowMatrix![1]  = 0.0   - g_lightPosition![1] * shadowPlane![0]
    g_shadowMatrix![5]  = dotp! - g_lightPosition![1] * shadowPlane![1]
    g_shadowMatrix![9]  = 0.0   - g_lightPosition![1] * shadowPlane![2]
    g_shadowMatrix![13] = 0.0   - g_lightPosition![1] * shadowPlane![3]
    Third column
    g_shadowMatrix![2]  = 0.0   - g_lightPosition![2] * shadowPlane![0]
    g_shadowMatrix![6]  = 0.0   - g_lightPosition![2] * shadowPlane![1]
    g_shadowMatrix![10] = dotp! - g_lightPosition![2] * shadowPlane![2]
    g_shadowMatrix![14] = 0.0   - g_lightPosition![2] * shadowPlane![3]
    Fourth column
    g_shadowMatrix![3]  = 0.0   - g_lightPosition![3] * shadowPlane![0]
    g_shadowMatrix![7]  = 0.0   - g_lightPosition![3] * shadowPlane![1]
    g_shadowMatrix![11] = 0.0   - g_lightPosition![3] * shadowPlane![2]
    g_shadowMatrix![15] = dotp! - g_lightPosition![3] * shadowPlane![3]
    Alles jetzt in die Bereichsvariable schreiben
    (sollte man natürlich direkt machen, aber so ist es erstmal übersichtlicher...)
    float g_shadowMatrix#, 0 = g_shadowMatrix![0],g_shadowMatrix![1],g_shadowMatrix![2],g_shadowMatrix![3]
    float g_shadowMatrix#,32 = g_shadowMatrix![4],g_shadowMatrix![5],g_shadowMatrix![6],g_shadowMatrix![7]
    float g_shadowMatrix#,64 = g_shadowMatrix![8],g_shadowMatrix![9],g_shadowMatrix![10],g_shadowMatrix![11]
    float g_shadowMatrix#,96 = g_shadowMatrix![12],g_shadowMatrix![13],g_shadowMatrix![14],g_shadowMatrix![15]

endproc

proc findPlane

    declare vec0![3], vec1![3]
    Need 2 vectors to find cross product
    vec0![0] = v1![0] - v0![0]
    vec0![1] = v1![1] - v0![1]
    vec0![2] = v1![2] - v0![2]
    vec1![0] = v2![0] - v0![0]
    vec1![1] = v2![1] - v0![1]
    vec1![2] = v2![2] - v0![2]
    Find cross product to get A, B, and C of plane equation
    shadowPlane![0] =   vec0![1] * vec1![2] - vec0![2] * vec1![1]
    shadowPlane![1] = -(vec0![0] * vec1![2] - vec0![2] * vec1![0])
    shadowPlane![2] =   vec0![0] * vec1![1] - vec0![1] * vec1![0]
    shadowPlane![3] = -(shadowPlane![0] * v0![0] + shadowPlane![1] * v0![1] + shadowPlane![2] * v0![2])

endproc

proc renderObject

    oGL(Push)
    oGL(glTranslatef, 0.0, 2.0, 0.0)
    oGL(glRotatef, -g_fSpinY_R!, 1.0, 0.0, 0.0)
    oGL(glRotatef, -g_fSpinX_R!, 0.0, 1.0, 0.0)
    oGL(Rotate, xx!, yy!, zz!)
    oGL(Cuboid, 4, 2, 8)
    oGL(Pop)

endproc

proc render

    To define a plane that matches the floor, we need to 3 vertices from it
    v0![0] = double(long(g_floorQuad#,12))
    v0![1] = double(long(g_floorQuad#,16))
    v0![2] = double(long(g_floorQuad#,20))
    v1![0] = double(long(g_floorQuad#,36))
    v1![1] = double(long(g_floorQuad#,40))
    v1![2] = double(long(g_floorQuad#,44))
    v2![0] = double(long(g_floorQuad#,60))
    v2![1] = double(long(g_floorQuad#,64))
    v2![2] = double(long(g_floorQuad#,68))
    findPlane
    Build a shadow matrix using the lights current position and the plane
    buildShadowMatrix
    oGL(Clear)
    oGL(glClear, ~GL_COLOR_BUFFER_BIT | ~GL_DEPTH_BUFFER_BIT)
    Place the view
    oGL(glMatrixMode, ~GL_MODELVIEW)
    oGL(glLoadIdentity)
    oGL(glTranslatef, 0.0, -2.0, -15.0)
    oGL(glRotatef, -g_fSpinY_L!, 1.0, 0.0, 0.0)
    oGL(glRotatef, -g_fSpinX_L!, 0.0, 1.0, 0.0)
    Create a shadow by rendering the teapot using the shadow matrix.
    oGL(glDisable, ~GL_DEPTH_TEST)
    oGL(glDisable, ~GL_LIGHTING)
    oGL(glColor3f, 0.2, 0.4, 0.6) Shadows color
    oGL(Push)
    oGL(glMultMatrixd, g_shadowMatrix#)
    renderObject
    oGL(Pop)
    oGL(glEnable, ~GL_DEPTH_TEST)
    oGL(glEnable, ~GL_LIGHTING)
    Render the lights position as a sphere...
    oGL(glDisable, ~GL_LIGHTING)
    oGL(Push)
    long g_lightPosition#,0 = single(g_lightPosition![0]),single(g_lightPosition![1]),single(g_lightPosition![2]),single(g_lightPosition![3])
    oGL(glLightfv, ~GL_LIGHT0, ~GL_POSITION, g_lightPosition#)
    Place a sphere to represent the light
    oGL(glTranslatef, g_lightPosition![0], g_lightPosition![1], g_lightPosition![2])
    oGL(glColor3f, 1.0, 1.0, 0.5)
    oGL(Sphere,0.1, 8, 8)
    oGL(Pop)
    oGL(glEnable, ~GL_LIGHTING)
    oGL(glColor3f, 1.0, 0.3, 0.0) Objektss color
    Render normal teapot
    renderObject
    oGL(Show)

endproc

-----------------------------------------------------------------------------------
Cls
init
time&   = &GetTickCount
frames% = 0
ende%   = 0
SetTimer 10

whilenot ende%

    WaitInput

    if IsKey(27)

        ende% = 1

    elseif IsKey(38)

        xx!=xx!+.5

    elseif IsKey(40)

        xx!=xx!-.5

    elseif IsKey(37)

        yy!=yy!+.5

    elseif IsKey(39)

        yy!=yy!-.5

    elseif IsKey($41)

        zz!=zz!+.5

    elseif IsKey($59)

        zz!=zz!-.5

    endif

    render
    inc frames%

    if &GetTickCount - time& >= 1000

        SetText %hWnd, str$(frames%) +  Frames/sek
        time&   = &GetTickCount
        frames% = 0

    endif

wend

KillTimer
dispose g_floorQuad#
dispose g_shadowMatrix#
dispose g_lightPosition#
Fin
 
05.11.2007  
 




Frank
Abbing
Ogl: Anti-Aliasing
KompilierenMarqueSéparation
 {$cleq}
 $H Windows.ph
 $H ARB_const.ph
declare arbMultisampleSupported%
declare arbMultisampleFormat%
WGLisExtensionSupported: This Is A Form Of The Extension For WGL

proc WGLisExtensionSupported

    parameters ext$
    declare len%,pProc&,pSupported&
    len% = Len(ext$)
    pProc& = oGL(wglGetProcAddress, wglGetExtensionsStringARB)
    case pProc& : pSupported& = Call(pProc&, oGL(wglGetCurrentDC))
    casenot pSupported& : pSupported& = oGL(glGetString, ~GL_EXTENSIONS)
    casenot pSupported& : return 0
    declare supported$
    let supported$ = string$(pSupported&, 0)
    declare temp#
    dim temp#, Len(supported$) + 1
    string temp#, 0 = supported$
    declare pos&
    pos& = MemPos(temp#,0,ext$)

    while pos& <> -1

        if (pos& = 0) or (Byte(temp#, pos& - 1) = 32)

            if (Byte(temp#, pos& + len%) = 32) or (Byte(temp#, pos& + len%) = 0)

                dispose temp#
                return 1

            endif

        endif

        pos& = MemPos(temp#, pos&, ext$)

    endwhile

    dispose temp#
    return 0

endproc

InitMultisample: Used To Query The Multisample Frequencies

proc InitMultisample(HINSTANCE hInstance,HWND hWnd,PIXELFORMATDESCRIPTOR pfd)

    parameters hInst&,hWnd&,pfd#

    ifnot WGLisExtensionSupported(WGL_ARB_multisample)

        arbMultisampleSupported% = 0
        return 0

    endif

    declare pProc&
    pProc& = oGL(wglGetProcAddress,wglChoosePixelFormatARB)

    ifnot pProc&

        arbMultisampleSupported% = 0
        return 0

    endif

    declare hDC&
    hDC& = ~GetDC(hWnd&)
    declare pixelFormat%,valid%,numFormats%
    declare fAttributes#
    dim fAttributes#, 8
    clear fAttributes#  = {0,0};
    declare iAttributes#
    dim iAttributes#, 88
    Long iAttributes#, 0 = ~WGL_DRAW_TO_WINDOW_ARB,~GL_TRUE,
    ~WGL_SUPPORT_OPENGL_ARB,~GL_TRUE,
    ~WGL_ACCELERATION_ARB,~WGL_FULL_ACCELERATION_ARB,
    ~WGL_COLOR_BITS_ARB,24,
    ~WGL_ALPHA_BITS_ARB,8,
    ~WGL_DEPTH_BITS_ARB,16,
    ~WGL_STENCIL_BITS_ARB,0,
    ~WGL_DOUBLE_BUFFER_ARB,~GL_TRUE,
    ~WGL_SAMPLE_BUFFERS_ARB,~GL_TRUE,
    ~WGL_SAMPLES_ARB,8,                    Test For 8 Samples
    0,0
    valid% = Call(pProc&, hDC&, iAttributes#, fAttributes#, 1, Addr(pixelFormat%), Addr(numFormats%))

    if valid% and (numFormats% >= 1)

        arbMultisampleSupported% = 1
        arbMultisampleFormat% = pixelFormat%
        dispose fAttributes#
        dispose iAttributes#
        return arbMultisampleSupported%

    endif

    Our Pixel Format With 4 Samples Failed, Test For 4 Samples
    Long iAttributes#, 19 * 4 = 4
    valid% = Call(pProc&, hDC&, iAttributes#, fAttributes#, 1, Addr(pixelFormat%), Addr(numFormats%))

    if valid% and (numFormats% >= 1)

        arbMultisampleSupported% = 1
        arbMultisampleFormat% = pixelFormat%
        dispose fAttributes#
        dispose iAttributes#
        return arbMultisampleSupported%

    endif

    Our Pixel Format With 4 Samples Failed, Test For 2 Samples
    Long iAttributes#, 19 * 4 = 2
    valid% = Call(pProc&, hDC&, iAttributes#, fAttributes#, 1, Addr(pixelFormat%), Addr(numFormats%))

    if valid% and (numFormats% >= 1)

        arbMultisampleSupported% = 1
        arbMultisampleFormat% = pixelFormat%

    endif

    dispose fAttributes#
    dispose iAttributes#
    return arbMultisampleSupported%

endproc

proc DrawGLScene

    oGL(Clear)
    oGL(Origin, -1.5, 0, -6)
    oGL(Color, .5, .5, .8, .5)
    oGL(Rotate, 0, rtri!, y!)
    oGL(Pyramid, 2, 4, 2)
    oGL(Origin, 1.5, 0, -6)
    oGL(Color, .8, .2, .3, 1)
    oGL(Rotate, rquad!, y!/1.2, 0)
    oGL(Cuboid, 2, 2, 2)
    oGL(Show)
    rtri! = rtri! + .5
    rquad! = rquad! - .3
    y!=y!+.1

endproc

Zum Testen:
Cls
declare wnd&
let wnd& = Create(Window,%hwnd,Test,100,100,400,400)
oGL(Init,wnd&,1,1,1,1)
InitMultisample(%hInstance,wnd&,0)
DestroyWindow(wnd&)

If arbMultisampleFormat%

    oGL(Init,%hwnd,0,0,0,1,arbMultisampleFormat%)

Else

    oGL(Init,%hwnd,0,0,0,1)

EndIf

declare time&, frames%
declare rtri!,rquad!,y!
declare ende%, lm%
Ogl(PosMode, 1)
time&   = &GetTickCount
frames% = 0
Ende% = 0
setTimer 20  max 50 Frames /sek.

WhileNot ende%

    WaitInput

    if isKey(27)

        ende% = 1

    endif

    DrawGLScene()
    inc frames%

    if &GetTickCount - time& >= 1000   1 Sekunde ist rum

        setText %hWnd, str$(frames%) +  Frames/sek
        time&   = &GetTickCount
        frames% = 0

    endif

Endwhile

killTimer
end

5 kB
Hochgeladen:05.11.2007
Downloadcounter189
Download
 
05.11.2007  
 




RGH
iF
Unterthema Vektorkollisionen/Winkelfunktionen:

Ok je attends besser seulement einmal jusqu'à Roland qui Gespräche trop o.g. Sujets aufgenommen hat.


Hm, si le Source dans net strukturiertem XProfan wären, pourrait je vous oui la fois ausprobieren, afin de voyons, quoi qui Funktionen faire devoir ... ;)

Klingt mais pas unitinteressant ...

Salut
Roland
 
Intel Duo E8400 3,0 GHz / 4 GB RAM / 1000 GB HDD - ATI Radeon HD 4770 512 MB - Windows 7 Home Premium 32Bit - XProfan X4
05.11.2007  
 



RGH

iF
Unterthema Vektorkollisionen/Winkelfunktionen:

Ok je attends besser seulement einmal jusqu'à Roland qui Gespräche trop o.g. Sujets aufgenommen hat.


Hm, si le Source dans net strukturiertem XProfan wären, pourrait je vous oui la fois ausprobieren, afin de voyons, quoi qui Funktionen faire devoir ... ;)

Klingt mais pas unitinteressant ...

Salut
Roland


ah! Na cela teste je juste la fois à nem kleinen Beispiel: (okok quäle mich calme )

*umschreib*wurstel*wüt*



allô Roland, s'il te plaît füge dem XProfan cet Funktionen hinzu sodass cet dem XProfanProgrammierer nativ vorliegen et avec cela très très viel plus rapide sommes comme qui interpretierten varianten:
KompilierenMarqueSéparation
proc dist

    parameters a!,b!,c!,d!,e!,f!

    if pcount=4  aha! 2d-Distanz

        a!=c!-a!
        b!=d!-b!
        return sqrt(a!*a!+b!*b!)

    endif

    aha! 3d-Distanz
    a!=d!-a!
    b!=e!-b!
    c!=f!-c!
    return sqrt(a!*a!+b!*b!+c!*c!)

endproc


• Bound (normalisieren?) bound(x,-30,30)
KompilierenMarqueSéparation
proc bound

    parameters b!,min!,max!
    cas b!<min!:return min!
    cas b!>max!:return max!
    return b!

endproc


• Rechteckintersection
KompilierenMarqueSéparation
proc rectintersect

    parameters x!,y!,xx!,yy!,xxx!,yyy!,xxxx!,yyyy!
    cas (xx!<xxx!) or (x!>xxxx!) : return 0
    cas (yy!<yyy!) or (y!>yyyy!) : return 0
    return 1

endproc


 
05.11.2007  
 




RGH
Salut,

cela Thema oGL dans Version 11 venez encore.

Zum reste:

Bound() et RecIntersect() ist oui dans qui aktuellen Subscriptionsversion enthalten:
KompilierenMarqueSéparation
between(X!, vonX!, bisX!)
between(X!, vonX!, bisX!, Y!, vonY!, bisY!)
between(X!, vonX!, bisX!, Y!, vonY!, bisY!, Z!, vonZ!, bisZ!)
Intersec(typ$, object1#, object2#)
range(X!, vonX!, bisX!)   = iFs bound()/pre>

Dist() ist une interessante concept, mais (encore) pas realisiert:
KompilierenMarqueSéparation
dist(X1!, Y1!, X2!, Y2!)            sqrt((X2! -X1!)^2 + (Y2! - Y1!)^2)
dist(X1!, Y1!, Z1!, X2!, Y2!, Z2!)  sqrt((X2! -X1!)^2 + (Y2! - Y1!)^2  + (Z2! - Z1!)^2)e>

mais qui prochain Subscriptionsversion venez bestimmt!

Salut
Roland
 
Intel Duo E8400 3,0 GHz / 4 GB RAM / 1000 GB HDD - ATI Radeon HD 4770 512 MB - Windows 7 Home Premium 32Bit - XProfan X4
30.11.2007  
 



répondre


Topictitle, max. 100 marque.
 

Systemprofile:

ne...aucune Systemprofil angelegt. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

s'il te plaît s'inscrire um une Beitrag trop verfassen.
 

Options du sujet

2.790 Views

Untitledvor 0 min.
Sven Bader09.07.2021
iF24.09.2020
RGH10.05.2013
Georg Teles29.03.2013
plus...

Themeninformationen

cet Thema hat 3 participant:

iF (4x)
Frank Abbing (3x)
RGH (2x)


Admins  |  AGB  |  Applications  |  Auteurs  |  Chat  |  protection des données  |  Télécharger  |  Entrance  |  Aider  |  Merchantportal  |  Empreinte  |  Mart  |  Interfaces  |  SDK  |  Services  |  Jeux  |  cherche  |  Support

un projet aller XProfaner, qui il y a!


Mon XProfan
Privé Nouvelles
Eigenes Ablageforum
Sujets-La liste de voeux
Eigene Posts
Eigene Sujets
Zwischenablage
Annuler
 Deutsch English Français Español Italia
Traductions

protection des données


Wir verwenden Cookies seulement comme Session-Cookies à cause de qui technischen Notwendigkeit et chez uns gibt es aucun Cookies de Drittanbietern.

si du ici sur unsere Webseite klickst ou bien navigierst, stimmst du unserer Erfassung de Informationen dans unseren Cookies sur XProfan.Net trop.

Weitere Informationen trop unseren Cookies et en supplément, comment du qui Kontrolle par-dessus behältst, findest du dans unserer nachfolgenden Datenschutzerklärung.


d'accordDatenschutzerklärung
je voudrais keinen Cookie