• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Archived

This topic is now archived and is closed to further replies.

Nexus

Help with glRotated(Angle,x,y,z);

6 posts in this topic

I only gave the 90 degree rotation as an example. The effect turns up at any nonzero rotation. I can't believe that they would list this as an example in the OpenGL Programming Guide and have it flat out not work correctly....that's why I was really hoping it was just something I was forgetting to do.

Here's a better description of the behavior:
//setup
glEnable(GL_DEPTH_TEST);
glMatrixMode(GL_MODELVIEW);
//more setup
loop {
glLoadIdentity();
gluPerspective(90,1.25,.5,20.0);
//respond to kb
// clamp angles between 0 and 359
glRotated(pitch,1,0,0);
glRotated(yaw, 0,1,0);
glRotated(roll, 0,0,1);
glTranslated(-xEye,-yEye,-zEye);
//draw simple cubes
glFlush();
SwapBuffers( hDC );
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}

That is the basic layout of my code. nothing fancy at all.

the behavior is as follows:
pitch & roll interact well. (except for some weirdness when I pitch 180 degrees over, roll seems to invert behavior.)
pitch and yaw do not.
yaw seems to ignore pitch completely - if I pitch *any* angle yaw still acts like I'm facing straight down the z axis.

Is that gimbal lock? From the article it seemed that they were specifically talking about 90 degree rotation problems. Mine behaves like this all the time. It's basically behaves like quake rotation when I want descent.

Thanks,
Nex

0

Share this post


Link to post
Share on other sites
It isn't a gimble lock, this is something that confused the hell out of me at first. The problem is that for some reason, OpenGL does the transformations in the reverse order that you specify them. Move that translate to above your rotates, and it should work fine.

Jonathan

0

Share this post


Link to post
Share on other sites
They need an icon of a smiley ripping hair out of it's head.

Thanks for the input but that didn't do it either.
I think the problem resides in this:
(after much 1 eye closed hand yawing and pitching)
The order of the yaw/pitch is important as well...but whichever I choose (I'm scaling out the roll for now.) I'm incorrect.

If I pitch then yaw then I get proper behavior if thats the way the person moves the camera (look up and turn left/right for extreme example)

If I yaw then pitch then I get improper behavior if the user pitches then yaws the camera (turn 90 left or right and then yaw up/down for extreme example - looks like rotate) but this behaves properly where the other way fails and vice versa.

This seems like something that people would do all the time in OpenGL but I've been scouring tutorials for it - cant find anything.

ARRRRRRGH,
Nex

0

Share this post


Link to post
Share on other sites
Your problem could be solved by using the GluLookAt rutine, but you would have to rotate the eye and up vectors manualy.

The reason that OpenGl transformations appear backwards is because of the way that two matrices are multiplyed. the transformations commands (glrotate,glscale,gltranslate) multiply the current matrix C by the transformation matrix T on the right side. C:=C*T.

0

Share this post


Link to post
Share on other sites
Hi.

I'm trying to make the jump to 3d and learn this OpenGL thing and I'm having a bit of difficulty. I'm specifically trying to make a small project in which I can fly the viewpoint around some simple objects. The viewpoint can move forwards, backwards, left, right, pitch, roll, and yaw. The objects should appear to stay still. Here's the problem:

I used the OpenGL programming Guide suggestion to do
glRotated(roll,0,0,1);
glRotated(yaw,0,1,0);
glRotated(pitch,1,0,0);
glTranslated(x,y,z);

Translate works fine but the rotations are screwy and the screwiness depends on the order I do them.
If I do the pitch rotation last then if I'm yawed 90 degrees pitch behaves like roll...

I'm a newbie to 3d stuff but I do have a good deal of experience in 2d and general programming. Can any of you please help me?

Thanks,

Nex

0

Share this post


Link to post
Share on other sites
I don't know if this has anything to do directly with the problem, but I believe that gluPerspective() needs to be applied to GL_PROJECTION matrix, not the GL_MODELVIEW matrix. This code could corrupt the modelview matrix.
0

Share this post


Link to post
Share on other sites