2
votes
2answers
85 views
+150

xy position at a certain z depth

In processing (java dialect) there are the methods screenX, screenY (and screenZ but we skip that for now). Let's say i have a object at xyz = 50, 100, 500. Then with screenX and screenY you can now ...
2
votes
1answer
43 views

Why is it legal to reverse the vector-matrix mult order in a shader?

While the graphical output is completely messed up when I do this, I tried it out of curiousity. I was expecting it to crash due to illegal math operation: // ...
0
votes
1answer
38 views

Using row-major in OpenGL shader

I saw this on the OpenGL site: OpenGL Shading Language attribute variables are allowed to be of type mat2, mat3, or mat4. Attributes of these types may be loaded using the glVertexAttrib entry ...
1
vote
1answer
74 views

Projection of 3D Coordinates onto a 2D image with known points

I'm writing a .NET program that allows a user to register an image by identifying specific points on an image and then specifying the real world coordinates associated with each of those points. ...
0
votes
0answers
49 views

Calculate percentage of a fragments depth position relative to a range

In my fragment/pixel shader I am trying to calculate a fragment's depth position in percent [0-1] in an given range. What I have is a bunch of shapes (there is no relative data given from them) but ...
1
vote
1answer
70 views

How to move the position of a calculated circle?

The situation I currently have a working method that correctly calculates the circumference. each position within the circumference, is stored within an array of structs. My camera position moves ...
0
votes
2answers
46 views

Get the bounds of the plane visible at a specific z coordinate

Using OpenTK, I've created a window (800x600) with a vertical FOV of 90°. I want to make a 2D game with a background image that fits on the whole screen. What I want is the plane at a variable z ...
-1
votes
1answer
94 views

Adjusting glRotate, using dot product

Introducing: I'm developing a little Tower defense game in opengl, currently I'm just despairing of a little problem.... I want the projectiles from the tower to aim with the head facing the unit. So ...
0
votes
1answer
46 views

Projecting Screen Coordinates onto a World-Coordinate axis-ray

I am trying to make a world-axis-aligned translation gizmo to convert movement by the mouse into axis-constrained world-movement. My plan was to find the end-points of the axis-ray as bounded by the ...
1
vote
1answer
41 views

Tangents on a flat surface [duplicate]

Currently I am trying to do some bump mapping but would like to know how to find the tangents of a flat surface. I have already defined my normals but not sure about tangents, I have drawn a diagram ...
-2
votes
2answers
288 views

Modelling the solar system in openGL [closed]

I'm looking to mode the solar system within c++ and openGL, and I was wondering if there was a cheap method that I could produce that would return an x,y,z vector that I could use to update the ...
1
vote
2answers
246 views

OpenGL circle drawing getting an ellipse

