16

I am rendering a scene in OpenGL in a low resolution into a framebuffer. Then I intend to draw this version onto the whole screen (upscaled with GL_NEAREST). I do this using texture blitting (glBlitFramebuffer). On my Nvidia GPU this works, but when executing the exact same code on my Intel i7 integrated Graphics, the y-Position on the target framebuffer seems wrong (i.e. the image is rendered too far up).

glGetError returns no error. As the Nvidia driver tends to be very forgiving, I expect that I am missing a minor detail in the OpenGL spec that Nvidia doesn't care about. I searched the internet and stackoverflow and couldn't find a similar problem described. Both drivers report to support OpenGL 3.0

My drawing code:

//setup viewport for small image
glPushAttrib(GL_VIEWPORT_BIT);
glViewport(0, 0, image.getWidth(), image.getHeight());

//bind small framebuffer
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo);
glDrawBuffers(GL_COLOR_ATTACHMENT0);
glClear(GL_COLOR_BUFFER_BIT);

//draw
renderRotatedFull(1);//nothing interesting at all happening here

//reset Viewport
glPopAttrib();

//prepare and execute blitting
glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo);
glReadBuffer(GL_COLOR_ATTACHMENT0);

glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
glDrawBuffers(GL_BACK_LEFT);

glBlitFramebuffer(0, 0, image.getWidth(), image.getHeight(), 0, 0, Game.width,
    Game.height, GL_COLOR_BUFFER_BIT, GL_NEAREST);

glBindFramebuffer(GL_FRAMEBUFFER, 0);

//throws exception if there is an OpenGL error
org.lwjgl.opengl.Util.checkGLError();

Initialisation is done as follows:

fbo =glGenFramebuffers();
glBindFramebuffer(GL_FRAMEBUFFER, fbo);

rbo = glGenRenderbuffers();
glBindRenderbuffer(GL_RENDERBUFFER, rbo);
glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, image.getWidth(), image.getHeight());
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo);

assert(glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE);
Reinstate Monica
  • 2,767
  • 3
  • 31
  • 40
Jannis Froese
  • 1,347
  • 2
  • 10
  • 23
  • 2
    try set image.Width() and image.Height() as square and power of 2 if it helps. (Intel GL drivers are a mess more possible case is your code is all right and intel graphics mess things up on their own). Also check for memory leaks, intel GL drivers are very sensitive to it. – Spektre Sep 05 '13 at 09:46
  • What is Your OS? What is the pixelformat of default fbo here? – sacygan Nov 17 '13 at 16:44
  • 6
    I don't see anything wrong with the code... but it might help if you attach the images of what Intel/NVidia cards produce. – kvark Dec 05 '13 at 20:35
  • The only thing I know is that Intel OpenGL drivers are not in the best shape. – Michael IV Apr 29 '14 at 12:34
  • Not entirely sure, but glPixelStore related? i remember running into a framebuffer related issue on different systems which was relating to glPixelStore, but i'm not sure it was with glBlit. – Siamak M. Mirzaie May 07 '14 at 21:41

1 Answers1

1

This might be a known issue with Intel HD Graphics. Check out this program here - http://www.realtech-vr.com/glview/download.php

This program with tell you what version of OpenGL your video card supports, sometimes Intel HD only supports 1.1 (weird I know!) but sometimes it can say that it supports higher but with errors.

Good Luck!

Ajster1989
  • 197
  • 1
  • 12
  • The intel driver clearly supports the extension, it just does it (slightly) wrong. Random download links are also not helpful for understand the issue. – starmole May 14 '14 at 05:08
  • 1
    You can look at it anyway you want, doing it wrong to me isn't supporting it, I don't care what they say. And that "Random" download link is a tool that tells you what OpenGL your system "Correctly" supports, and if there are any issues with it. Why don't you look at it first next time before giving me negative feedback. – Ajster1989 May 15 '14 at 03:28