I know this is supposed to be a Mac programming forum but I prefer the people on the Mac Rumors forums so I thought I'd try here first!
I have, what I assume is a very simple problem, for which I hope, there is a very simple, staring me in the face solution. Basically I'm drawing a grid of cubes with each cube the same size and at the same z position. The problem is that each cube looks different depending on where in the 3D world it's positioned, e.g. as it gets further to the left you can see more of its right side face than you can when it's in the middle. That's understandable because that's how the REAL world works thanks to the position of the camera and no doubt perspective.
The thing is I want each cube to look the same, i.e. as though it were positioned at (0,0,0). I'm not moving the camera; it's positioned at (0,0,-4) and looking at (0,0,0) and I'm using a perspective projection. I could just use a picture of a cube as a texture and then draw it onto multiple quads but I want to be able to ROTATE certain cubes at random and so need them to remain 3D objects.
At the moment I'm using multiple viewports; rendering each cube to a separate viewport. But changing the viewport 50 times each render pass doesn't *seem* like a very efficient idea. I assume there's a much simpler and elegant solution out there - can someone tell me what it is? No doubt something to do with adjusting the View or Projection matrices each time to take into account the position of the cube?
Any help would be much appreciated!
Cheers
I have, what I assume is a very simple problem, for which I hope, there is a very simple, staring me in the face solution. Basically I'm drawing a grid of cubes with each cube the same size and at the same z position. The problem is that each cube looks different depending on where in the 3D world it's positioned, e.g. as it gets further to the left you can see more of its right side face than you can when it's in the middle. That's understandable because that's how the REAL world works thanks to the position of the camera and no doubt perspective.
The thing is I want each cube to look the same, i.e. as though it were positioned at (0,0,0). I'm not moving the camera; it's positioned at (0,0,-4) and looking at (0,0,0) and I'm using a perspective projection. I could just use a picture of a cube as a texture and then draw it onto multiple quads but I want to be able to ROTATE certain cubes at random and so need them to remain 3D objects.
At the moment I'm using multiple viewports; rendering each cube to a separate viewport. But changing the viewport 50 times each render pass doesn't *seem* like a very efficient idea. I assume there's a much simpler and elegant solution out there - can someone tell me what it is? No doubt something to do with adjusting the View or Projection matrices each time to take into account the position of the cube?
Any help would be much appreciated!
Cheers