I'm trying to draw a circle in opengl, but i can't seem to get the right coordinates, so i always get an ellipsis no matter what method i use. The current code is as follows: void Ball::Render() { ...
0
votes
2answers
165 views

Rotate quaternion on all 3 axis from axis angle in GLM

I use quaternions for rotations in OpenGL engine.Currently , in order to create rotation matrix for x ,y and z rotations I create a quaternion per axis rotation.Then I multiply these to get the final ...
0
votes
1answer
50 views

Spot light cone direction rotation and orientation inversion

I am working on Spot light transformation system in OpenGL.As it is known ,Spot light has by default position and cone direction.But in my implementation it also has to have rotation and ...
1
vote
1answer
61 views

how to translate 3d mesh, given a view direction and a change in cursor position

My question is similar to 3D Scene Panning in perspective projection (OpenGL) except I don't know how to compute the direction in which to move the mesh. I have a program in which various meshes can ...
2
votes
1answer
99 views

GLSL | Billboard shader, keep the scaling

I have searched the internet for tutorials, implementations and help. Nothing. The only thing I can find is billboard shader implementations that set the upper-left 3x3 matrix of a mat4 to identity. ...
0
votes
2answers
72 views

How to compute normals for a segment line in 3D

I have exported some hair particules from Blender (a hairstyle). These are composed of several lines (GL_LINES). My openGL program displays these particules without any problem. Now I just want to ...
0
votes
2answers
55 views

java calculating with floats and doubles

I have problem with java maths. I have following expression: double tripp = (timeNow-previousTime)/(seconds*Sys.getTimerResolution())*trip; Where I am trying to calculate rotating speed of my cube. ...
0
votes
1answer
174 views

How can I get view direction from the OpenGL ModelView Matrix?

I am writing a volume render program that constantly adjusts some plane geometry so it always faces the camera. The plane geometry rotates whenever the camera rotates in order to appear as if it ...
3
votes
1answer
185 views

In a TBN Matrix are the normal, tangent, and bitangent vectors always perpendicular?

This is related to a problem described in another question (images there): Opengl shader problems - weird light reflection artifacts I have a .obj importer that creates a data structure and ...
0
votes
1answer
123 views

rotate 3d model around absolute axes

I can't figure out how to convert mouse drag into rotation around Ox and Oy of the image plane. I followed the first answer from here and I'm storing the modelView matrix in an array, and updating it ...
0
votes
1answer
50 views

How to “undo” rotation to get proper scaling?

I'm trying to calculate the zoom percentage from a projection matrix. The following code works as long as the image isn't rotated: void UpdateZoomPercent() { var zoom = _projMatrix.M11 * ...
3
votes
3answers
198 views

Translating Camera Matrix in OpenGL

So until recently I have been transforming my OpenGL objects like this (Rotation_Matrix is GLfloat[16], I get it from a quaternion that stores the object's orientation, works well): ...
0
votes
1answer
132 views

OpenGL - Object local rotation

I am trying to make something like - lets call it flight simulator using modern OpenGL. I am trying to use yaw, pitch and roll to rotate my plane object. But it seems object rotates around global ...
1
vote
2answers
236 views

Code for n-sided prism in OpenGL

is there any code to calculate and draw an n-sided prism in OpenGL? It should work like void DrawPrism(long sides) { glNormal3f( ...); glTexCoord2f(..); glVertex3f(...); [...] } DrawPrism(5) ...
6
votes
1answer
107 views

Rotating a Camera to a Point

I'm making a game that uses an entire planet for its map. I've tessellated the spherical planet using this technique, and am now adding in camera controls. The sphere is of dimensions 1 to -1, so ...
0
votes
2answers
114 views

rotate plane so its normal is the same direction as another plane's normal

My problem is that I have a surface in world space (three 3D points) that I want to rotate so that the resulting normal of those three points will be the same as another plane's normal, while ...
0
votes
1answer
181 views

Projection theory? (Implimented in GLSL)

OpenGL 3.x, because I dont want to be to far behind in tech. First of all, yes I know it's a lot. I am almost certain that the vec3 transform(vec3) function is fine, If nothing else I know that it ...
0
votes
1answer
93 views

How to add variability to my 3d curve - spherical coords in openGL / C++

Using spherical coordinates, I am drawing an arc around the surface of a sphere. Here is my code: int goose1a_egg1_step = 0; // THIS IS INCREMENTED EACH FRAME float goose1a_egg1_theta=7.5; // ...
1
vote
1answer
127 views

How can I generate this simple repeating texture efficiently inside a GLSL shader?

I have this sub-pixel texture which is normally 8x8 in size (enlarged version here: http://i.imgur.com/w697DMO.png) and I need to be able to generate this texture within GLSL, without actually using ...
0
votes
1answer
58 views

Entity look at for cameras and objects

I'm currently extending my 3D-engine for a better entity system which includes cameras. This allows me to put cameras into parent entities which may also be in another entity ( and so on... ). ...
-1
votes
2answers
160 views

Difference between vectors,vertex and faces? [closed]

I always find this difficult to understand as it seems all very theoretical. glVertex(0.0f,0.0f,0.0f); glVertex(0.0f,0.0f,-1.0f); glVertex(-1.0f,0.0f,-1.0f); glVertex(-1.0f,0.0f,0.0f); that's one ...
2
votes
1answer
317 views

3D object is rotating along all three axes when only X-Y rotation is desired

So I am implementing rotations for my 3D objects in an OpenGL scene, and so far the basic rotations themselves (using quaternions) work fine. I have also mostly solved the "look-at" problem, such ...
1
vote
2answers
67 views

my satellite circumnavigates, but along a non-circular path (correcting spherical coord math)

This is how I position my torus (satellite) upon a sphere, and then rotate it around the sphere: int satellite_1_1_step = 0; int &r_satellite_1_1_step = satellite_1_1_step; float ...
0
votes
1answer
84 views

GLSL 330 Matrix-Computation Error {No compile error}

Edit: Alright got it now :D Problem: Completly forgot glm uses colum-major matrices. Just had to change GL_TRUE, to GL_FALSE and everything is alright. I try to compute my ModelMatrix with my ...
1
vote
1answer
146 views

OpenGL camera parenting

I have a camera object in my OpenGL renderer. It works fine. However I need to parent it to a parent node so that the parent can manipulate camera as it is done in Adobe AfterEffects with Null Object. ...
1
vote
1answer
94 views

How to calculate Rayintersection 3D for Picking

Im struggeling to implement a Function which basically tells me, if a Ray "gets close enough" to an object Basically I implemented Implementing Ray Picking @nornagon soloution to create the Ray. My ...
1
vote
2answers
67 views

Finding vectors

Given a vector V = (x, y, z), how do i find 2 vector that make up an axis with V ? In other words, one of them is perpendicular and lies in the same plane, and the other is normal to those two ...
0
votes
1answer
276 views

OpenGL FPS Camera movement relative to lookAt target

I have a camera in OpenGL.I had no problem with it until adding FPS controller.The problem is that the basic FPS behavior is ok. The camera moves forward,backward,left and right+ rotates towards the ...
0
votes
1answer
120 views

Where is the triangle normal pointing so I can map correctly?

Here is what I have so far. I have a 3D model and I made a triangle mesh. Calculated and applied normals to the model too. I want to apply different textures into the triangle. I also have the ...
0
votes
1answer
109 views

Mapping transformation from one coordinate space to another

I have two 4x4 transformation matrices that define two coordinate spaces. I am trying to express a translate transformation in one coordinate space in terms of the other. Can anyone point me in the ...
-3
votes
1answer
135 views

How to compute center of an arbitrary shape in 3D? [closed]

I want to know the accurate method to find the center of an arbitrary shape in 3D. In the figure, I have explained 3 cases. In first case how can we compute the center of arbitrary points ? One idea ...
0
votes
1answer
204 views

rotating one object according to point

O position 2 O Y object ( x,y,z ) position 1 I want rotate object according to fix point (x,y,z) with Q ...
0
votes
0answers
74 views

Uniform sampling of 2D path draped on a set of 3D data points

Imagine you have a grid of sample points of a function z = f(x, y) where 1 < x < N and 1 < y < N. The formula is not given, but just the raw data, that could be for example the grey level ...
0
votes
3answers
255 views

Orthographic projection with origin at screen bottom left

I'm using the python OpenGL bindings, and trying to only use modern opengl calls. I have a VBO with verticies, and I am trying to render with an orthographic projection matrix passed to the vertex ...
0
votes
2answers
82 views

Camera lookAt target changes when rotating parent node

I have the following issue.I have a camera with lookAt method which works fine.I have a parent node to which I parent the camera.If I rotate the parent node while keeping the camera lookAt the target ...
-3
votes
3answers
330 views

Why are matrices so important in computer graphics? [closed]

Couldn't you solve things just without them? I'm studing OpenGL and I was wondering why so many projection, model, whatever matrices, and why it was not made just without them.
3
votes
2answers
378 views

OpenGL Matrices VS DirectX Matrices

I have only handled DirectX matrices I have read articles that say you cannot use DirectX matrix math libraries for openGL matrices. but i have also read that if your math is consistent you can get ...
0
votes
4answers
668 views

Rotate a 3D- Point around another one

I have a function in my program which rotates a point (x_p, y_p, z_p) around another point (x_m, y_m,z_m) by the angles w_nx & w_ny. The new coordinates are stored in global Vars x_n, y_n, z_n. ...
3
votes
1answer
117 views

OpenGL Far Plane given very large value clips everything

I found if I define the far plane distance for the perspective matrix to be 1,000,000,000 , then all the object inside that range get clipped. Range of 100,000,000 works fine. Anyone can explain this? ...

1 2 3 4
15 30 50 per page