I think initially he was sexually naieve,
Then he very reluctantly realises he could be gay,he is attracted to Jack.In TS2 he goes to Jack.
Then he realises he is in love and gay,as per the alley scene after comming down from the mountain.
He quashes those feelings, but interestingly ,although he conforms by marrying,he,sorry no other way to put this,always takes Alma from behind.He also tells her he would be quite happy to leave her alone if she doesn't want any more kids.
He obviously does not want sex with her, just to have sex.
He may never be happy with the fact that he is gay,but I still think he none the less knows it.That i s what makes it so gut wrenching for me.Sort of in another time, another era, another place,it may all have been different.
The 2 most poignant sentences in the book for me is when they are in the motel,and Ennis says to Jack,"Took me about a year a figure out it was that I shouldn't a let you out a my sights.Too late by then by a long long while"
That is said by a man in love.In love with another man,which I think means gay.
He is trapped by convention ,prejudice,and his own fears, into a life that is untrue to his feelings and sexual inclination.But it does not mean those inclinations do not represent the man.
In much the same way some men are trapped in mens bodies and vice versa.