Display arbitrary 2d image size in opengl

I need to display 2d images in opengl using textures.
Image sizes are not necessarily equal to 2.
I was thinking of creating a larger texture and limiting the display to the part that I used, but the image data will be shared with openCV, so I don’t want to copy pixel data at a time to a larger texture.

EDIT - it turns out that even the simplest Intel on board graphics for Windows supports textures without texture.

EDIT2 - and even if you don’t have arb texture size, if you reduce the image size and scale it to the window size, it will be very fast even at the hardware level of low level

+3
source share
6 answers

We will have to recall a couple of GL extensions. Take a look at GL_ARB_texture_rectangle (if you don't need mipmapping), or GL_ARB_texture_non_power_of_two (if you do).

+2
source

One mistake that should be avoided is that for some reason, some video cards require that GL_UNPACK_ALIGNMENT be set to 1 (glPixelStorei (GL_UNPACK_ALIGNMENT, 1);) to properly load a texture other than two.

+1
source

, - /, OpenGL, , nehe.gamedev, , , , -, , opengl , .

+1

, , . , , .

, ( ) . . , , , . .

0

, , , , , . . 400x300, 512x512, , 400.0/512.0, - 300.0/512.0. , .

0

, , -2 . , , .

0

All Articles