فهرست منبع

Simplify OpenGL code.

Lasse Öörni 9 سال پیش
والد
کامیت
d80e5f9a32
2فایلهای تغییر یافته به همراه7 افزوده شده و 10 حذف شده
  1. 5 8
      Source/Urho3D/Graphics/OpenGL/OGLGraphics.cpp
  2. 2 2
      Source/Urho3D/Graphics/OpenGL/OGLGraphics.h

+ 5 - 8
Source/Urho3D/Graphics/OpenGL/OGLGraphics.cpp

@@ -831,10 +831,8 @@ void Graphics::Draw(PrimitiveType type, unsigned indexStart, unsigned indexCount
 
 void Graphics::Draw(PrimitiveType type, unsigned indexStart, unsigned indexCount, unsigned baseVertexIndex, unsigned minVertex, unsigned vertexCount)
 {
-#if !defined(GL_ES_VERSION_2_0)
-    if (!gl3Support)
-        return;
-    if (!indexCount || !indexBuffer_ || !indexBuffer_->GetGPUObject())
+#ifndef GL_ES_VERSION_2_0
+    if (!gl3Support || !indexCount || !indexBuffer_ || !indexBuffer_->GetGPUObject())
         return;
 
     PrepareDraw();
@@ -891,10 +889,8 @@ void Graphics::DrawInstanced(PrimitiveType type, unsigned indexStart, unsigned i
 void Graphics::DrawInstanced(PrimitiveType type, unsigned indexStart, unsigned indexCount, unsigned baseVertexIndex, unsigned minVertex, 
         unsigned vertexCount, unsigned instanceCount)
 {
-#if !defined(GL_ES_VERSION_2_0)
-    if (!gl3Support)
-        return;
-    if (!indexCount || !indexBuffer_ || !indexBuffer_->GetGPUObject() || !instancingSupport_)
+#ifndef GL_ES_VERSION_2_0
+    if (!gl3Support || !indexCount || !indexBuffer_ || !indexBuffer_->GetGPUObject() || !instancingSupport_)
         return;
 
     PrepareDraw();
@@ -913,6 +909,7 @@ void Graphics::DrawInstanced(PrimitiveType type, unsigned indexStart, unsigned i
     ++numBatches_;
 #endif
 }
+
 void Graphics::SetVertexBuffer(VertexBuffer* buffer)
 {
     // Note: this is not multi-instance safe

+ 2 - 2
Source/Urho3D/Graphics/OpenGL/OGLGraphics.h

@@ -126,12 +126,12 @@ public:
     void Draw(PrimitiveType type, unsigned vertexStart, unsigned vertexCount);
     /// Draw indexed geometry.
     void Draw(PrimitiveType type, unsigned indexStart, unsigned indexCount, unsigned minVertex, unsigned vertexCount);
-    /// Draw indexed geometry with vertex index offset. ONLY supported if the GL version is 3.2 or greater!
+    /// Draw indexed geometry with vertex index offset. Only supported on desktop OpenGL 3.2 or greater.
     void Draw(PrimitiveType type, unsigned indexStart, unsigned indexCount, unsigned baseVertexIndex, unsigned minVertex, unsigned vertexCount);
     /// Draw indexed, instanced geometry.
     void DrawInstanced(PrimitiveType type, unsigned indexStart, unsigned indexCount, unsigned minVertex, unsigned vertexCount,
         unsigned instanceCount);
-    /// Draw indexed, instanced geometry with vertex index offset. ONLY supported if the GL version is 3.2 or greater!
+    /// Draw indexed, instanced geometry with vertex index offset. Only supported on desktop OpenGL 3.2 or greater.
     void DrawInstanced(PrimitiveType type, unsigned indexStart, unsigned indexCount, unsigned baseVertexIndex, unsigned minVertex, 
         unsigned vertexCount, unsigned instanceCount);
     /// Set vertex buffer.