0

When I specify any absolutely gray material like:

 glAmbientColor [0] = 0.2;
 glAmbientColor [1] = 0.2;
 glAmbientColor [2] = 0.2;
 glAmbientColor [3] = 1;

 glDiffuseColor [0] = 0.8;
 glDiffuseColor [1] = 0.8;
 glDiffuseColor [2] = 0.8;
 glDiffuseColor [3] = 1;

 glSpecularColor [0] = 0.2;
 glSpecularColor [1] = 0.2;
 glSpecularColor [2] = 0.2;
 glSpecularColor [3] = 1;

 glEmissiveColor [0] = 0;
 glEmissiveColor [1] = 0;
 glEmissiveColor [2] = 0;
 glEmissiveColor [3] = 1;

and render an object with:

 glEnable (GL_LIGHTING);

 glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT,   glAmbientColor);
 glMaterialfv (GL_FRONT_AND_BACK, GL_DIFFUSE,   glDiffuseColor);
 glMaterialfv (GL_FRONT_AND_BACK, GL_SPECULAR,  glSpecularColor);
 glMaterialfv (GL_FRONT_AND_BACK, GL_EMISSION,  glEmissiveColor);
 glMaterialf  (GL_FRONT_AND_BACK, GL_SHININESS, 0.2);

to a custom frame buffer the gray material appears to dark, ie. it has a higher contrast. Rendering to the default frame buffer let the material appear normaly. Any other material then absolutely gray are always rendered normaly.

I have no special OpenGL options set. I do always a glEnable (GL_NORMALIZE) on normals.

Do I have to configure my frame buffer a special way? Does anyone have the same proplem with NVidia graphics card and the latest driver (331.89)?

For instance, if I slightly change the diffuseColor like:

glDiffuseColor [0] = 0.8 + 0.0001;

the material is always rendered normaly!

I create the frame buffer as shown below:

    glGenFramebuffers (1, &id);

    // Bind frame buffer.
    glBindFramebuffer (GL_FRAMEBUFFER, id);

    // The color buffer
    glGenRenderbuffers (1, &colorBufferId);
    glBindRenderbuffer (GL_RENDERBUFFER, colorBufferId);
    glRenderbufferStorage (GL_RENDERBUFFER, GL_RGBA8, width, height);
    glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, colorBufferId);

    // The depth buffer
    glGenRenderbuffers (1, &depthBufferId);
    glBindRenderbuffer (GL_RENDERBUFFER, depthBufferId);
    glRenderbufferStorage (GL_RENDERBUFFER, GL_DEPTH_COMPONENT, width, height);
    glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depthBufferId);

1 Answers1

0

I found out by myself, that it has nothing to do with the framebuffer. Everything works fine. The problem first occurs during the post image proccessing, as the image is saved as monochrome PNG and not as RGB png.

It was actually this problem: ImageMagick Reduces Colorspace to Gray

Community
  • 1
  • 1