Comments (5)
Hello,
Yeah, I need to update the examples. I’m having a look at your example. Thanks for reaching out.
from luminance-rs.
Ok, so the problem comes in because of two configurations:
const TRIANGLE_VERTS: [Vertex; 3] = [
([-0.5, -0.5], [0.8, 0.5, 0.5]), // red bottom leftmost
([-0., 0.5], [0.5, 0.8, 0.5]), // green top
([0.5, -0.5], [0.5, 0.5, 0.8]) // blue bottom rightmost
];
This geometry is defined via CW spelling.
let rdr_state = RenderState::default();
This enables CCW culling. So, what it means is that your triangle won’t show up because it’ll get culled (it’s facing backwards). You can fix that by either disabling culling:
let rdr_state = RenderState::default().set_face_culling(None);
… or by telling to cull on CW direction:
let rdr_state = RenderState::default().set_face_culling(FaceCulling::new(FaceCullingOrder::CW, FaceCullingMode::Back));
Or by leaving it the way it is but specifying your geometry in CCW direction:
let rdr_state = RenderState::default().set_face_culling(FaceCulling::new(FaceCullingOrder::CW, FaceCullingMode::Back));
from luminance-rs.
On a more general note, what do you think should be the best here as default? CCW is very common among 3D tools (Blender, Maya, ZBrush, 3DS Max, etc.), but it can get confusing if you define your geometry in CW as you did – you might think of a bug while it’s not, it’s just a default configuration.
Note: I don’t like defaults, even though they are handy. I might set the default to no culling… should I?
from luminance-rs.
I don't really have much of a preference on culling order.
The triangle is displayed now, though, thanks.
from luminance-rs.
Happy you work it out. Thanks again for reaching out. I shall close this issue then.
from luminance-rs.
Related Issues (20)
- What's the replacement for new_texture_no_texels? HOT 5
- Texture swizzling HOT 1
- Decouple vertex semantics from representation HOT 4
- Intermixing of Tess's with different structures HOT 1
- `Vertex` derive macro obstructs use of the inherent method name `new`
- Placeholder `#repr_ty_name` in derived attribute wrapper type documentation HOT 2
- Incorrect(?) warning when a shader uses a subset of attributes declared in semantics HOT 1
- [luminance-glutin] How to make use of glutin:WindowedContext HOT 3
- luminance-glutin doesn't resize correctly under Wayland
- Depth-only framebuffer causes generated binding code to error?
- Web examples instructions incomplete HOT 1
- Instanced rendering using instance attributes? HOT 1
- Learn luminance book is very out of date HOT 2
- Why GL_ARB_separate_shader_objects? HOT 1
- Pure OpenGL ES renderer? HOT 1
- luminance 0.46.1 needs unpublished luminance-derive HOT 1
- Luminance 0.47 isn't on crates.io HOT 1
- Clearing textures
- Segmentation fault when dropping shader program struct HOT 3
- Fields of Vertex struct being reordered on new rust version results in incorrect render HOT 2
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 luminance-rs.