What I got is 2, what I want is 1, how do
Cant tell the difference? I’m assuming the top one is drawn with some graphic program. maybe explain more then.
The image got scaled so it might not be clearly visible if that’s what you mean
However if you are asking how I got the top image, I simply resized the second image down by 2 and then resized it back up
I want to get the pixellation effect of 1
The pixellation effect of 1 would only have been created when you scaled the image around. If you want to achieve a pixelly 3d style you have two options, use AWT to write out a basic 3D environment using Math, or use some kind of shader in OpenGL to make it look pixelly. Im not entirely sure how you would do that, im not that experienced with GLSL
I know what I should be using however I’m not sure how I’ll do that
A nice simple way to get a pixelated effect is using render to texture (using a Frame Buffer Object or PBuffer). Render to a smaller texture size then the window size and then drawing the texture stretched to the window size (using GL_NEAREST filtering). This should give you a pixelated effect. The smaller the texture the larger the pixels will be.
There is an example on how to Render to Texture on the LWJGL wiki here.
kappa you beat me to the punch was a bout to say go for a frame buffer. :-\
It turned out way too good! Almost exactly the same as my mockup
Anyways, here’s the code, I would like to know if I put things in a wrong order or something (the Cube class is simply an utility class for drawing cubes)
btw, there is no need to draw a fullscreen quad, you can easily copy a framebuffers data to another one(which is handy, because you won’t need any shaders for that and probably faster)
requires the framebuffer blit extension
glBindFramebuffer(GL_READ_FRAMEBUFFER, frameBufferID);
glBindFramebuffer(.GL_DRAW_FRAMEBUFFER, 0);//0 is the id of the default framebuffer
glBlitFramebuffer(0, 0, framebufferWidth, framebufferHeight, 0, 0, monitorWidth, monitorHeight, GL_COLOR_BUFFER_BIT, GL_NEAREST);
Ooh! That’s really neat too
Shameful revival, I recently attempted to rewrite the whole thing to make it look neater
However it doesn’t seem to work, did I miss something? I did a completion check on it and it all seemed quite fine
I think you are doing the blitting wrong, because you bind the default framebuffer as read and write buffer (glBindFramebuffer(GL_FRAMEBUFFER, 0))
what you want to do is only change the write buffer. At the programm start bind your fbo as read an write buffer(with GL_FRAMEBUFFER) and then only change the write buffer with GL_DRAW_FRAMEBUFFER
I have no idea how I’m supposed to do that, but I noticed that I didn’t set a depth buffer
Still no luck though
public void renderScaledFBO() {
glViewport(0, 0, S_WIDTH * S_SCALE, S_HEIGHT * S_SCALE);
glBindFramebuffer(GL_READ_FRAMEBUFFER, drawFBO);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
glBlitFramebuffer(0, 0, S_WIDTH, S_HEIGHT, 0, 0, S_WIDTH * S_SCALE,
S_HEIGHT * S_SCALE, GL_COLOR_BUFFER_BIT, GL_NEAREST);
}
Changed the stuff to what you asked but still no luck