0

Suppose I open a glfw window with:

glfwOpenWindow(width, height, 8,8,8,8,8,8, GLFW_WINDOW);

Then, I try to read it back with:

glReadPixels(0, 0, width, height, ..1.., ..2..);

I'm not sure what I should be putting in as ..1.. and ..2.. ; I think ..1.. should be GL_RGBA, but no idea for ..2..

Thanks!

George Profenza
  • 50,687
  • 19
  • 144
  • 218
anon
  • 41,035
  • 53
  • 197
  • 293

1 Answers1

1

Don't know if it helps, but I've found this article on GPWiki about glfwOpenWindow and the openGL docs for glReadPixels.

I've played with openGL a bit, but I haven't used these functions. Could you try something basic like:

glfwOpenWindow(width, height, 8,8,8,0,0,0, GLFW_WINDOW);

and

glReadPixels(0, 0, width, height, GL_RGB, GL_FLOAT);

And see if you get the right result or anything close, then incrementally add the details you need, like testing:

glfwOpenWindow(width, height, 8,8,8,8,0,0, GLFW_WINDOW);

then

glReadPixels(0, 0, width, height, GL_RGBA, GL_FLOAT);

and so on.

George Profenza
  • 50,687
  • 19
  • 144
  • 218
  • +1 Why GL_FLOAT? I tried GL_UNSIGNED_BYTE and it worked; but perhaps GL_FLOAT is more efficient. I do not know, please enlighten me. – anon Feb 06 '10 at 09:15
  • I haven't used openGL that much, but I've got used to using float. in theory bytes should be faster. – George Profenza Feb 06 '10 at 11:50