Tagged Questions
2
votes
0answers
52 views
OpenGL Calculate Matrices
Im trying to switch from the glTranslate etc to my own Matrices, but for some reason it does not work. Here are my 2 functions to create the view- and projection matrix:
public Matrix4f ...
2
votes
1answer
63 views
Translating Viewmatrix is inverted, why?
So I've defined a Projectionmatrix, Viewmatrix and a Modelmatrix using OpenGL (LWJGL).
But when I translate my Viewmatrix to +X it moves my object to the right (hence my camera is moving to the ...
1
vote
0answers
78 views
Box2D, OpenGL, resolution and matrix setup
Okay, my internal units are going to be meters, ranging between 0.1 and 10 meters for size.
First of all, my mind is all wrapped up in a knot trying to understand how to handle my game with multiple ...
2
votes
1answer
88 views
Camera not strafing (GLSL)
I use this code in my GLSL vertex shader, where v_position is the vertex position:
gl_Position = v_position * u_camera;
and set u_camera as follows:
meshShader.setUniformMatrix("u_camera",
...
0
votes
1answer
62 views
Box2D OpenGL debug renderer convert box2d coordinates to world space
I made an OpenGL 3.x renderer for Box2D's debug draw (b2Draw base class). Unfortunately I've tried for a while now to convert the box2D units, which are meters to my internal units which are pixels. I ...
-1
votes
3answers
107 views
Directional light and matrix issues
I'm trying to implement basic directional lightning in OpenGL 3.3 by emulating the logic shown in this guide: http://www.arcsynthesis.org/gltut/Illumination/Tutorial%2009.html
I do not understand ...
0
votes
1answer
66 views
Ways to “invert Z-axis” in shader-based core-profile OpenGL?
In my hobbyist shader-based (non-FFP) GL (3.2+ core) "engine", everything in world-space and model-space is by design "left-handed" (and to stay that way), so X-axis goes from -1 ("left") to 1 ...
0
votes
1answer
117 views
Y Axis inverted on vertex output
I've got my project running and somehow it seems my vertex y components are inverted. 10 in the positive on Y goes down and 10 negative on the Y axis goes up.
I can't find anything with the ...
2
votes
2answers
232 views
How should I organize my matrices in a 3D game engine?
I'm working with a group of people from around the world to create a game engine (and hopefully a game with it) within the next upcoming years. My first task is to write a camera class for the engine ...
6
votes
4answers
364 views
How can I generate a view or projection matrix for OpenGL 3.+
I'm transitioning from OpenGL 2 to OpenGL 3.+ and to GLSL 1.5. I'm trying to avoid using the deprecated features.
My question how do we now generate the view or projection matrix. I was using the ...
2
votes
2answers
329 views
The purpose of using invert and transpose
In openGl ES and the World of 3D - why use the invers matrix?
The thing is that I dont have any intuition to, why it is used, therefore please correct me:
As fare as I understand, it is used in ...
1
vote
0answers
142 views
How do I convert my matrix from OpenGL to Marmalade?
I am using a third party rendering API, Marmalade, on top of OpenGL code and I cannot get my matrices correct. One of the API's authors states this:
We're right handed by default, and we treat y ...
2
votes
1answer
2k views
How does gluLookAt work?
From my understanding,
gluLookAt(
eye_x, eye_y, eye_z,
center_x, center_y, center_z,
up_x, up_y, up_z
);
is equivalent to:
glRotatef(B, 0.0, 0.0, 1.0);
...
43
votes
9answers
5k views
Why do we move the world instead of the camera?
I heard that in an OpenGL game what we do to let the player move is not to move the camera but to move the whole world around.
For example here is an extract of this tutorial: OpenGL View matrix
...
0
votes
2answers
451 views
OpenGL, objects disappear at a certain z distance
I'm writing a managed OpenGL library in C++, and I'm having a pretty annoying problem. Whenever I set an objects Z coordinate to -2.0 or lower, the object disappears. And at coordinates 0 through ...
0
votes
1answer
243 views
Correct Rotation and Translation with a 4x4 matrix
I am using a 4x4 matrix to transform verts in a shader. I multiply an identity matrix by a rotation matrix by a translation matrix. I am trying to first rotate the verts and then translate them, ...
0
votes
2answers
771 views
OpenGL matrix vs DirectX matrix
I'm working on an animation and model exporter from Maya to use within my game. Currently, models work perfectly, and animations have some issues with the joints. Since Maya works in an OpenGL ...
-2
votes
1answer
167 views
Why doesn't my MatrixStack class work? [closed]
I've been trying to get openGLES2 to work on my Android device and this is starting to drive me insane. I've spent well over ten hours now trying to get this to work. I just don't understand anymore. ...
2
votes
1answer
301 views
Finding a suitable axis-angle to avoid gimbal lock
In OpenGL the camera faces the -z axis with the +y axis pointing up. I am using quaternions to represent the orientation of my objects (which works well) and am trying to do the same for the camera. I ...
4
votes
1answer
512 views
Multiplication for MVP matrices: Any benefits to doing so within the vertex shader?
I'd like to understand under what circumstances (if any) it is worth doing MVP matrix multiplication inside a vertex shader.
The vertex shader is run once per vertex, and a single mesh typically ...
0
votes
1answer
626 views
Trouble with Collada bones
I have a Collada file with a rigged mesh. I've read the node tags in the library_visual_scenes tag and extracted the matrix for each node and stored everything in a hierarchical bone structure. My ...
4
votes
2answers
824 views
Should the modelview and projection matrices be calculated in the shader or on the CPU?
At minimum I would have a camera with rotation and world position; projections parameters such as angle of view and perspective vs. orthographic; and meshes with scale, angle, and world position.
...
2
votes
1answer
135 views
Rotation going wrong
I'm calculating matrices by hand. Translations are fine:
void Translate (float x, float y, float z, float[4][4] m) {
Identity (m);
m[3][0] = x;
m[3][1] = y;
m[3][2] = z;
}
If ...
0
votes
1answer
130 views
Calculate vertex coordinates
Newbie here!
I need to know the effective coordinates of a triangle after applying transformations (rotations & translations) to the current (MODELVIEW) matrix.
That is, given a vertex P, I ...
4
votes
1answer
222 views
Translation from one coordinate system to another having Z-offset issues
I'm using ARToolkit to do an augmented reality application, but my problem is really with the 3D coordinates.
In this application, I use my webcam to generate the scene. I have two markers (printed ...
3
votes
1answer
1k views
Bones Animation - Matrices and calculations
We are 'on final' when it comes to finishing the project, but just before implementing the animation system.
Our Client decided to choose "Bones Animation" - which is that I should export each ...
5
votes
1answer
800 views
Problem with Assimp 3D model loader
In my game I have model loading functions for Assimp model loading library. I can load the model and render it, but the model displays incorrectly. The models load in as if they were using a seperate ...
2
votes
2answers
366 views
3D Translation using only distance and angles
So I'm starting to foray into 3D game programming, but I've hit something of a snag.
I have an object I want to move around. It should always move either forward or backward relative to its local Z ...
0
votes
3answers
224 views
Project rendering onto a polygon in the scene
I have a function that renders a simple OpenGL scene. I want to display this scene on a polygon within another scene, without the function having to know about it. For example, to display the scene on ...
1
vote
1answer
589 views
Translating local to global coordinates in ARToolkit / OpenGL
Ok, so I've tried reading over the other questions and something's just not clicking for me. I am working on an augmented reality application using ARToolkit, however it should just be straight ...
0
votes
1answer
924 views
matrix 4x4 position data
I understand that a 4x4 matrix holds rotation and position data.
The rotation data is held in the 3x3 sub-matrix at the top left of the matrix.
The position data is held in the last column of the ...
4
votes
2answers
625 views
Ara matrices calculated on the GPU or on the CPU? Would built-in matrix functions be faster than my custom ones?
If I add a math library (for example containing a Matrix class) and use it in my program drawing with OpenGL, will my be work slower than if I used standard OpenGL functions for matrix calculations? ...
1
vote
2answers
2k views
gluLookAt vs glTranslate + glRotate and camera transformation matrices
I'm getting my hands dirty in OpenGL and something is bothering me a bit.
It's my understanding from reading about the subject that a call to gluLookAt basically multiplies a matrix on the stack that ...
6
votes
3answers
1k views
Direct3D and OpenGL Matrix representation
As I read in OpenGL matrices are column major. It means that if I create a 16 element array first four elements are the first column in matrix. Is it the same for Direct3D or any transformation's ...
6
votes
1answer
4k views
Help understanding gluLookAt()
I am fairly new to openGL( 3 months ) and am asking for assistance in understanding the fundamentals behind gluLookAt().
Currently I have spent most of my time with openGL modeling scenes with fixed ...
4
votes
1answer
441 views
Managing Game Entity coordinates
In my Game I'm currently have "Scene Coordinates" which are the X,Y coordinates relative to a Game Scene.
In that Scene there are Game Entities, let's say there's a GameEntity A in x=100.0, y=100.0 ( ...
2
votes
1answer
226 views
Why doesn't the y Axis work with SuperBible frame reference or GluLookAt
I'm currently trying to understand how to use the GLFrame Class in the superbible book, and acording to the 4th edition of the book, the camera matrix derived from the Frame of reference class should ...
1
vote
2answers
359 views
opengl rotations for a human
I currently can rotate around a pivot point by first translating to the pivot point then performing the rotation and finally translating back to the origin. I do that easily enough for the shoulder in ...
3
votes
1answer
2k views
How to create a perspective field of view matrix?
Hey, hello. I am learning a little of WebGL (OpenGL ES 2.0) through the http://learningwebgl.com tutorials, but it uses a third party library to create the View, Projection and transformation matrices ...
4
votes
1answer
215 views
Projecting onto different size screens by cropping
I am building a phone application which will display a shape on screen. The shape should look the same on different screen sizes. I Decided the best way to do this is to show more of the background on ...
1
vote
1answer
916 views
Restoring projection matrix
I am learning to use FBOs and one of the things that I need to do when rendering something onto user defined FBO, I have to setup the projection, modelview and viewport for it. Once I am done ...
4
votes
2answers
4k views
View matrix in opengl
Sorry for my clumsy question.
But I don't know where I am wrong at creating view matrix.
I have the following code:
createMatrix(vec4f(xAxis.x, xAxis.y, xAxis.z, dot(xAxis,eye)),
vec4f( ...
