SCOTTIE dogs, dancing teacakes, castles, fiddles, mountains, glens, lochs, castles, shipbuilding, golfing, inventions, the Duke of Wellington with a no-parking cone on his head … every cliché associated with Scotland ticked off, ridiculed, subverted and celebrated simultaneously.

And as the smoke drifted off from the last of the thousands of fireworks which exploded over the skyline at the opening ceremony of the Glasgow 2014 Commonwealth Games, what image emerged of the city and the country in which we live our lives, raise our children and consider our future?

The opening ceremony both celebrated and held a mirror up to a modern, self-confident country, although one still not entirely free of that lethal mix of self-love and self-loathing, usually experienced at exactly the same time.

Glasgow is a city populated in the popular imagination by friendly clowns who like a drink and a fag too much for their own good but who nevertheless have the "heart of gold" which must always accompany a life of poverty and deprivation - a myth we have often been too guilty of embracing ourselves as it serves to keep the guilt and shame at bay, just as it masks the fact that we are a far more complicated and conflicted people than we want the world to know.

But thanks to last Wednesday's ceremony what the world does know, unarguably, is that this is a city - and a country - that has magically and joyously reinvented itself for the modern world, finally and forever.

Who now when they think of Glasgow will talk only of the monochrome melancholy of Oscar Marzaroli's Gorbals photographs or the moronic violence of No Mean City? Those are aspects of our past, no argument there. But they are not the aspects that now define us. Not when the world has seen a glorious, European city with culture in its DNA and internationalism at its heart.

This is not actually a new image. It has been promoted for years by those whose job it is to mould the way Glasgow is perceived. But now it has been stamped on the retinas of millions … and sealed with a kiss.

Of course, the first images of Scotland we saw in the opening ceremony were not those of a confident 21st-century nation but of a country content to repackage for the zillionth time the tartan and shortbread nonsense which has scarred every Hogmanay TV special in living memory. Except this time it looked like being even worse, overlaying the pantomime king of kitsch John Barrowman, one of Better Together's celebrity backers.

But as the opening section of the ceremony played out, its true meaning became clearer. This was a knowing, ironic joke designed to hook in the international audience by using the only things they are likely to know about Scotland, while at the same time winking to those of us who live here. We know this is hokum, it said, but let's have some fun with perceptions.

It didn't take long for the first blow to the Brigadoon tomfoolery. It was not the first homosexual kiss in a global opening ceremony but the reference to the Brookside lesbian snog in London 2012 was self-congratulatory whereas when Barrowman planted a smacker on a male dancer it was a confrontational two fingers up to those many Commonwealth countries who would have jailed him had he done the same within their borders. One small kiss, one big statement of solidarity with those fighting homophobia, alongside the flying of the rainbow flag from St Andrew's House and the opening of Pride House next to the Commonwealth Games HQ in Albion Street.

That kiss - and the choice of openly gay Barrowman and comedian/actress Karen Dunbar as the main performers in this opening segment - were exemplars of the subversion of Scottish clichés and of the daring intelligence that characterise the show itself. The obvious antipathy of many in the audience familiar

with Barrowman's performance in the risible Let's Stay Together video was diluted by our pride in a gay man delivering a message of equality and tolerance to homophobes. Smart.

As the show progressed, its enthusiasm for rounding up echoes of our shared past and dragging them into a contemporary context was perhaps most daringly displayed when audio and visual samples of Andy Stewart collided with the euphoric beats of Calvin Harris's dance music, forging a link between popular cultures past and present and forcing us to reassess their relationship. Or maybe just to dance.

I remember Andy Stewart. I remember Donald Where's Your Troosers and Campbeltown Loch (memory jog: he wished it was whisky). Black-and-white TV. Our family living room. A version of Scottishness acceptable even to my mother, who wouldn't allow the use of "working-class" Scottish words and pronunciation. Self-love. Self-loathing. It starts young.

I remember rock'n'roll. Better writers than I have described it as the switch from black-and-white to colour. For me, it rendered the kilts, the fiddles, the Andy Stewart tunes and The White Heather Club reels as instantly irrelevant and even embarrassing. Rock'n'roll was excitement, rebellion and, later, a potential to change the world. The lines which defined identity and loyalties were no longer drawn by geography or even class, but by generation.

Later, when rock music became polluted and neutered by big business I looked elsewhere for my thrills … But not back, never back. I found those thrills in other musics and in the euphoria of the dance floor.

These days I don't dance much and Celtic Connections has taught me just how relevant and exciting our own traditional music still is - never more so than when it reaches out to find common cause with other musics, old and new, from all over the world.

So when Andy Stewart crashes into Calvin Harris, the past is reclaimed just as we claim our place in the here and now. And when the DJ, Mylo, turns the athletes' entrance into a multicultural rave you can imagine you hear, somewhere in the melee, the chant of the 2014 Scottish dance floor: ''here we, here we, here we f****** go''. And you know, it feels great.

But in truth the heart of the ceremony lay, not in the uplifting beats and the crowd's excitement, but in the internationalism and generosity with which the ceremony abounded. It lay in Glasgow's historic decision to be the first to grant Nelson Mandela the freedom of the city in 1981, while he was still incarcerated.

When that happened I remember thinking it would mean little to South Africa and even less to Mandela himself. Self-loathing: it lasts a long time. It turned out I was wrong - a point underlined by Mandela's visit to the city in 1993, when he explained exactly how important the gesture was.

So when South Africa's Pumeza Matshikiza sang Hamish Henderson's song Freedom Come All Ye last Wednesday in Celtic Park, it was almost unbearably poignant. Here was the greatest of all protest songs - a song which casts Scots as both victims and agents of imperialism and holds out the hope of all races uniting to overthrow it - being sung with aching beauty by a woman still able to remember the last desperate days of the apartheid regime.

For Matshikiza, opera has provided an escape route from the South African townships where she spent her childhood. One of those townships, Nyanga, is mentioned in Henderson's song.

That internationalism was again to the fore in the ceremony's keynote Unicef fundraising moment, when the millions of people watching all over the world were asked to join those in the stadium in texting a £5 donation to help the charity's work with the children of the Commonwealth.

The sight of thousands of mobile phones lighting up at the same time all over Celtic Park will long live with me, particularly after the Sunday Herald and Herald's own role in highlighting Unicef's work through eyewitness reports from key locations on the Queen's Baton Relay through the Commonwealth to Glasgow.

Scotland's past involvement with many Commonwealth countries does not cover us with glory. It was not a random coincidence that the Jamaican girl chosen to bring the Queen's Baton into Celtic Park was called Jennica Stirling, a Scottish name and a painful reminder of the legacy of Scottish slavemasters in the Caribbean.

So much history, so much to be ashamed and proud of: the banal and the beautiful (and what could be more beautiful than Nicola Benedetti's performance of The Bonnie Banks o' Loch Lomond?) sharing a stage. So many issues in one three-hour event. But one issue, of course, was never mentioned. The Games must not be politicised, and so the referendum was banished. And yet it hung over the stadium, like a big question mark.

The organisers of the event pretty successfully avoided any statement which could be easily interpreted as a hint of intentional support either for the continuation of the Union or for independence. But in Scotland everything is viewed through the prism of the referendum. How could it be otherwise?

When the English athletes marched into the arena, the crowd roared themselves hoarse - confounding idiotic predictions that they would be booed. Effectively, the crowd were saying: "We do not hate you … and don't believe anyone who tells you that we do." Because the referendum is about many things, but hate should not be one of them.

The very fact that the Games are being staged in Glasgow is itself testament to that. The Commonwealth bid was started by former Labour first minister Jack McConnell, and successfully taken up by Alex Salmond. The team which put together the successful bid included people now working for or linked to both the Better Together and Yes camps.

Scotland is a small country, and we know that people of different political opinions have to pull together to achieve great ambitions. We know from personal experience that political disagreements, even over an issue as profoundly important and divisive as independence, do not need to spill over into personal animosity. That's worth remembering the next time anyone tries to portray Scotland as a country bitterly divided into hateful and warring camps instead of a nation engaged in a democratic process.

But, of course, the Games should not be politicised, even if one side gets to define exactly what that means. Prime Minister David Cameron visits Scotland to once again argue the case for the Union, Chancellor George Osborne attends a Commonwealth Business Conference to announce more than £18 million for various Scottish projects. The Defence Secretary vetoes a perfectly harmless suggestion that the Red Arrows trail blue-and-white ceremonial colours rather than the Union Jack's red, blue and white. But, of course, none of that is related to the referendum and if you suggest otherwise you are politicising the Games.

You might ask why, if it is perfectly possible for independent countries to come together in what was continually described last Wednesday as a warm and supportive family, Scotland has been warned not to expect a similar relationship if it votes for independence because it would then be "foreign". But God forbid you should try to politicise the Games.

For many of us, the opening ceremony needed no overt messages to make the case for Scottish independence. The truths it captured in its portrayal of the country we have become did that job all by themselves.

A country which has made mistakes in its past, just like any other country.

A country which is shaking off its cringe to realise its contribution to global culture is vast and profound.

A country never more confident in its abilities to weather whatever storms lie ahead; to take the important decisions, some of which will go well and some of which will not. Just like any other country.

A country which is better than some, certainly as good as any other.

The most important audience for the, albeit unintended, message of the opening ceremony was not the millions watching abroad, who may flock to a hot tourist destination and whose money will prove a welcome boost for our economy.

The most important audience was you. You don't need to view it as anything other than sheer exhuberant entertainment. It was that ... and that's fine.

But this is what I believe it told you: ''Look at who we are. Look at what we have done. Think what more we could achieve.''