English
Opportunities and suggestions

wish: More performance for Games

 
I benenne here simply time Funktionswünsche which help can the XProfan-Spieleprogrammierer More performance inside the programs achieve can. (Performance is with play Yes often importent as z.B. with of/ one smaller Datenbankanwendung.)

would be me forward if too others here a or others Idea for Roland leave behind would.

• Rechteckintersektionskontrolle (ggf. with Überlappungsfaktor as Float)
• Distance zweier spots (2D & 3D) (  [...]  )
CompileMarkSeparation
• Bound (normalisieren?) bound(x,-30,30)
CompileMarkSeparation
the likes of course everything narrow-minded wirken, but it power already a vastly Geschwindigkeitsunterschied from if one on such native aide zurückgreifen could, and particularly with play counts each µ.
 
11/05/07  
 



Next Part - sub-topic OpenGL.

following functions - if nativ Umgesetzt - could the XProfan-OGL-Game developers explicit More joy at program verschaffen!
CompileMarkSeparation
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)

    }<
}

and these:
CompileMarkSeparation
and hereon aufbauend these:
CompileMarkSeparation
and even if unübersichtlich appear - so importent these: (benötigte Texturdatei in the attachment)
CompileMarkSeparation
of this integrally To silence:
CompileMarkSeparation
and what simple:
CompileMarkSeparation
and what wichtiges!:
CompileMarkSeparation

769 kB
Hochgeladen:11/05/07
Downloadcounter140
Download
1.024 kB
Hochgeladen:11/05/07
Downloadcounter333
Download
 
11/05/07  
 



Sub-Topic Vektorkollisionen/Winkelfunktionen:

OK I were rather first once To Roland The conversations To o.g. Topics adopted has.
 
11/05/07  
 




Frank
Abbing
I erdreiste me too time...

Ogl: shadow Nr.1
CompileMarkSeparation
 {$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#
End
 
11/05/07  
 




Frank
Abbing
Ogl: shadow Nr.2
CompileMarkSeparation
 {$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#
End
 
11/05/07  
 




Frank
Abbing
Ogl: Anti-Aliasing
CompileMarkSeparation
 {$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:11/05/07
Downloadcounter188
Download
 
11/05/07  
 




RGH
iF
Sub-Topic Vektorkollisionen/Winkelfunktionen:

OK I were rather first once To Roland The conversations To o.g. Topics adopted has.


Hm, if The Source in tidy strukturiertem XProfan wären, could I tappt im dunkeln Yes time try, to see, what The functions make should ... ;)

sound but not unitinteressant ...

Greeting
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
11/05/07  
 



RGH

iF
Sub-Topic Vektorkollisionen/Winkelfunktionen:

OK I were rather first once To Roland The conversations To o.g. Topics adopted has.


Hm, if The Source in tidy strukturiertem XProfan wären, could I tappt im dunkeln Yes time try, to see, what The functions make should ... ;)

sound but not unitinteressant ...

Greeting
Roland


alas! well the teste I same at times nem small example: (okok quäle me quiet )

*umschreib*wurstel*wüt*



Hello Roland, Please füge the XProfan these functions hinzu so these the XProfanProgrammierer nativ exist and so very very plenty faster are as The interpretierten mutants:
CompileMarkSeparation
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)
CompileMarkSeparation
proc bound

    parameters b!,mins!,max!
    case b!<min!:return mins!
    case b!>max!:return max!
    return b!

endproc


• Rechteckintersection
CompileMarkSeparation
proc rectintersect

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

endproc


 
11/05/07  
 




RGH
Hi,

the Topic oGL in Version 11 comes yet.

to that remainder:

Bound() and RecIntersect() is Yes in the actually Subscriptionsversion include:
CompileMarkSeparation
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() is a interesting idea, but (yet) not realized:
CompileMarkSeparation
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>

but The next Subscriptionsversion comes certainly!

Greeting
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
11/30/07  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

2.715 Views

Untitledvor 0 min.
Sven Bader07/09/21
iF09/24/20
RGH05/10/13
Georg Teles03/29/13
More...

Themeninformationen

this Topic has 3 subscriber:

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


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