glTexImage2D multiple images

前端 未结 2 410
轮回少年
轮回少年 2021-01-03 06:46

I\'m drawing an image from openCV full screen, this is a large image at 60fps so I needed a faster way than the openCV gui.

Using OpenGL I do:

void p         


        
2条回答
  •  醉酒成梦
    2021-01-03 06:55

    Remember openGL is a state machine - you put it into a state, give it a command and it replays the states later.

    One nice thing about textures is that you can do things outside the paint call - so if in your image processing step you generate image 1 you can load it into the card at that point.

    glBindTexture(GL_TEXTURE_2D,tex_obj[1]);  // select image 1 slot
    glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, width1, height1, 0, GL_RGB, GL_UNSIGNED_BYTE, the_image_data1 ); // load it into the graphics card memory
    

    And then recall it in the paint call

    glBindTexture(GL_TEXTURE_2D,tex_obj[1]); // select pre loaded image 1
    glBegin(GL_QUADS); // draw it
    

提交回复
热议问题