Search code examples
openglmodeglreadpixels

glfwOpenWindow and glReadPixels modes?


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!


Solution

  • 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.