I am trying to create some simple polygons in openGL3.3. I have 2 types of objects with the following properties :
Object 1 - 10 vertices (listed below, in order) stored in GL_ARRAY_BUFFER
and use GL_TRIANGLE_FAN
v x y z w
v 0.0 0.0 1.0 1.0
v 0.0 1.0 0.1 1.0
v 0.71 0.71 0.1 1.0
v 1.0 0.0 0.1 1.0
v 0.71 -0.71 0.1 1.0
v 0.0 -1.0 0.1 1.0
v -0.71 -0.71 0.1 1.0
v -1.0 0.0 0.1 1.0
v -0.71 0.71 0.1 1.0
v 0.0 1.0 0.1 1.0
Object 2 - 4 vertices (listed below, in order) stored in GL_ARRAY_BUFFER
and use GL_TRIANGLE_STRIP
v x y z w
v 0.0 0.0 0.0 1.0
v 0.0 1.0 0.0 1.0
v 1.0 0.0 0.0 1.0
v 1.0 1.0 0.0 1.0
I load 64 Object1's and 4 Object2's. The Object2's are scaled using glm::scale(20, 20, 0)
.
When I try to render these with GL_CULL_FACE
disabled but GL_DEPTH_TEST
enabled with glDepthFunc(GL_LESS)
everything works fine. As soon as I try to enable GL_CULL_FACE
all I get is a blank window.
Some other useful information :
- Rendering order = 4 Object2's followed by 64 Object1's
- Camera - glm::lookAt(glm::vec3(0.0f, 0.0f, 50.0f), glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f));
- Perspective - glm::perspective(45.0f, 16.0f / 9.0f, 0.01f, 1000.0f);
I have been trying to figure out why GL_CULL_FACE
doesn't work for the past couple of days but have no idea. Any help is much appreciated.