hedgewars/uRender.pas
changeset 15924 3de00d203178
parent 15844 4ede5e84278a
equal deleted inserted replaced
15915:35d26863a88e 15924:3de00d203178
   133 
   133 
   134 {$IFDEF USE_S3D_RENDERING}
   134 {$IFDEF USE_S3D_RENDERING}
   135     // texture/vertex buffers for left/right/default eye modes
   135     // texture/vertex buffers for left/right/default eye modes
   136     texLRDtb, texLvb, texRvb: array [0..3] of TVertex2f;
   136     texLRDtb, texLvb, texRvb: array [0..3] of TVertex2f;
   137 {$ENDIF}
   137 {$ENDIF}
       
   138    isLineSmoothBroken : boolean;
   138 
   139 
   139 procedure openglLoadIdentity    (); forward;
   140 procedure openglLoadIdentity    (); forward;
   140 procedure openglTranslProjMatrix(X, Y, Z: GLFloat); forward;
   141 procedure openglTranslProjMatrix(X, Y, Z: GLFloat); forward;
   141 procedure openglScalef          (ScaleX, ScaleY, ScaleZ: GLfloat); forward;
   142 procedure openglScalef          (ScaleX, ScaleY, ScaleZ: GLfloat); forward;
   142 procedure openglRotatef         (RotX, RotY, RotZ: GLfloat; dir: LongInt); forward;
   143 procedure openglRotatef         (RotX, RotY, RotZ: GLfloat; dir: LongInt); forward;
   445     tmpn: LongInt;
   446     tmpn: LongInt;
   446 begin
   447 begin
   447     // suppress hint/warning
   448     // suppress hint/warning
   448     AuxBufNum:= AuxBufNum;
   449     AuxBufNum:= AuxBufNum;
   449 
   450 
       
   451     isLineSmoothBroken:= shortstring(glGetString(GL_VENDOR)) = 'AMD';
       
   452 
   450     // get the max (h and v) size for textures that the gpu can support
   453     // get the max (h and v) size for textures that the gpu can support
   451     glGetIntegerv(GL_MAX_TEXTURE_SIZE, @MaxTextureSize);
   454     glGetIntegerv(GL_MAX_TEXTURE_SIZE, @MaxTextureSize);
   452     if MaxTextureSize <= 0 then
   455     if MaxTextureSize <= 0 then
   453         begin
   456         begin
   454         MaxTextureSize:= 1024;
   457         MaxTextureSize:= 1024;
  1499     UpdateModelviewProjection;
  1502     UpdateModelviewProjection;
  1500 end;
  1503 end;
  1501 
  1504 
  1502 procedure DrawLineOnScreen(X0, Y0, X1, Y1, Width: Single; r, g, b, a: Byte);
  1505 procedure DrawLineOnScreen(X0, Y0, X1, Y1, Width: Single; r, g, b, a: Byte);
  1503 begin
  1506 begin
  1504     glEnable(GL_LINE_SMOOTH);
  1507     if not isLineSmoothBroken then
       
  1508        glEnable(GL_LINE_SMOOTH);
  1505 
  1509 
  1506     EnableTexture(False);
  1510     EnableTexture(False);
  1507 
  1511 
  1508     glLineWidth(Width);
  1512     glLineWidth(Width);
  1509 
  1513 
  1517     glDrawArrays(GL_LINES, 0, 2);
  1521     glDrawArrays(GL_LINES, 0, 2);
  1518     untint();
  1522     untint();
  1519 
  1523 
  1520     EnableTexture(True);
  1524     EnableTexture(True);
  1521 
  1525 
  1522     glDisable(GL_LINE_SMOOTH);
  1526     if not isLineSmoothBroken then
       
  1527        glDisable(GL_LINE_SMOOTH);
  1523 end;
  1528 end;
  1524 
  1529 
  1525 procedure DrawRect(rect: TSDL_Rect; r, g, b, a: Byte; Fill: boolean);
  1530 procedure DrawRect(rect: TSDL_Rect; r, g, b, a: Byte; Fill: boolean);
  1526 begin
  1531 begin
  1527 // do not draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs)
  1532 // do not draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs)
  1588         VertexBuffer[i].X := X + Radius*cos(i*pi/30);
  1593         VertexBuffer[i].X := X + Radius*cos(i*pi/30);
  1589         VertexBuffer[i].Y := Y + Radius*sin(i*pi/30);
  1594         VertexBuffer[i].Y := Y + Radius*sin(i*pi/30);
  1590     end;
  1595     end;
  1591 
  1596 
  1592     EnableTexture(False);
  1597     EnableTexture(False);
  1593     glEnable(GL_LINE_SMOOTH);
  1598     if not isLineSmoothBroken then
       
  1599        glEnable(GL_LINE_SMOOTH);
       
  1600 
  1594     //openglPushMatrix;
  1601     //openglPushMatrix;
  1595     glLineWidth(Width);
  1602     glLineWidth(Width);
  1596     SetVertexPointer(@VertexBuffer[0], 60);
  1603     SetVertexPointer(@VertexBuffer[0], 60);
  1597     glDrawArrays(GL_LINE_LOOP, 0, 60);
  1604     glDrawArrays(GL_LINE_LOOP, 0, 60);
  1598     //openglPopMatrix;
  1605     //openglPopMatrix;
  1599     EnableTexture(True);
  1606     EnableTexture(True);
  1600     glDisable(GL_LINE_SMOOTH);
  1607     if not isLineSmoothBroken then
       
  1608        glDisable(GL_LINE_SMOOTH);
  1601 end;
  1609 end;
  1602 
  1610 
  1603 procedure DrawCircleFilled(X, Y, Radius: LongInt; r, g, b, a: Byte);
  1611 procedure DrawCircleFilled(X, Y, Radius: LongInt; r, g, b, a: Byte);
  1604 var
  1612 var
  1605     i: LongInt;
  1613     i: LongInt;