AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

OpenGL: Verdunkeln

Ein Thema von Destroyer446 · begonnen am 7. Jul 2012 · letzter Beitrag vom 7. Jul 2012
Antwort Antwort
Namenloser

Registriert seit: 7. Jun 2006
Ort: Karlsruhe
3.724 Beiträge
 
FreePascal / Lazarus
 
#1

AW: OpenGL: Verdunkeln

  Alt 7. Jul 2012, 18:15
Das Problem dabei ist, wenn ich z.B. habe:
glColor3f(0, 240, 233);

und dann als dunkle variante mache:
glColor3f(0, 213, 206);

funzt das nich weil er nicht von 255 ausgeht sondern von 213 wenn 213 das höchste ist.
Das heißt er rechnet nur Prozentual - und das möchte ich vermeiden.
Die Parameter von glColor3f gehen von 0.0 bis 1.0, nicht von 0 bis 255.

Zitat von OpenGl-Spezifikation:
Current color values are stored in floating-point format, with unspecified mantissa and exponent sizes. Unsigned integer color components, when specified, are linearly mapped to floating-point values such that the largest representable value maps to 1.0 (full intensity), and 0 maps to 0.0 (zero intensity). Signed integer color components, when specified, are linearly mapped to floating-point values such that the most positive representable value maps to 1.0, and the most negative representable value maps to -1.0 . [...]

Floating-point values are mapped directly.
Das was in fett geschrieben ist, passiert bei dir.
  Mit Zitat antworten Zitat
Destroyer446

Registriert seit: 17. Jan 2011
67 Beiträge
 
#2

AW: OpenGL: Verdunkeln

  Alt 7. Jul 2012, 21:14
Ich habe das mit GL_LINE_LOOP probiert, nur leider waren die Linien nicht so, wie ich wollte;
Meine Versuchs-Prozedur:
Delphi-Quellcode:
procedure DrawBlock(X, Y: Integer; RGBColor: TRGBColor);
begin
 glBegin(GL_QUADS);
  glColor3f(RGBColor.R, RGBColor.G, RGBColor.B);
  glVertex2f(X, Y);
  glVertex2f(X+BlockSize, Y);
  glVertex2f(X+BlockSize, Y+BlockSize);
  glVertex2f(X, Y+BlockSize);
 glEnd;
 If (RGBColor.R = 0) and (RGBColor.G = 0) and (RGBColor.B = 0) then Exit; // Falls Hintergrund, dann keine Umrandung
 glBegin(GL_LINE_LOOP);
  glColor3f(1, 0, 0);
  glVertex2f(X, Y);
  glVertex2f(X+BlockSize, Y);
  glVertex2f(X+BlockSize, Y+BlockSize);
  glVertex2f(X, Y+BlockSize);
 glEnd;
end;
Das Quadrat zeichnen geht, nur das mit der Strecke nicht... (const BlockSize = 1)
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 21:10 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz