Hi,
I try to do Environment Mapping (in OpenGL). I have some questions about how it works.
The scenario I think I now how to do is the following:
If I have a simple mirror (for example) I need to calculate the virtual viewers position and render the whole scene from that position to a texture.
The problems I have now are the following:
- How can I compute the projection matrix if I have convex or concave or more complex surfaces, i.e. a surface with waves?
- If I render a cubemap for a whole object, should I render each side separatly or have a projection matrix which has a 360° FOV?
- Can I program this using a recursive approach:
SceneNode::draw(int pass) {
switch (pass) {
case 0:
//activate texture framebuffer
scene.render(pass+1);
//activate standard framebuffer
render();
break;
case 1:
render();
}
}
somewhat of a pseudocode... Would that work with OpenGL?
I hope you can help me clarify my issues and maybe solve them...