How do you create a KX_PolygonMaterial? I try to attach a PyOpenGL Shader to an object using the setCustomMaterial() command but It raises an error: 'KX_BlenderMaterial' object has no attribute 'setCustomMaterial.
So I need to retrieve the KX_PolygonMaterial component of my object instead of the KX_BlenderMaterial but the function for getting each one of those is the same 

obj = bge.logic.GetCurrentController().owner    
mat = obj.meshes[0].materials


The corresponding api page describes the object KX_MeshProxy and its function materials saying: "list of KX_BlenderMaterial or KX_PolygonMaterial types"

How can convert the BlenderMaterial to PolygonMaterial ? 

This code should return a PolyMaterial yet it still gives me a BlenderMaterial back; ALso I tryed checking "texture face" but it doesn't solve the problem

mesh = bge.logic.getCurrentController().owner.meshes[0]
poly = mesh.numPolygons
for p in range (poly):
    P = mesh.getPolygon(p)
    PolyMat = P.material
    PolyMat.setCustomMaterial(Material())
Apparently KX_PolygonMaterial doesn't exist anymore.