c - OpenGL GL_POINTS result differs from input -


i want draw gl_points after ~totalpoint/3 result starts differ input 1 pixel

i tried different glortho , glviewport arguments nothing changed

my test program:

int w = atoi(argv[1]); int h = atoi(argv[2]);  glmatrixmode(gl_projection); glloadidentity(); glortho(0, w, h, 0, 1.0, -1.0); glmatrixmode(gl_modelview); glenable(gl_texture_2d); glloadidentity();  unsigned int wf,hf; unsigned char rgb[3];  while(!glfwwindowshouldclose(window)){     glclear(gl_color_buffer_bit);     glpointsize(1);     glbegin(gl_points);     for(hf=0;hf<h;hf++){         for(wf=0;wf<w;wf++){             memset(rgb,0,3);             rgb[wf%3]=0xff;             glcolor3ub(rgb[0],rgb[1],rgb[2]);             glvertex2f(wf,hf);         }     }     glend();     glfwswapbuffers(window);     glfwpollevents(); } 

results:

not colored

not colored

colored

colored

michael roy's way solved problem changed line

glfwwindow* wmain = glfwcreatewindow(atoi(argv[1]), atoi(argv[2]), "test", 0, 0); 

to

glfwwindow* wmain = glfwcreatewindow(atoi(argv[1]) + 1, atoi(argv[2]) + 1, "test", 0, 0); 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -