• 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.

Evil-Dog

Can a pro help me ?

3 posts in this topic

Hi ! What I''m trying to do is figure out how to place object in the 3d world and make them move while, at the same time, controling the camera without gluLookAt there''s many point I don''t get 1) Why is the original direction of the camera is toward the -z and how can I set it to look in the +z direction ? 2) How and when do I use glPushMatrix and glPopMatrix ? 3) Also when do I use glLoadIdentity ? cause when I use it the camera doesn''t move anymore so I guess I don''t use it right 4) And finally what is the logic of multiple object moving and camera moving at the same time ? ( cause all the toturial I''ve seen have 1 non-moving object and a camera...that''s lame hehe ) Please help me out here. Thanks a lot guys !
0

Share this post


Link to post
Share on other sites
You should read a few of the many excellent tutorials on matrix math and projection matrices, a few of which are available on this site. This answers all your questions except push/pop matrices; these simply copy to/from a stack of current transformation matrices, so you can return to an earlier state without completely recalculating. Read about matrix math; you''ll get it.
0

Share this post


Link to post
Share on other sites
I really recommend you purchase the OpenGL Game Programming book...all of this is explained there...

ill try to help anyway...even though im not a "pro"...

well, gluLookAt, what''s your problem with it? it''s efficient, fast, but if u HATE using it, then there''s a thing called viewing matrix (ill explain in a sec)
u can change that in order to control the camera. (glu just does it faster and easier)

when u use glLoadIdentity, it loads "Identity Matrix" values into a certain matrix.
there are a few predefined matrices in ogl :
Viewing Matrix. -> what you do to this matrix affects the camera
Modeling Matrix. ->" " " " " " " " " " the vertices u use.
Projection Matrix.-> projection type, perspective or ortho-something.

now...all of these matrices are 4x4, so when u use glLoadIdentity it restores the matrix u choose to its default position.

u choose which matrix to affect with glMatrixMode(mode),
mode can be GL_MODELVIEW, GL_PROJECTION and some other stuff u don''t really need(GL_TEXTURE). (i dunno which const chooses the camera matrix, cause i use gluLookAt)...

these matrices are 4x4 as i said before, so what glLoadIdentity does to a matrix is this :

1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1

so, if u use this code :
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

glTranslatef(5.0f,0.0f,0.0f);

and ur''e gonna draw a predifined point 5,5,5 it''s gonna draw it at 10,5,5 ok? ok.

so if u manually chnage the viewing matrix u can "move the camera" without gluLookAt...

and about moving multiple objects at the smae time...very easy...

matrixmode->modelview
loadidentity // returns coord system to 0,0,0

move/rotate/scale your first object //moves coord system

use vertex3f to throw everything into the frame buffer

and again
matrixmode->modelview
loadidentity // returns coord system to 0,0,0

move/rotate/scale your second object //moves coord system

use vertex3f to throw into the framebuffer,

and so on, and only when u r finished with all of the objects, use swapbuffers....

about the pop and push matrix:

matrixmode->modelview
loadidentity

move the your FIRST object //moves coord system
vertex3f it to the framebuffer

glPushMatrix at this point will remember the moving or any other transformation uv''e done so far to the modelview matrix (current coord system), and now, after the pushmatrix, opengl will consider the point u r at now (after all the moving) as its initial 0,0,0, so now when u move your second object (AFTER glPushMatrix) lets say 5 units to the right, it wont move 5 units to the right from 0,0,0 but from
"move the your FIRST object" position...and so on, and when u do a popmatrix, it reverts to the point that u moved to before the last pushmatrix..(usefull when u make pushmatrix within pushmatrix and so on).

and about the-Z: everytimne u render, MAKE it look up the positive Z, whether by manipulating the viewing matrix (NOT modelview, just view) or using gluLookAt(0,0,1) ...

I really hope this helps, if anything''s unclear just say so...

**> ATi Rules! nvidia doesn''''t...that simple! <**
0

Share this post


Link to post
Share on other sites
Thanks alot Pav3
but if you move the camera at the beginning with

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

glTranslatef(5.0f,0.0f,0.0f);

then when I''ll draw my first object with

matrixmode->modelview
loadidentity
move/rotate/scale
vertex3f...

this LoadIdentity won''T overwrite the first translation I did ?
0

Share this post


Link to post
Share on other sites