I want the view of OpenGL to be pixelated.
I have tried using multiple shaders from around the internet, which shows a pixelated image as their outcome. But they work on textures and not in 3D models (Their edges to be pixelated).
And this is a reference of what I am expecting:
Is there any way of accomplishing it with shaders, or with code?
EDIT:
I used glFramebuffer
from Makogan's answer, and it seems to be pixelated.
But another problem is encountered. The Framebuffer seems to be copying itself, which eventually creates a mess.
This code is what I used to create the Framebuffer:
FBO = glGenFramebuffers(1)
DBO = glGenRenderbuffers(1)
glBindRenderbuffer(GL_RENDERBUFFER, DBO)
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, 1280, 720)
glBindFramebuffer(GL_FRAMEBUFFER, FBO)
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, DBO)
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0)
And this piece of code is in the main loop:
# draw everything
glBindFramebuffer(GL_FRAMEBUFFER, 0)
glBlitFramebuffer(
640 - 256,
360 - 144,
640 + 256,
360 + 144,
0,
0,
640,
360,
GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT,
GL_NEAREST
)