From: Tobias H. <ss...@we...> - 2005-10-29 20:21:17
Attachments:
drawsolidcube_actor.c
|
Hi people! I hope, I don't bother you to much with my beginner problem. I've got a program, that creates a solid cube with glutSolidCube (100.0f); When I'm using a orthographic projection it does work, but with a perspective projection it doesn't. There are no problems to compile the code, but it just display a blank screen. For the perspective projection I use gluPerspective (100.0f, aspectRatio, 1.0f, 200.0f); I attached the source code. Thank you for your help! Tobias -- GPG-Fingerprint: C39E 5381 7721 8613 B5C9 CFAF 54FC B8DB D02D 7085 Registered Linux-User #367044 Registered Linux-Machine #262062 http://counter.li.org Diese E-Mail wurde mit einer fortgeschrittenen elektronischen Signatur nach §2 2. d) SigG signiert. |
From: Julien G. <vir...@gm...> - 2005-10-29 21:25:54
|
Hello, > I hope, I don't bother you to much with my beginner problem. > I've got a program, that creates a solid cube with > glutSolidCube (100.0f); > When I'm using a orthographic projection it does work, but with a > perspective projection it doesn't. > There are no problems to compile the code, but it just display a blank > screen. The cube is behind the camera. Replace "glTranslatef (0.0f, 0.0f, 50.0f);" by "glTranslatef (0.0f, 0.0f, -100.0f);". Cheers, -- Julien Guertault |
From: Tobias H. <ss...@we...> - 2005-10-30 18:54:45
|
Hi Julien! On Saturday, 29. Oktober 2005 23:25 Julien Guertault wrote: > > [...] > > The cube is behind the camera. Replace "glTranslatef (0.0f, 0.0f, > 50.0f);" by "glTranslatef (0.0f, 0.0f, -100.0f);". Thank you very much, it does work. But how do I know, where the camera is in this case? Tobias =2D-=20 GPG-Fingerprint: C39E 5381 7721 8613 B5C9 CFAF 54FC B8DB D02D 7085 Registered Linux-User #367044 Registered Linux-Machine #262062 http://counter.li.org Diese E-Mail wurde mit einer fortgeschrittenen elektronischen Signatur nach =C2=A72 2. d) SigG signiert. |
From: Julien G. <vir...@gm...> - 2005-10-30 19:10:34
|
Hello, > > The cube is behind the camera. Replace "glTranslatef (0.0f, 0.0f, > > 50.0f);" by "glTranslatef (0.0f, 0.0f, -100.0f);". > Thank you very much, it does work. You're welcome. > But how do I know, where the camera is in this case? The cube is drawn at the origin. With the call you made, you told to move the camera 50 forward, resulting in having the cube behind it (well, the camera was actually inside the cube, and it was invisible because of the backface culling). With the new call, you tell the camera to move 100 backward, therefore allowing to see the cube. Does it make sense to you explained that way? -- Julien Guertault |
From: Tobias H. <ss...@we...> - 2005-10-30 19:35:50
|
Hi Julien! On Sunday, 30. Oktober 2005 20:10 Julien Guertault wrote: > > > [...] > > [...] > [...] > > But how do I know, where the camera is in this case? > > The cube is drawn at the origin. With the call you made, you told > to move the camera 50 forward, resulting in having the cube behind > it (well, the camera was actually inside the cube, and it was > invisible because of the backface culling). With the new call, you > tell the camera to move 100 backward, therefore allowing to see the > cube. > > Does it make sense to you explained that way? Yeah, it does make sense, but my first try was without the=20 glTranselatef call. When I disable the glTranselatef call and backface culling and enable=20 outline the back I can see the, that the camera is inside the cube. Now my question is, where do I say where the camera should be. Or do I have to transelate every object in front of the camera? Thank you very much for you answers. Regards, Tobias =2D-=20 GPG-Fingerprint: C39E 5381 7721 8613 B5C9 CFAF 54FC B8DB D02D 7085 Registered Linux-User #367044 Registered Linux-Machine #262062 http://counter.li.org Diese E-Mail wurde mit einer fortgeschrittenen elektronischen Signatur nach =C2=A72 2. d) SigG signiert. |
From: Julien G. <vir...@gm...> - 2005-10-30 20:02:07
|
> Yeah, it does make sense, but my first try was without the > glTranselatef call. Then you can directly load hand made modelview matrices, if you want to work with quaternions for instance. > When I disable the glTranselatef call and backface culling and enable > outline the back I can see the, that the camera is inside the cube. > Now my question is, where do I say where the camera should be. > Or do I have to transelate every object in front of the camera? In OpenGL you don't have a way to tell "where the camera is", unless you use a higher level interface. Just change states by calling glTranslate* and glRotate*: they will apply to all following drawings (except if you use glPushMatrix and glPopMatrix). If you call once glTranslate* before rendering the scene, it will apply to all the scene, and it will look as if you moved the camera the opposite way. -- Julien Guertault |
From: Tobias H. <ss...@we...> - 2005-10-30 20:30:12
|
Hi! On Sunday, 30. Oktober 2005 21:01 Julien Guertault wrote: > > [...] > [...] > > When I disable the glTranselatef call and backface culling and > > enable outline the back I can see the, that the camera is inside > > the cube. Now my question is, where do I say where the camera > > should be. Or do I have to transelate every object in front of > > the camera? > > In OpenGL you don't have a way to tell "where the camera is", > unless you use a higher level interface. > > Just change states by calling glTranslate* and glRotate*: they will > apply to all following drawings (except if you use glPushMatrix and > glPopMatrix). If you call once glTranslate* before rendering the > scene, it will apply to all the scene, and it will look as if you > moved the camera the opposite way. I think, I've got the point, thank you for your help. The next thing I will try is gluLookAt(), hope I can do it on my own. Regards, Tobias =2D-=20 GPG-Fingerprint: C39E 5381 7721 8613 B5C9 CFAF 54FC B8DB D02D 7085 Registered Linux-User #367044 Registered Linux-Machine #262062 http://counter.li.org Diese E-Mail wurde mit einer fortgeschrittenen elektronischen Signatur nach =C2=A72 2. d) SigG signiert. |