Comments (5)
Then I use the perspective function to create a perspective matrix, but still there is nothing.
Matrix4f projection = Matrix4f.perspective(45f, 800f/600f, 0.1f, 100.0f);
from lwjgl3-tutorial.
In OpenGL you have a right-handed coordinate system. Basically if you want to see the object, you have to translate the z-Position in the reverse direction.
Does it work, if you use negative z-Coordinates like this?
vertices.put(-0.6f).put(-0.4f).put(-2.0f).put(1f).put(0f).put(0f);
vertices.put(0.6f).put(-0.4f).put(-2.0f).put(0f).put(1f).put(0f);
vertices.put(0f).put(0.6f).put(-2.0f).put(0f).put(0f).put(1f);
from lwjgl3-tutorial.
no it doesn't works. Finally, I find the reason. For I didn't use any projection matrix in it. It may acquiesce in using orthogonal projection not the perspective projection. So the z axis only contains value from -1 to 1. When you use the perspective projection, you will find you can change the z to -2.
from lwjgl3-tutorial.
With an orthogonal projection you can have any desired z values. When creating the projection matrix you have the Function Matrix4f.orthographic(left, right, bottom, top, near, far)
.
In the tutorial I'm using -1.0f
and 1.0f
for the values near
and far
but you can also change them to -2.0f
and 2.0f
or any other value.
from lwjgl3-tutorial.
Yes, this is right. When using the orthogonal projection, we can change the variation of z axis to any values.
from lwjgl3-tutorial.
Related Issues (13)
- typo (propably?) HOT 1
- Add alpha support for textures HOT 2
- How can you resize a texture? HOT 1
- Vulkan Support HOT 1
- "Rendering" tutorial mysteriously isn't working HOT 2
- is there branch build by maven? HOT 1
- Bug in Renderer.drawTextureRegion() with vertices size HOT 1
- Prepare for the official LWJGL 3.0 release HOT 1
- Remove AWT dependency HOT 1
- Setup wiki page snippet doesn't compile (wrong import) HOT 1
- compiling from windows command line HOT 5
- Is the Text tutorial outdated? 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 lwjgl3-tutorial.