0

I'm trying to change the render mode for selection using glRenderMode, below is the code I use to do this.

 glSelectBuffer(size, buffer);
 int before = glRenderMode(GL_SELECT);
 std::cout << "before:" << before << std::endl;
 GLint mode;
 glGetIntegerv(GL_RENDER_MODE, &mode);i
 std::cout << "mode:" << mode << std::endl;
 std::cout << "gl_select:" << GL_SELECT << std::endl;
 std::cout << "gl_render:" << GL_RENDER << std::endl;

The output is

before: 0
mode:7168
gl_select:7170
gl_render:7168

Which tells me that the mode is not changing, since by default it is in GL_RENDER

edit: changed code to verify it returns 0 before glRenderMode, as per @Axalo comment.

Also I noticed that running glGetError() before the above block of code returns 0

But the following code will give me 1282 error code again

glRenderMode(GL_RENDER);
std::cout << glGetError() << std::endl;

From the docs for glRendMode, possible cause is runnning in between glBegin and glEnd but I do not have a call to glBegin

EDIT opengl picking is depricated in 3.1. I am using opgenl version >3.1 therefore this is not working.

Community
  • 1
  • 1
Sahar Rabinoviz
  • 1,939
  • 2
  • 17
  • 28
  • What does `glGetError()` return? – Axalo Feb 25 '15 at 18:19
  • `glGetError()` returns `1282` – Sahar Rabinoviz Feb 25 '15 at 18:24
  • Make sure it returns 0 **before** `glRenderMode` and 1282 **afterwards**. See [here](https://www.opengl.org/sdk/docs/man2/xhtml/glRenderMode.xml#errors) for more information. – Axalo Feb 25 '15 at 18:42
  • GL_INVALID_OPERATION is generated if glSelectBuffer is called while the render mode is GL_SELECT, or if glRenderMode is called with argument GL_SELECT before glSelectBuffer is called at least once. – Jean-Simon Brochu Feb 25 '15 at 19:35
  • @Jean-SimonBrochu do you know by heart if `GL_INVALID_OPERATION` would also be thrown for cards/drivers/profiles not supporting picking anymore? – t.niese Feb 25 '15 at 22:22
  • A lot of functionalities of OpenGL are deprecated and still supported. This should not be any different. I tested your program and it works fine here. It is possible that your graphic card driver doesn't support this functionality. – Jean-Simon Brochu Feb 26 '15 at 12:51

0 Answers0