DGL
https://delphigl.com/forum/

SkyBox
https://delphigl.com/forum/viewtopic.php?f=19&t=3866
Seite 1 von 1

Autor:  Stucuk [ Di Mär 01, 2005 01:46 ]
Betreff des Beitrags:  SkyBox

When i do a skybox i always get lines running along the sides. It never happened on my Geforce Ti4200 but it does on my Geforce FX 5900 XT. (other ppl reported it when i only had the Ti4200 on other apps)

I use the following code:

Code:
  1.  
  2. procedure TSkybox.DrawBox(pos : TVector3f);
  3. var px,py,pz : GLFloat;
  4.     dov : single;
  5. begin
  6.  
  7. if not HasBeenSet then exit;
  8. Engine.Main.LastTexId := -1;
  9.  
  10.   glEnable(GL_TEXTURE_2D);
  11.  
  12.   if FList = -1 then begin
  13.     dov := Engine.Map.WORLD_MAX*2;
  14.     // left, back und top sind falsch
  15.     px := (- dov  / 2);//+pos.x;
  16.     py := (- dov / 2);//+pos.y;
  17.     pz := (- dov / 2);//+pos.z;
  18.  
  19.     FList := glGenLists(1);
  20.     glNewList(FList, GL_COMPILE);
  21.     // Back
  22.     glColor3f(1,1,1);
  23.  
  24.     glBindTexture(GL_TEXTURE_2D, FTextures[3]);
  25.  
  26.     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
  27.     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
  28.  
  29.     glBegin(GL_QUADS);
  30.       glTexCoord2f(1, 0); glVertex3f(px + dov, py,           pz);
  31.       glTexCoord2f(1, 1); glVertex3f(px + dov, py + dov, pz);
  32.       glTexCoord2f(0, 1); glVertex3f(px,          py + dov, pz);
  33.       glTexCoord2f(0, 0); glVertex3f(px,          py,           pz);
  34.  
  35.     glEnd;
  36.     // Front
  37.     glBindTexture(GL_TEXTURE_2D, FTextures[2]);
  38.  
  39.     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
  40.     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
  41.  
  42.     glBegin(GL_QUADS);
  43.       glTexCoord2f(1, 0); glVertex3f(px,          py,           pz + dov);
  44.       glTexCoord2f(1, 1); glVertex3f(px,          py + dov, pz + dov);
  45.       glTexCoord2f(0, 1); glVertex3f(px + dov, py + dov, pz + dov);
  46.       glTexCoord2f(0, 0); glVertex3f(px + dov, py,           pz + dov);
  47.     glEnd;
  48.     // Bottom
  49.     glBindTexture(GL_TEXTURE_2D, FTextures[5]);
  50.  
  51.     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
  52.     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
  53.  
  54.     glBegin(GL_QUADS);
  55.       glTexCoord2f(1, 1); glVertex3f(px,         py, pz);
  56.       glTexCoord2f(1, 0); glVertex3f(px,         py, pz + dov);
  57.       glTexCoord2f(0, 0); glVertex3f(px + dov, py, pz + dov);
  58.       glTexCoord2f(0, 1); glVertex3f(px + dov, py, pz);
  59.     glEnd;
  60.     // Top
  61.     glBindTexture(GL_TEXTURE_2D, FTextures[4]);
  62.  
  63.     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
  64.     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
  65.  
  66.     glBegin(GL_QUADS);
  67.       glTexCoord2f(0, 0); glVertex3f(px+dov, py + dov, pz);
  68.       glTexCoord2f(1, 0); glVertex3f(px+dov, py + dov, pz + dov);
  69.       glTexCoord2f(1, 1); glVertex3f(px,       py + dov, pz + dov);
  70.       glTexCoord2f(0, 1); glVertex3f(px,       py + dov, pz);
  71.     glEnd;
  72.     // Left
  73.     glBindTexture(GL_TEXTURE_2D, FTextures[1]);
  74.  
  75.     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
  76.     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
  77.  
  78.     glBegin(GL_QUADS);
  79.       glTexCoord2f(1, 1); glVertex3f(px, py + dov, pz);
  80.       glTexCoord2f(0, 1); glVertex3f(px, py + dov, pz + dov);
  81.       glTexCoord2f(0, 0); glVertex3f(px, py,           pz + dov);
  82.       glTexCoord2f(1, 0); glVertex3f(px, py,           pz);
  83.     glEnd;
  84.  
  85.     // Right
  86.     glBindTexture(GL_TEXTURE_2D, FTextures[0]);
  87.  
  88.     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
  89.     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
  90.  
  91.     glBegin(GL_QUADS);
  92.       glTexCoord2f(0, 0); glVertex3f(px + dov, py,           pz);
  93.       glTexCoord2f(1, 0); glVertex3f(px + dov, py,           pz + dov);
  94.       glTexCoord2f(1, 1); glVertex3f(px + dov, py + dov, pz + dov);
  95.       glTexCoord2f(0, 1); glVertex3f(px + dov, py + dov, pz);
  96.     glEnd;
  97.     glEndList;
  98.   end;
  99.   // Call the Displaylist of our Skybox
  100. //  glLoadIdentity;
  101.   glMatrixMode(GL_MODELVIEW);
  102.   glPushMatrix;
  103.   glTranslatef(pos.X, pos.y, pos.Z);
  104.   glCallList(FList);
  105.   glPopMatrix;
  106. end;
  107.  


Anyone know whats up with it?

Dateianhänge:
MapViewer.jpg [227.85 KiB]
65-mal heruntergeladen

Autor:  Sascha Willems [ Di Mär 01, 2005 10:10 ]
Betreff des Beitrags: 

You need to use GL_CLAMP_TO_EDGE instead of GL_CLAMP to get rid of those edges. It's some misbehaviour of older nvidia-drivers that did make it look OK with only GL_CLAMP on your old card.

Autor:  Frase [ Di Mär 01, 2005 16:14 ]
Betreff des Beitrags: 

Sorry for the german screenshot. But I think you should be able to find the correct english options ;)

Try to change the selected option. The problem should then be gone...

Dateianhänge:
Clamp.png
Clamp.png [ 50.06 KiB | 3978-mal betrachtet ]

Autor:  Stucuk [ Di Mär 01, 2005 20:19 ]
Betreff des Beitrags: 

Sascha Willems hat geschrieben:
You need to use GL_CLAMP_TO_EDGE instead of GL_CLAMP to get rid of those edges. It's some misbehaviour of older nvidia-drivers that did make it look OK with only GL_CLAMP on your old card.


ahh, thx

Seite 1 von 1 Alle Zeiten sind UTC + 1 Stunde
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/