In the walk through for blackberry 10 sdk using opengl es. it uses 2 commands namely:

glMatrixMode(GL_PROJECTION);
glLoadIdentity();

and later:

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

I don't understand what these are used for when initializing the viewport. If I take those lines out the program still runs perfectly and nothing changes.

I see its got to do with rendering the matrix but i'm not sure I understand which matrix as this is only when im initializing before any sort of rendering.

有帮助吗?

解决方案

Called in an initialization routine, those do nothing. The default value of both matrices is identity, so it's just setting it to the same value that they already are.

As to why it is there, I guess that some people just like to explicitly setup their context so they know for sure what the current value is, maybe it's easier to remember or they don't trust the context to have the right default value, I don't know.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top