0
\$\begingroup\$

I'm working in java with LWJGL and trying to double all my pixels. I'm trying to draw in an area of 800x450 and then stretch all the frame image to the complete 1600x900 pixels without them getting blured. I can't figure out how to do that in java, everything I find is in c++... A hint would be great!

Thanks a lot.

EDIT : I've tried drawing to a texture created in opengl by setting it to the framebuffer, but I can't find a way to use glGenTextures() in java... so this is not working... also I though about using a shader but I would not be able to draw only in the smaller region...

\$\endgroup\$
  • \$\begingroup\$ oh sorry yeah, I've tried drawing to a texture created in opengl by setting it to the framebuffer, but I can't find a way to use glGenTextures() in java... so this is not working... also I though about using a shader but I would not be able to draw only in the smaller region... \$\endgroup\$ – Philippe Paré Nov 10 '13 at 2:05
  • \$\begingroup\$ unfortunatly I didn't get any of them to work... sorry \$\endgroup\$ – Philippe Paré Nov 12 '13 at 20:51
2
\$\begingroup\$

Try setting the texture filtering (GL_TEXTURE_MIN_FILTER and GL_TEXTURE_MAG_FILTER) to GL_NEAREST

GL_NEAREST_MIPMAP_LINEAR is the default on most platforms, which would explain the blurring you are getting.

this can be done using:

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)

or your platforms equivalent.

\$\endgroup\$
  • \$\begingroup\$ This is the right answer (using FBO), but glTexParameteri should be used over gl"f version for these integer constants, also default mode actually uses mip maps fyi \$\endgroup\$ – MickLH Nov 10 '13 at 7:58
  • \$\begingroup\$ I just did a little googling and you are right, the default is GL_NEAREST_MIPMAP_LINEAR. I thought this was weird though, because to actually get mipmaps you have to call glGenerateMipmap() I'll change my answer accordingly. \$\endgroup\$ – CoffeeandCode Nov 11 '13 at 6:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.