Polygon Clipping

Started by
4 comments, last by V-man 15 years, 3 months ago
Hello everyone. I am currently using orthographically projected quads for a 2d game I am making, but I find that whenever the bottom left corner of the quad leaves the viewable area, the rest of the quad does not render at all. What clipping settings would I need to use to prevent this from happening? Thankyou. -Mike.
Advertisement
Quote:Original post by biubidboy
I am currently using orthographically projected quads for a 2d game I am making, but I find that whenever the bottom left corner of the quad leaves the viewable area, the rest of the quad does not render at all. What clipping settings would I need to use to prevent this from happening?
Typically, OpenGL clips across partially visible polygons, rather than removing them entirely. Especially if it only happens with the lower-left corner, are you sure that you are not culling them yourself?

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

I'm not completely sure, because I am new to this stuff, but I can disbale culling and still observe the same results. So I don't think it is culling, at least not that any kind of culling I have enabled.
Maybe you are rendering with glDrawPixels?
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
I use textured quads for sprites and render with glVertex2i.
I have checked out question 10.040 at http://www.opengl.org/resources/faq/technical/clipping.htm. I don't quite understand what this is saying, but could it be related?
No, because you are saying your entire polygon doesn't render.
It is highly likely that your code has a problem. If you want, upload it somewhere and someone will have a look.
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

This topic is closed to new replies.

Advertisement