opengl - glfw3 - This draw call is entierly out of view frustrum -
i facing strange issue small opengl 4.4 application.
before begin here basics.
fragment shader
#version 440 out vec4 color; void main(void) { color = vec4(1.0, 0.0, 0.0, 1.0); }
vertex shader
#version 440 layout(location = 0) in vec2 p; void main(void) { gl_position = vec4(p, 0.0, 1.0); }
vbo
gluint vbo; glgenbuffers(1, &vbo); glbindbuffer(gl_array_buffer, vbo); constexpr std::array<glfloat, 12> vertex = { -1.0f, 0.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, -1.0f, 0.0f, -1.0f }; glbufferdata(gl_array_buffer, sizeof(vertex[0]) * vertex.size(), vertex.data(), gl_static_draw);
vao
gluint vao; glgenvertexarrays(1, &vao); glbindvertexarray(vao); glvertexattribpointer(0, 2, gl_float, gl_false, 0, null);
drawing command
glclear(gl_color_buffer_bit); gldrawarrays(gl_triangles, 0, vertex.size());
based on above expecting see red box in lower left hand side of screen.
what have tried
at first thought must issue vertex data , being incorrect on gpu. however, using nsight can confirm vertex data making on gpu correctly.
what has me confused error message getting nsight. draw call out of view frustrum.
this has me confused because passing vertex data in device normalized coordinates. clipping should viewport being set when glfw window created.
it has been while since working opengl. sure 1 small thing overlooked, without errors being reported stuck. appreciated.
thanks
well ladies , gentlemen, suspected. 1 small thing forgot do.
glenablevertexattribarray
i never enabled vertex data.
Comments
Post a Comment