Thanks for the ideas.
I tried GL_LINEAR and the same sharp artifacts are still there. Also I am sure the heroku samples use GL_NEAREST as GL_LINEAR smooths them out too much.
FBOs are new to me and I cobbled together my code from various samples until it worked. I don't do any swapping from front to back.
My basic structure for rendering is...
The RC is for an offscreen bitmap, not directly on screen
RC := CreateRenderingContext(DC, [opDoubleBuffered,opGDI], 32, 24, 0, 0, 0, 0);
Setup the backbuffer texture and FBO before main loop
glGenTextures(1,@backbuffer); glBindTexture(GL_TEXTURE_2D,backbuffer); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, imwidth, imheight, 0, GL_RGBA,GL_UNSIGNED_BYTE,nil);
glGenFramebuffers(1,@fbo); glBindFramebuffer(GL_FRAMEBUFFER,fbo); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,GL_TEXTURE_2D, backbuffer, 0);
Then within the main loop, pass all the uniforms and then render a fullscreen quad
glviewport(0,0,imwidth,imheight); glBegin(GL_QUADS); glTexCoord2f( 0.0, 0.0 ); glVertex2f( -1, -1); glTexCoord2f( 1.0, 0.0 ); glVertex2f( 1, -1); glTexCoord2f( 1.0, 1.0 ); glVertex2f( 1, 1); glTexCoord2f( 0.0, 1.0 ); glVertex2f( -1, 1); glEnd;
And then read the frame into a graphics32 bitmap.
glGetTexImage(GL_TEXTURE_2D,0,GL_BGRA,GL_UNSIGNED_BYTE,tbm.bits);
And then show the bitmap on the main display form
That's it. Then the loop repeats. I don't do anything with flipping fbos or putting data back into the backbuffer texture.
Any other of the shaders that do not use backbuffer all render perfect without artifacts so I don't think it is due to the card getting overheated.
I don't know what else it could be.
|