OpenGL fbo blitting inconsistent between Intel and Nvidia
Asked Answered
B

1

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);
Buffy answered 22/1, 2013 at 22:54 Comment(5)
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.Strachey
What is Your OS? What is the pixelformat of default fbo here?Tsosie
I don't see anything wrong with the code... but it might help if you attach the images of what Intel/NVidia cards produce.Choiseul
The only thing I know is that Intel OpenGL drivers are not in the best shape.Hadley
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.Lederman
M
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!

Macedoine answered 8/5, 2014 at 4:46 Comment(2)
The intel driver clearly supports the extension, it just does it (slightly) wrong. Random download links are also not helpful for understand the issue.Benevolent
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.Macedoine

© 2022 - 2024 — McMap. All rights reserved.