OpenCV 2.2 window causes problem on OpenGL (Bug #1147)


Added by Rudra Poudel over 13 years ago. Updated over 9 years ago.


Status:Open Start date:
Priority:Low Due date:
Assignee:- % Done:

0%

Category:highgui-gui
Target version:-
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:

Description

Here is very simple code .. Only thing is I repeated same code manytimes for detail debug. Detail info: OpenGL version 3.3.0, Window 7 OS and VS2008, OpenCV 2.2.0.

 1//*********************************************
 2RenderObject();
 3//glPushClientAttrib(GL_CLIENT_ALL_ATTRIB_BITS);
 4Mat image;
 5image.create(screenHeight,screenWidth, CV_8UC3);
 6glReadPixels(0, 0, screenWidth, screenHeight, GL_BGR, GL_UNSIGNED_BYTE, (uchar*)image.data);
 7int error_code1 = glGetError();  // Error Code: 0, NO Error, Also output is good/as expected!
 8glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
 9int error_code8 = glGetError();  // Error Code: 0, NO Error
10//flip(image, image, 0);
11//glPopClientAttrib();
12const char *title = "glReadPixels Output";
13cv::namedWindow(title);  
14int error_code2 = glGetError();  // Error Code: 1282, GL_INVALID_OPERATION
15imshow(title, image);
16int error_code3 = glGetError();  // Error Code: 1282, GL_INVALID_OPERATION
17waitKey(5000);
18int error_code4 = glGetError();  // Error Code: 0, NO Error
19destroyWindow(title);
20int error_code5 = glGetError();  // Error Code: 1282, GL_INVALID_OPERATION
21image.release();
22
23int error_code6 = glGetError();  // Error Code: 1282, GL_INVALID_OPERATION
24
25glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboId);
26glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
27glReadBuffer(GL_COLOR_ATTACHMENT0_EXT);
28
29int error_code7 = glGetError();  // Error Code: 1282, GL_INVALID_OPERATION
30//*********************************************

Something going on here under-the-hood. What is that? ... well at least error_code7 should be 0 (i.e. no error) even if OpenCV window is taking over the default buffer. I tested code with framebuffer object as well as default glut hidden window. Also let me tell you that I must use framebuffer object for my purpose. So, cannt use same default window to draw and show.


OpenCV_2.2_window_causes_problem_on_OpenGL.cpp - Source code of 'OpenCV 2.2 window causes problem on OpenGL', written on VS2008. however, there is nothing OS depedent except include file (3.4 kB) Rudra Poudel, 2011-06-17 09:27 pm


Associated revisions

Revision 7eddf887
Added by Roman Donchenko over 11 years ago

Merge pull request #1147 from jet47:gpu-sanity-test-name

History

Updated by Rudra Poudel over 13 years ago

When OpenCV was built using 'WITH_QT_OPENGL', above problem occures.

Solutions:

1. Build OpenCV without 'WITH_QT_OPENGL' option. It will completely removes all errors.
2. Or to work around- Re-attach the draw buffer (i.e. glDrawBuffer only with default buffer object or with framebuffer object (FBO) both FBO and texture/render buffer, you could valid this using 'glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);' )

|However, in my view there should be better solution in code/library level!

Updated by Vadim Pisarevsky over 13 years ago

since the problem is easily avoided by setting WITH_QT_OPENGL=Off, priority of the bug is lowered

  • Status deleted (Open)

Updated by Alexander Shishkov about 13 years ago

  • Description changed from Here is very simple code .. Only thing is I repeated same code manytimes for ... to Here is very simple code .. Only thing is I repeated same code manytimes for ... More

Updated by Alexander Shishkov about 13 years ago

  • Description changed from Here is very simple code .. Only thing is I repeated same code manytimes for ... to Here is very simple code .. Only thing is I repeated same code manytimes for ... More

Updated by Alexander Shishkov almost 13 years ago

  • Priority changed from Normal to Low
  • Target version deleted ()

Updated by Alexander Shishkov almost 13 years ago

  • Status set to Open

Updated by Andrey Kamaev almost 13 years ago

  • Description changed from Here is very simple code .. Only thing is I repeated same code manytimes for ... to Here is very simple code .. Only thing is I repeated same code manytimes for ... More

Updated by Alexander Shishkov almost 13 years ago

  • Assignee deleted (Vadim Pisarevsky)

Updated by Alexander Shishkov almost 13 years ago

  • Target version deleted ()

Updated by Andrey Kamaev over 12 years ago

  • Category changed from highgui-images to highgui-gui

Updated by Maksim Shabunin over 9 years ago

Issue has been transferred to GitHub: https://github.com/Itseez/opencv/issues/4280

Also available in: Atom PDF