Comments (7)
We'll take this one up as it is important and requires immediate attention.
from gearvrf.
Hi @thomasflynn ,
We have done some implementation as a test for implementing texture enhancement parameters.
The change commit is here(https://github.com/SRIB-GRAPHICS/GearVRf/commit/8f0d6d66add2407247551913dd316ccc84661fc4) on the branch (https://github.com/SRIB-GRAPHICS/GearVRf/tree/texture-enhancement).
Please review the implementation approach so that we can proceed on similar lines.
Referencing other members for reviews. [ @soumyajitdeb @jason2kim ]
from gearvrf.
did a quick skim of the code. some comments:
- I don't see the point of creating enums for GL_LINEAR, GL_NEAREST, etc. Just allow the user to pass in GL_LINEAR, GL_NEAREST, etc. It'll get rid of all the switch() statements as well.
- Is there any way to guarantee that getMaxAnisotropicValue() occurs on the GL thread? We should probably get this value and whether it is supported when we first setup the GL thread and then just return that stored information when it is asked for.
- While the most common use case will be setting the texture parameters at texture creation time, we should also allow changing the texture parameters after the texture is created as well.
from gearvrf.
Hi @thomasflynn ,
We've taken care of the point (2) [https://github.com/SRIB-GRAPHICS/GearVRf/commit/1d8bf33e11360067abcf2eddf49cd47513886caa] & (3) [https://github.com/SRIB-GRAPHICS/GearVRf/commit/b8ac24e69008773f75ed1d2e5c69848f1bbec224] in the latest commit.
For point (1), we think that using enum along with switch is much cleaner as we tried using String for the first time and the code was not so clean once we were trying to pass values to JNI as there we will have to compare in the similar fashion. if you can please suggest some better ways than we will be happy to work on that.
These commits are just for getting the feel of how to proceed, once we are clear, we'll clean the code as per our regualr patters.
Thanks.
from gearvrf.
I did a quick skim and in general I think it's good. I just have a few points:
-
I think it would be better to have separate functions to set filter, wrap mode etc. If one wants to set filtering there's no need to reupload wrap state. This will avoid adding unnecessary driver overhead by issuing redundant api calls.
-
Regarding Tom's comment on enum, if you're making just a wrapper that calls same interface (GL_LINEAR, GL_NEAREST etc) you could pass in directly those values instead of using a switch;
One possible way of doing this is to declare enums in Texture class that maps directly to gl constants. Like follows:
enum TextureMinFilter : int {
LINEAR = GL_LINEAR,
NEAREST = GL_NEAREST,
LINEAR_MIPMAP_LINEAR = GL_LINEAR_MIPMAP_LINEAR
...
};
enum TextureMagFilter : int {
LINEAR = GL_LINEAR,
NEAREST = GL_NEAREST,
};
And now your function can be:
setFiltering(TextureMinFilter min_filter, TextureMagFilter mag_filter) {
min_filter_type_ = min_filter;
mag_filter_type_ = mag_filter;
glBind(...)
glTexParameteri(target_, GL_TEXTURE_MIN_FILTER, (int)min_filter_type_);
glTexParameteri(target_, GL_TEXTURE_MAG_FILTER, (int)mag_filter_type_);
glBind(...)
}
This is good for some reasons. First, it avoid the switch and the calling code doesn't need to include GL headers. Then it makes less error prone (client code won't be able to pass GL_LINEAR_MIPMAP_LINEAR to mag filter by mistake or mess up min/mag filter parameter order. Lastly, the cast from the enum to int will be safe since you declared enum as enum TextureMinFilter : int
- Implementing a solution proposed in item2 also avoids the uncessary conversion from float to int inside your function. Not all compilers/platforms handle float to int conversion smoothly and we should do it with care. More info on: https://software.intel.com/en-us/articles/fast-floating-point-to-integer-conversions
from gearvrf.
Hi @phi-lira ,
Thank you for such an elaborate explanation.
We will surely start with this new suggestion.
Thanks
from gearvrf.
Hi,
We tried the suggested pattern on the Java side and, with some modifications we came to this [https://github.com/SRIB-GRAPHICS/GearVRf/commit/0337010fd7bb54296d3f13eb2aa4b2cf03a652d8] state.
Please give your input.
The conversion of float to int is still not taken care of. We are working on that.
Thanks.
from gearvrf.
Related Issues (20)
- whats the current version for org.gearvrf:framework HOT 1
- Problem with combined Scale and Position animations HOT 4
- WidgetLib gives build failure in framework-tests HOT 3
- Hi, Can we create two GVRActivity inside a app.If I am doing so,getting this exception HOT 1
- Hi, Can we create two GVRActivity inside a app.If I am doing so,getting this exception :.--->E/libEGL: call to OpenGL ES API with no current context (logged once per thread) HOT 5
- Distorted View HOT 7
- Scene Object's position is getting reset on movement of head. HOT 2
- Override GearVR Headset Back Key Press HOT 8
- app crash when adding any android component to SceneObject HOT 4
- SceneObject not visible with GVSphereSceneObject HOT 3
- org.gearvrf:platformsdk_support 4.0.1-SNAPSHOT GVRActivity cast error HOT 2
- Problem with setScale() and collider detection HOT 2
- In Lenovo Daydream devices,sometimes controller is not working. HOT 3
- In Lenovo Daydream devices,controller is getting disconnected sometime. HOT 1
- OculusGO Controller position after camera.resetYaw() HOT 8
- Passing a texture via ID for rendering HOT 3
- Memory leak using GVRViewSceneObject HOT 4
- Integrating Preexistent OpenGL into GVRf Application HOT 5
- Android 9 Frame Rate Slowed Down HOT 3
- OculusGO: JNI DETECTED ERROR IN APPLICATION: JNI GetStaticMethodID called with pending exception java.lang.RuntimeException: android.os.DeadSystemException
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gearvrf.