opengl - glTexImage2D giving GL_INVALID_VALUE because width or height cannot be represented as 2k + 2 -


i have screenshot taken first opengl canvas need draw in second opengl canvas. have taken screenshot using glreadpixels:

glreadpixels(posx, posy, pagewidth , pageheight, gl_rgb, gl_unsigned_byte, data); 

the first opengl canvas has 2 or more images lines , text data around it. using second opengl canvas show tiling of images surrounding data whole.i not want redraw same in second opengl canvas , hence want take screenshot , draw tiling part of screenshot in second canvas.

i have saved snapshot taken in jpg file coming perfectly.

but problem comes when need draw pixel data using glteximage2d pagewidth or pageheight used cannot represented 2k+ 2. hence error coming gl_invalid_value.

glteximage2d (gl_texture_2d, 0, imgsamplesperpixel),      pagewidth,  pageheight, 0,samplesperpixel, gl_unsigned_byte, data); 

the pagewidth , pageheight can of value (lesser gl_max_texture_size), example 240 x 600. how should solve problem ?


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -