Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenGL fbo blitting inconsistent between Intel and Nvidia

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);
like image 366
Jannis Froese Avatar asked Jan 19 '26 05:01

Jannis Froese


1 Answers

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!

like image 98
Ajster1989 Avatar answered Jan 21 '26 22:01

Ajster1989



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!