It sounds like you are experiencing very severe constipation, which is unfortunately a common complication of pain medications. The symptoms you are describing of how the constipation is affecting your ability to urinate are common in the more severe cases of constipation.
At this point, I think you must get in to see your primary care doctor
, or go to an emergency room, for immediate evaluation. When constipation gets this severe, it is very unlikely to respond to the sorts of home treatments you might use, such as drinking more water or taking fiber. Also, when constipation starts to affect the ability to urinate, this can be an emergency, since expansion of the bladder with urine that you cannot expell can potentially lead to infections or cause damage to the kidneys.
There are multiple potential treatments that your doctor might employ to treat the constipation, including enemas or other strong medications to break up the stool and relieve the constipation. Also, if you are unable to urinate, they may need to place a urinary catheter up into your bladder to help drain the urine and relieve the pressure.
Get in to see your doctor or go to an emergency room right away!