problem about the glTexImage2D

my opengl version is 2.0.
i want to render a scene into a win32 dibsection and there is a RGBA texture whose size is 256*170 , when i set the 32bits image as a texture using the glTexImage2D, it reports 1282 error code,but when i change the bitmap to windows ,it works well.who can tell me how to upload an non-pow-of-2 image as a texture when rendering into a bitmap

Problem is that “win32 dibsection” does not use hardware acceleration, only old software GL.
See the wiki page on FBO for modern render to texture.

thanks for reply , but there is still a problem
here is my procedure about using fbo for the offscreen rendering:
1 create fbo in initialization stage
2 switch framebuffer to my new fbo
3 rendering scene
4 readpixel from fbo to the dibsection

but i find that in the every time between two frames ,the client area of windows show some rubbish content in a short time , is there any approach can avoid this dirty flash? thanks

thanks the above problem has been resolved, this is caused by a swapbuffer call