English
Forum

OpenGL The second: Anti Aliasing

 
- Page 1 -



Sven
Bader
Hi,

OpenGL in XProfan power correctly. Fun, with of/ one thing be I but not yet integrally pleased. I had gladly slippery Kanten (Antialisasing). what one so in the network finds are The References really always same and well in XProfan nachzustellen, unfortunately becomes too between whom Polygonen, The really zusammengehören neatened - the results in Löchern
I have already probiert, with StartList/Endlist/Drawlist items To group, too have I testweise large pieces the Codes with API Call supplant.

Perhaps happens in the Init-commands something, that not so verträgt?

has itself of you Schonmal someone with the Topic befasst? I would find it too for Games with plainer graphic right wichitg, it heard somehow moreover.

greetings
Sven

in the integral is the the code, the whom Objects vorangestellt go must:
oGL("glBlendFunc",&GL_SRC_ALPHA, &GL_ONE_MINUS_SRC_ALPHA)
oGL("glEnable", &GL_BLEND)
oGL("glEnable", &GL_POLYGON_SMOOTH);
oGL("glHint", &GL_POLYGON_SMOOTH_HINT, &GL_NICEST);

One lauffähiges Komplettbeispiel is here, with Leertaste can the Glättung on and off:
'$H OpenGL.ph
Def &GL_POLYGON_SMOOTH	$B41;
Def &GL_NICEST	$1102;
Def &GL_ONE_MINUS_SRC_ALPHA	$303;
Def &GL_SRC_ALPHA	 $302;
Def &GL_POLYGON_SMOOTH_HINT	$C53;
Def &GL_ONE	1;
Def &GL_BLEND	3042;

proc DrawGLScene

    oGL("Clear")
    oGL("Color", 1,1,1,1)

    if (aa% = 1)

        oGL("glBlendFunc",&GL_SRC_ALPHA, &GL_ONE_MINUS_SRC_ALPHA)
        oGL("glEnable", &GL_BLEND)
        oGL("glEnable", &GL_POLYGON_SMOOTH);
        oGL("glHint", &GL_POLYGON_SMOOTH_HINT, &GL_NICEST);

    else

        oGL("glDisable",&GL_POLYGON_SMOOTH)
        oGL("glDisable", &GL_BLEND)
        oGL("glBlendFunc",&GL_ONE, &GL_ONE)

    endif

    oGL("Origin", 0, 0, -4.0)
    oGL("Rotate", 0, 0, 22.5)
    oGL("Origin", -1.0, 0, -4.0)
    oGL("Quad", 2, 2)
    oGL("Origin", 1.0, 0, -4.0)
    oGL("sphere", 1,20,20)
    oGL("Show")

endproc

declare end%, aa%
window 600,400
oGL("Init", %hWnd, 0.5, 0.5, 0.5, 0)
oGL("PosMode", 1)
aa% = 1
DrawGLScene()
ende% = 0

WhileNot end%

    WaitInput

    if (%key = 32)

        sleep 200
        aa% = abs(aa% - 1)

    elseif (%key = 27)

        end% = 1

    endif

    DrawGLScene()

EndWhile

oGL("Done")
end

Antialiasing AN, The Borders are ok, but any Schnittkanten having holes





Standardzustand Antialiasing AUS, Schnittkanten ok, but no Glättung





Hack: Anti Aliasing by Grafiktreiber erzwungen, so ought to it looks




an.jpg  
27 kB
Bezeichnung:AA an
Hochgeladen:07/12/21
Downloadcounter67
Download
17 kB
Bezeichnung:AA aus
Hochgeladen:07/12/21
Downloadcounter66
Download
17 kB
Bezeichnung:AA über den Treiber erzwungen
Hochgeladen:07/12/21
Downloadcounter72
Download
13 kB
Hochgeladen:07/12/21
Downloadcounter69
Download
6 kB
Hochgeladen:07/12/21
Downloadcounter74
Download
5 kB
Hochgeladen:07/12/21
Downloadcounter60
Download
 
07/12/21  
 



« this Posting watts as Solution marked. »


Sven
Bader
for my tack have I a Solution, The unfortunately in each something komplexerem associated area failure becomes.

I lay the ungeglättete Objekt ....



... with the whom slippery Kanten ...



... the Result is How gewüsncht



