As I have understood, it is recommended to use glTranslate / glRotate in favour of glutLootAt. I am not going to seek the reasons beyond the obvious HW vs SW computation mode, but just go with the wave. However, this is giving me some headaches as I…
I'm writing a game which involves cubes. The user can rotate individual cubes, from his perspective, 90deg left, right, up or down.
Naturally as the shape is rotated, the positions of its axes change, so the next rotation might be about a different…
So, I've been trying to rotate a single object in an OpenGL/GLUT environment.
After going through several questions on SO and the like, I've written what appears to be correct code, but no dice. Does anyone know how to make this work?
PS: I've…
I'm programming a simple application in OpenGL. I have a model that I want to rotate around its center (local coordinate), then translate it along with its local coordinate, too. I've done two scenarios,
rotate then translate, and vice versa. In…
Say I have a cube. Say the coordinate values are like this. (1 unit an arm)
GLfloat vertA[3] = { 0.5, 0.5, 0.5};
GLfloat vertB[3] = {-0.5, 0.5, 0.5};
GLfloat vertC[3] = {-0.5,-0.5, 0.5};
GLfloat vertD[3] = { 0.5,-0.5, 0.5};
GLfloat vertE[3] = { 0.5,…
This code must draw two sinus-lines. Here two usual lines are transformed via shader into sinus-lines. I have a task to rotate one of them(for example, for 45 or 90 degrees), how to do it?
void CMyApplication::OnDraw()
{
…
I'm trying to code my custom implementation of Opengl glRotatef(angle,x,y,z) function.
I wrote the rotation matrix, but when I try to use it, the effect is not the same as the original function. Here is my code;
void mglRotate(float angle, float x,…
I want to write a function for rotating an object around its axis contemporaneously with passing the each angle around its x, y and z axis; I read here but I did not understand it completely. for example for rotating around my shape's axis, which…
here's the problem:
my triangle not rotating!
Why? What I've done wrong?
Here's the code:
main.cpp
#include
#include
#include
#include "myobject.h"
using namespace std;
Vector3f position =…
Studying the book OpenGL SuperBible fram Addison-Wesley, I read:
each call to glTranslate is cumulative on the modelview matrix
what does it mean?
Does it mean that for example this code:
glTranslatef(2.0,3.0,0);
glTranslatef(4.0,5.0,0);
first…
I want to move an objecto in OpenGL. I draw the object in (0,0,0), if the object is on that point it rotates fine (using the center of the object as reference to rotate). The problem comes when I move the object, it rotates using the same point as…
I am trying to rotate something on theoretically the y 90 degrees to show the side, and then 45 degrees on the z to put it at an upwards angle. I do so with:
glRotatef(90, 0, 1, 0);
glRotatef(45, 0, 0, 1);
The problem is that it isnt rotating off…
I tried to rotate some vertices using different ways of rotation - GL.Rotate, Matrix4.CreateRotationX and Matrix4.RotateX. To my surprise they gave different outputs.
Here's the function that creates the three matrices and outputs them to the…
I want to show draw a cylinder that starts at point a and that points to I think the key is in the first glRotated, but this is my first time working with openGL
a and b are btVector3
glPushMatrix();
glTranslatef(a.x(), a.y(), a.z());
glRotated(0,…