Search code examples
javajoglantialiasing

stopping anti-aliasing of textures in JOGL


I'm fairly new to JOGL and i was trying to make all of my textures have antialiasing disabled. though for some reason it only works on a texture of the Letter 'S'.

here are all of my classes:

Main: pastebin.com/qxCJKbbE

Room: pastebin.com/mKFSgqBp

MainMenu: pastebin.com/tihb3wAX

RenderHelper: pastebin.com/qfzXqCQY

i.imgur.com/qMRyG0j.png

Also, apparently I'm not allowed to post more than 2 links or pictures without more reputation so i just took away the http:\\ and linked the image.


Solution

  • glTexParameterf only affects the texture that is currently bound. You should set non-changing texture parameters for each texture during loadind/setup.

    For this purpose, you can also use convenient methods of the Texture class, for example:

    C = render.getTexture("E:\\MAndWorks\\resources\\font\\C.png");
    C.setTexParameterf(GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_NEAREST);
    // (note that this also binds the texture behind the scenes)
    

    The reason it worked for the letter "S" is that it is the last texture you render in your render pass, so it is still bound when you set the texture parameter in the next call to display, effectively setting the parameter for the "S" texture.

    Good luck.