Original Post
Hey all, I having real diffculity rendering a plane in opengl. I fully understand that opengl has no basic plane implementation, thus I just want to render a really big square! I have tried to work through the process of doing it myself, but without much luck... Can you see the problem, or help in general? TIA
class Plane : public Object
{
public:
...
protected:
private:
float d;
vector3f normal;
};
...
void Plane::Render()
{
material->glSetMaterial();
vector3f random(0.0f, 1.0f, 0.0f);
vector3f u = vector3f::Cross(normal, random);
vector3f v = vector3f::Cross(normal, u);
vector3f v0 = -normal * d;
vector3f fu = u * 100000.0f;
vector3f fv = v * 100000.0f;
vector3f v1 = v0 - fu - fv;
vector3f v2 = v0 + fu - fv;
vector3f v3 = v0 + fu + fv;
vector3f v4 = v0 - fu + fv;
glBegin(GL_QUADS);
glNormal3f(normal[x], normal[y], normal[z]);
glVertex3f(v1[x], v1[y], v1[z]);
glVertex3f(v2[x], v2[y], v2[z]);
glVertex3f(v3[x], v3[y], v3[z]);
glVertex3f(v4[x], v4[y], v4[z]);
glEnd();
return;
}