third_party/virtualbox/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp
/* Convert VMWare primitive type to its OpenGL equivalent. */
/* Calculate the vertex count based on the primitive type and nr of primitives. */
Convert VMWare primitive type to its OpenGL equivalent.
Calculate the vertex count based on the primitive type and nr of primitives.
Convert VMWare primitive type to its OpenGL equivalent . Calculate the vertex count based on the primitive type and nr of primitives .
int vmsvga3dPrimitiveType2OGL(SVGA3dPrimitiveType PrimitiveType, GLenum *pMode, uint32_t cPrimitiveCount, uint32_t *pcVertices)
{
    switch (PrimitiveType)
    {
    case SVGA3D_PRIMITIVE_TRIANGLELIST:
        *pMode      = GL_TRIANGLES;
        *pcVertices = cPrimitiveCount * 3;
        break;
    case SVGA3D_PRIMITIVE_POINTLIST:
        *pMode = GL_POINTS;
        *pcVertices = cPrimitiveCount;
        break;
    case SVGA3D_PRIMITIVE_LINELIST:
        *pMode = GL_LINES;
        *pcVertices = cPrimitiveCount * 2;
        break;
    case SVGA3D_PRIMITIVE_LINESTRIP:
        *pMode = GL_LINE_STRIP;
        *pcVertices = cPrimitiveCount + 1;
        break;
    case SVGA3D_PRIMITIVE_TRIANGLESTRIP:
        *pMode = GL_TRIANGLE_STRIP;
        *pcVertices = cPrimitiveCount + 2;
        break;
    case SVGA3D_PRIMITIVE_TRIANGLEFAN:
        *pMode = GL_TRIANGLE_FAN;
        *pcVertices = cPrimitiveCount + 2;
        break;
    default:
        return VERR_INVALID_PARAMETER;
    }
    return VINF_SUCCESS;
}
int vmsvga3dPrimitiveType2OGL ( SVGA3dPrimitiveType PrimitiveType , GLenum * pMode , uint32_t cPrimitiveCount , uint32_t * pcVertices ) { switch ( PrimitiveType ) { case SVGA3D_PRIMITIVE_TRIANGLELIST : * pMode = GL_TRIANGLES ; * pcVertices = cPrimitiveCount * 3 ; break ; case SVGA3D_PRIMITIVE_POINTLIST : * pMode = GL_POINTS ; * pcVertices = cPrimitiveCount ; break ; case SVGA3D_PRIMITIVE_LINELIST : * pMode = GL_LINES ; * pcVertices = cPrimitiveCount * 2 ; break ; case SVGA3D_PRIMITIVE_LINESTRIP : * pMode = GL_LINE_STRIP ; * pcVertices = cPrimitiveCount + 1 ; break ; case SVGA3D_PRIMITIVE_TRIANGLESTRIP : * pMode = GL_TRIANGLE_STRIP ; * pcVertices = cPrimitiveCount + 2 ; break ; case SVGA3D_PRIMITIVE_TRIANGLEFAN : * pMode = GL_TRIANGLE_FAN ; * pcVertices = cPrimitiveCount + 2 ; break ; default : return VERR_INVALID_PARAMETER ; } return VINF_SUCCESS ; }
Convert VMWare primitive type to its OpenGL equivalent.
Convert VMWare primitive type to its OpenGL equivalent .