Files |  Tutorials |  Articles |  Links |  Home |  Team |  Forum |  Wiki |  Impressum

Aktuelle Zeit: Sa Jul 05, 2025 09:02

Foren-Übersicht » Programmierung » Allgemein
Unbeantwortete Themen | Aktive Themen



Ein neues Thema erstellen Auf das Thema antworten  [ 3 Beiträge ] 
Autor Nachricht
BeitragVerfasst: Di Sep 07, 2010 10:17 
Offline
DGL Member

Registriert: Sa Mai 15, 2010 13:25
Beiträge: 13
Wenn ich eine Linie ziehe im Orthosystem, von 0 nach 100 , werden die Kanten(enden) senkrecht nach Unten gezeichnet, sieht bei dicken Linien aus wie ein Parallelogramm.
Wie kann man das vermeiden.

Code:
glPushMatrix()
  glLineWidth(20)
  glColor3f(0, 0, 1)
  glTranslatef(240, 200, 1)
  glBegin(GL_LINES)
  glVertex2f(0, 0)
  glVertex2f(100, 100)
  glEnd()
glPopMatrix()


Nach oben
 Profil  
Mit Zitat antworten  
BeitragVerfasst: Di Sep 07, 2010 10:58 
Offline
DGL Member
Benutzeravatar

Registriert: Di Sep 20, 2005 13:18
Beiträge: 1054
Wohnort: Dresden
Programmiersprache: C, C++, Pascal, OPL
Ne Idee wäre: Schreib dir eine eigene Linienfunktion, die ein Quad als Linie zeichnet. Dann kannst du die Enden auch mit Kreisen abrunden, wenn du willst.

_________________
Denn wer nur schweigt, weil er Konflikte scheut, der macht Sachen, die er hinterher bereut.
Und das ist verkehrt, denn es ist nicht so schwer, jeden Tag zu tun als ob's der letzte wär’.
Und du schaust mich an und fragst ob ich das kann.
Und ich denk, ich werd' mich ändern irgendwann.

_________________Farin Urlaub - Bewegungslos


Nach oben
 Profil  
Mit Zitat antworten  
BeitragVerfasst: Di Sep 07, 2010 11:06 
Offline
Guitar Hero
Benutzeravatar

Registriert: Do Sep 25, 2003 15:56
Beiträge: 7810
Wohnort: Sachsen - ERZ / C
Programmiersprache: Java (, Pascal)
Das hier hab ich per Google gefunden:
Zitat:
The most consistent and portable way to draw think lines using OpenGL is to use camera aligned (otherwise know as billboarded) polygons. Different implementations of the OpenGL API handle the end points of the lines differently and GL_LINE_SMOOTH produces drastically different results depending on the platform. Some implementations consider lines of thickness greater then 1 to be ill-defined. As stated in the glLineWidth manpages: [For anti-aliased lines] only width 1 is guaranteed to be supported; others depend on the implementation.

That being said, I have used a simple 2 pass hack to address this very problem.

1. Disable writing to the depth buffer glDepthMask(GL_FALSE)
2. Draw smoothed lines of desired thickness
3. Draw smoothed points at the endpoints of all the lines that are the same size at the lines. (this step may not be needed to fill the gap, however it should round out the points where the lines meet and make everything look a little smoother)
4. Re-enable the depth buffer for writing glDepthMask(GL_TRUE)

You may also want to play around with the depth buffer settings. The "gap" between the lines may be due to the 2nd line failing a depth test on pixels that have been alpha blended with the background.

_________________
Blog: kevin-fleischer.de und fbaingermany.com


Nach oben
 Profil  
Mit Zitat antworten  
Beiträge der letzten Zeit anzeigen:  Sortiere nach  
Ein neues Thema erstellen Auf das Thema antworten  [ 3 Beiträge ] 
Foren-Übersicht » Programmierung » Allgemein


Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 4 Gäste


Du darfst keine neuen Themen in diesem Forum erstellen.
Du darfst keine Antworten zu Themen in diesem Forum erstellen.
Du darfst deine Beiträge in diesem Forum nicht ändern.
Du darfst deine Beiträge in diesem Forum nicht löschen.
Du darfst keine Dateianhänge in diesem Forum erstellen.

Suche nach:
Gehe zu:  
cron
  Powered by phpBB® Forum Software © phpBB Group
Deutsche Übersetzung durch phpBB.de
[ Time : 0.010s | 17 Queries | GZIP : On ]