oakes / play-clj

A Clojure game library
The Unlicense
940 stars 72 forks source link

Isometric artifacts #59

Open RabidArts opened 9 years ago

RabidArts commented 9 years ago

Firstly, as an intro - thanks for opening the possibilities of live game coding using Clojure - love the idea.

I started off having a look at the diablo style isometric example using nightmod on windows 8 64 bit. It's giving me anomalies on the tile edges - jagged black dots / lines. (example pic : image )

I suspect the answer lies in the answer to this post: https://www.opengl.org/discussion_boards/showthread.php/167808-2D-texture-problem-lines-between-textures

.. where it says to add this after glEnable(GL_TEXTURE2D) ... glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

I would give you a pull request. But unfortunately my Java knowledge is non-existent (I'm an accomplished dot net dev, aspiring to Clojure)

RabidArts commented 9 years ago

Hmm, so after thinking over this some more... this isn't a play-clj issue is it? :/ Still, I'm not sure - so will await feedback :)

oakes commented 9 years ago

Hey, thanks for tracking that down. I noticed the problem but was too lazy to do anything about it. I will see if I can add this somewhere logical in play-clj.

RabidArts commented 9 years ago

Cool, thanks for the response. Not sure if I'll get time, but I'll try to set up java and have a look too :)

oakes commented 9 years ago

I finally got around to trying it out. The code you posted looks like this if you use play-clj's macros:

(gl! :gl-tex-parameterf (gl :gl-texture-2d) (gl :gl-texture-min-filter) (gl :gl-nearest))
(gl! :gl-tex-parameterf (gl :gl-texture-2d) (gl :gl-texture-mag-filter) (gl :gl-nearest))

So far I haven't noticed any difference, but maybe I'm calling it in the wrong place. Do you know where exactly it is supposed to be called? Should it be called once, or every frame?

RabidArts commented 9 years ago

Thanks for looking... I'd have thought it's to be called once off, but my opengl is very rusty.

I can try take a look tomorrow again, just very busy between family dos.

RabidArts commented 9 years ago

I tried finding the right spot to put those lines of code (that you posted) into the play-clj repository, but I'm failing dismally - probably cos I'm being a noob about it.

The short answer is that those lines you posted should be used just after the call to glEnable(GL_TEXTURE_2D) That's called once per texture unit - which should mean only once for us I think.

So I tried grabbing the latest code for play-clj, nightcode and nightmod, and searched for the setup calls to opengl - specifically looking for a gl-enable or glEnable to e.g. GL_TEXTURE_2D.

But couldn't find where that code lies in your repositories .. me fails :S