Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Texture fixes #12

Open
axel22 opened this issue Feb 28, 2014 · 3 comments
Open

Texture fixes #12

axel22 opened this issue Feb 28, 2014 · 3 comments

Comments

@axel22
Copy link
Member

axel22 commented Feb 28, 2014

Currently, the idea is to call allocateImageX to allocate the texture:

https://github.com/storm-enroute/macrogl/blob/master/src/main/scala/org/macrogl/Texture.scala#L70

The original idea was to set the texture parameters before allocating the image. The Texture ctor was meant to be used like this to allocate space for the image:

Texture(GL_TEXTURE_2d) { tex =>
  tex.magFilter = GL_NEAREST

  allocateImage2D(0, GL_RGB, 64, 64, 0, GL_UNSIGNED_BYTE)
}

To actually transfer the bytes, there is no support yet!

Here's one way we can go around this:

  1. We need to add a default argument to allocateImageX -- the buffer which is by default null or None. A non-null value would mean that there is data to be transfered.

  2. The allocateImageX called outside the ctor or whenever the texture is not bound should throw an exception.

  3. Another thing I see that we should fix: once bound in the updated method, the Texture is not unbound (returned to previous setting). We should surround the init call in the acquire with the glBindTexture calls to set and reset the bound texture properly:

https://github.com/storm-enroute/macrogl/blob/master/src/main/scala/org/macrogl/Texture.scala#L29

There should be no glBindTexture calls in update.

  1. Setting the texture parameters or calling allocateImageX outside the ctor should throw an exception, unless the texture is bound.
@axel22
Copy link
Member Author

axel22 commented Dec 11, 2014

@storm-enroute-bot

2 similar comments
@axel22
Copy link
Member Author

axel22 commented Dec 11, 2014

@storm-enroute-bot

@axel22
Copy link
Member Author

axel22 commented Dec 22, 2014

@storm-enroute-bot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant