From 2860c27d15230ebee31b7c19de106e151484dc01 Mon Sep 17 00:00:00 2001 From: parax0 Date: Tue, 1 Mar 2016 04:05:40 -0700 Subject: [PATCH] Made collision wireframe render with glPolygonMode --- src/Core/Resource/CCollisionMesh.cpp | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/src/Core/Resource/CCollisionMesh.cpp b/src/Core/Resource/CCollisionMesh.cpp index 1e43d836..035b2ef5 100644 --- a/src/Core/Resource/CCollisionMesh.cpp +++ b/src/Core/Resource/CCollisionMesh.cpp @@ -1,5 +1,6 @@ #include "CCollisionMesh.h" #include "Core/Render/CRenderer.h" +#include "Core/Render/CDrawUtil.h" CCollisionMesh::CCollisionMesh() { @@ -75,27 +76,16 @@ void CCollisionMesh::Draw() if (!mBuffered) BufferGL(); mVBO.Bind(); - mIBO.Bind(); - - glDrawElements(GL_TRIANGLES, mIBO.GetSize(), GL_UNSIGNED_SHORT, (void*) 0); - gDrawCount++; - mIBO.Unbind(); + mIBO.DrawElements(); mVBO.Unbind(); } void CCollisionMesh::DrawWireframe() { - if (!mBuffered) BufferGL(); - - mVBO.Bind(); - mIBO.Bind(); - for (u32 f = 0; f < mFaceCount; f++) - { - glDrawElements(GL_LINE_LOOP, 3, GL_UNSIGNED_SHORT, (void*) (f * 6)); - gDrawCount++; - } - mIBO.Unbind(); - mVBO.Unbind(); + CDrawUtil::UseColorShader(CColor::skBlack); + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + Draw(); + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); } CCollisionMesh::CCollisionVertex* CCollisionMesh::GetVertex(u16 index)