Skip to content

Translucency, better usage of VAOs, Sync objects instead of glFinish(), Rudimentary frustum culling#29

Merged
obiwac merged 10 commits intoobiwac:masterfrom
Jukitsu:master
Dec 14, 2021
Merged

Translucency, better usage of VAOs, Sync objects instead of glFinish(), Rudimentary frustum culling#29
obiwac merged 10 commits intoobiwac:masterfrom
Jukitsu:master

Conversation

@Jukitsu
Copy link
Contributor

@Jukitsu Jukitsu commented Dec 7, 2021

  • Added Translucency
  • Rewrote the pipeline to take better advantage of VAOs
  • Use sync objects instead of glFinish() and use schedule() instead of schedule_interval
  • Add simple frustum culling (its just cull chunks behind me)

@obiwac
Copy link
Owner

obiwac commented Dec 7, 2021

Cool! I won't merge this here as this repo is intended to be sync'd with the tutorial series, but it would be nice to have some place to contribute to a "current" version of this project where stuff I may not even cover at all in the tutorial series can be added.

Two possibilities for this:

  • We create a seperate repo.
  • We create a directory at the root called something like current.

Personally leaning towards the later option. What do you think?

(Also some of your changes have made me realize in hindsight that there are perhaps more pythonic ways of doing certain things, I should probably spend the time going through the code on this repo cleaning stuff up a bit 😉 )

@obiwac obiwac added the enhancement New feature or request label Dec 7, 2021
@Jukitsu
Copy link
Contributor Author

Jukitsu commented Dec 7, 2021

Yeah I agree with the latter option :). It'd be interesting if everyone would be able to contribute to the "current" version too.

gl.glFinish()
self.world.draw()

gl.glClientWaitSync(self.fence, gl.GL_SYNC_FLUSH_COMMANDS_BIT, 16666667)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were you ever able to reproduce #10 and is there a chance that this fixes it? Not in a position to try this out myself...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont really have #10 and this is just an attempt to use sync objects, rn I just pass an arbitrary value, it should behave similar to glFinish()

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What GPU again?


self.vao = gl.GLuint(0)
gl.glGenVertexArrays(1, self.vao)
gl.glGenVertexArrays(1, ctypes.byref(self.vao))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any specific reason for this as opposed to just passing self.vao?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel safer with pointer 🧌


self.ibo = gl.GLuint(0)
gl.glGenBuffers(1, self.ibo)
def __del__(self):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should probably retroactively add this to all episodes for correctness. I didn't bother during the tutorials because it's not technically necessary in this case and it's perhaps slightly confusing to newcomers.

sx = math.floor(clx / subchunk.SUBCHUNK_WIDTH)
sy = math.floor(cly / subchunk.SUBCHUNK_HEIGHT)
sz = math.floor(clz / subchunk.SUBCHUNK_LENGTH)
sx = clx // subchunk.SUBCHUNK_WIDTH
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Silly me
image

# pyglet stuff

pyglet.clock.schedule_interval(self.update, 1.0 / 10000)
pyglet.clock.schedule(self.update)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presumably because of vsync?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, its someone who suggested this as a fix for the flickering, so I added this

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I'll check it has the desired effect.

@obiwac
Copy link
Owner

obiwac commented Dec 7, 2021

Yeah I agree with the latter option :). It'd be interesting if everyone would be able to contribute to the "current" version too.

Alright, it's decided then. I'll add that tomorrow around lunch.

@obiwac
Copy link
Owner

obiwac commented Dec 13, 2021

See commit 2872f8c.
You can move your changes to community now.

@obiwac
Copy link
Owner

obiwac commented Dec 13, 2021

Hmm that's curious, dunno why there's a merge conflict.
I'll look into it when I get home.

@obiwac
Copy link
Owner

obiwac commented Dec 14, 2021

Currently resolving merge conflicts, someone please explain to me why git can't merge this for me 😄
image

@obiwac obiwac merged commit fab02ac into obiwac:master Dec 14, 2021
obiwac added a commit that referenced this pull request Feb 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants