gluPerspective(15, (float)320 / (float) 480, 0.1, 40);
When Z is zero how can I calculate the size of a texel?
gluPerspective(15, (float)320 / (float) 480, 0.1, 40);
Quote:Original post by szecs
Um... Why don't you simply set up an orthogonal projection which matches the screen resolution?
Quote:Original post by Headkaze
Now that I have the formula to get the size of a texel in world space all I need to do is convert it to model space. I read that I need to apply the inverse of the model matrix. Is that correct?
static inline SizeF getTexelSize(GLfloat fovy, GLfloat zoom){ GLint viewPort[4]; glGetIntegerv(GL_VIEWPORT, viewPort); GLfloat screenWidth = viewPort[2], screenHeight = viewPort[3]; GLfloat height = tanf((fovy * M_PI / 180.0f) / 2.0f) * zoom * 2.0f; GLfloat width = height * (screenWidth / screenHeight); SizeF texelSize = SizeFMake(width / screenWidth, height / screenHeight); return texelSize;}static inline SizeF getScreenSize(GLfloat fovy, GLfloat zoom){ GLint viewPort[4]; glGetIntegerv(GL_VIEWPORT, viewPort); GLfloat screenWidth = viewPort[2], screenHeight = viewPort[3]; GLfloat height = tanf((fovy * M_PI / 180.0f) / 2.0f) * zoom * 2.0f; GLfloat width = height * (screenWidth / screenHeight); return SizeFMake(width, height);}