to that a is it wrong and unperformant the whole Objekt once more to drawing, to that others it can method To others Problemen lead if the Objekt no "culled faces" means unsichtbare reverses had or one ever to Beschaffenheit the Objekts pieces of itself self by the holes sees. too combination with transparenten Objects sorgt with this Solution for confusion.

interestingly To see is, that the Originalobjekt something small and that the Glättung outside moreover comes - there asks one itself, as at all to the Löchern in the Innenbereich comes ...

an Interessante Variant angwendetes Smoothing but with deaktiviertem Blending, so get to the "größere" Objekt, but the only on the Rande.





lying The Solution just in the right glBlendFunc(), which letztendlich the does, I with two identischen Objects nachbilde or can it something with Buffern or oGL Grundeinstellungen concern?

here the new code
 $H OpenGL.ph

proc DrawGLScene

    oGL("Clear")
    oGL("Color", 1,1,1,1)

    if (aa%)

        oGL("glDisable", ~GL_BLEND)
        oGL("glDisable", ~GL_POLYGON_SMOOTH)
        'Objekt with hard Kanten
        oGL("Push")
        oGL("Rotate", 0, 0, 22.5)
        oGL("Origin", -1.0, 0, -4.0)
        oGL("Quad", 2, 2)
        oGL("Origin", 1.0, 0, -4.0)
        oGL("sphere", 1,30,30)
        oGL("Pop")
        oGL("glBlendFunc",~GL_SRC_ALPHA, ~GL_ONE_MINUS_SRC_ALPHA)
        oGL("glEnable", ~GL_POLYGON_SMOOTH)
        oGL("glEnable", ~GL_BLEND)
        'Gleiches Objekt geglätten above
        oGL("Push")
        oGL("Rotate", 0, 0, 22.5)
        oGL("Origin", -1.0, 0, -4.0)
        oGL("Quad", 2, 2)
        oGL("Origin", 1.0, 0, -4.0)
        oGL("sphere", 1,30,30)
        oGL("Pop")

    else

        oGL("glDisable", ~GL_BLEND)
        oGL("glDisable", ~GL_POLYGON_SMOOTH)
        oGL("Push")
        oGL("Rotate", 0, 0, 22.5)
        oGL("Origin", -1.0, 0, -4.0)
        oGL("Quad", 2, 2)
        oGL("Origin", 1.0, 0, -4.0)
        oGL("sphere", 1,30,30)
        oGL("Pop")

    endif

    oGL("Show")

endproc

declare end%, aa%
window 600,400
oGL("Init", %hWnd, 0.5, 0.5, 0.5, 0)
oGL("PosMode", 1)
oGL("glHint", ~GL_POLYGON_SMOOTH_HINT, ~GL_NICEST);
ende% = 0
aa% = 1
DrawGLScene()

WhileNot end%

    WaitInput

    if (%key = 32)

        sleep 200
        aa% = abs(aa% - 1)

    elseif (%key = 27)

        end% = 1

    endif

    DrawGLScene()

EndWhile

oGL("Done")
end

1.png  
4 kB
Bezeichnung:1
Hochgeladen:07/19/21
Downloadcounter76
Download
2.png  
4 kB
Bezeichnung:2
Hochgeladen:07/19/21
Downloadcounter77
Download
3.png  
4 kB
Bezeichnung:3
Hochgeladen:07/19/21
Downloadcounter63
Download
4.png  
4 kB
Bezeichnung:4
Hochgeladen:07/19/21
Downloadcounter84
Download
 
07/19/21  
 




Sven
Bader
I have whom Posting as resolved declared though it no perfect Solution gives.

its well simply so, that The ursprüngliche Possibility over GL_POLYGON_SMOOTH of present Grafiktreibern not any more correctly treats and is one on zeitgemäßere (and complex) Technologien zurückgreifen ought to. an Lösungsansatz with oldschool OpenGL would yet the mehrfache slight versetzte Rendern into Accumulation Buffer (glAccum), whom have so did i already successful for Motion Blur uses.
 
09/07/21  
 



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.697 Views

Untitledvor 0 min.
Sven Bader03/07/23
Alibre01/14/23
Ernst05/29/22
Thomas Zielinski10/07/21
More...

Themeninformationen

this Topic has 1 subscriber:

Sven Bader (3x)


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