function [tri, vertices] = objread(filename)
tri = [];
vertices = [];
fid = fopen(filename, 'r');
while 1
    tline = fgetl(fid);
    if ~ischar(tline)
        break
    end
    if ~isempty(tline)
    switch tline(1)
        case 'f'
            [a, b, c] = strread(tline, 'f%d%d%d', 'delimiter', ' ');
            tri = [tri; [a, b, c]];
        case 'v'
            if tline(2)~='t'
            vertices = [vertices; str2num(tline(3:end))];
            end
        otherwise
            
    end
    end
end
fclose(fid);