c++ - glDrawPixels ouputs some pixels with not quite the expected RGB value -


i working on video player windows using opengl. works great, 1 of main goal accuracy. is, image displayed should image saved video.

taking away video/file/input related, have along these lines glutdisplayfunc:

glclear(gl_color_buffer_bit | gl_depth_buffer_bit); glubyte frame[256*128*4]; // width*height*rgba_size (int i=0;i<256*128;i++) {    frame[i*4] = 0x00; // r    frame[i*4+1] = 0xaa; // g    frame[i*4+2] = 0x00; // b    frame[i*4+3] = 0x00; // } glrasterpos2i(0,0); gldrawpixels(256,128,gl_rgba,gl_unsigned_byte,frame); glutswapbuffers(); 

combined code glut..

glutinit(&argc, argv); glutinitdisplaymode(glut_rgb | glut_double | glut_depth); glutinitwindowsize(256, 128); glutcreatewindow("..."); glutdisplayfunc(render); glpixelzoom(1,-1); // use top-to-bottom display glenable(gl_depth_test); glutmainloop(); 

this pretty straightforward , huge simplification of actual code. frame rgb value #00aa00 created , drawn gldrawpixels. expected, output green window. on first glance seems good.

but when use tool such http://instant-eyedropper.com/ know exact rgb value of pixel, realize not of pixels displayed #00aa00. pixels have value of #00a900. case of first pixel in top-left corner, 3rd, 5th , on on same line , every uneven line.

now can't problem instant eyedropper or windows since other programs output right color same file.

now question: possible gldrawpixels somehow changes pixels values, maybe way go faster? expect such function display input in it, i'm not quite sure think of it.

opengl has enabled color dithering default. gpu may perform color dithering reason. try disabling gldisable(gl_dither);. aware of colour management issues.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -