Rotating Help needed!!!
Author |
Message |
A.J
![](http://compsci.ca/v3/uploads/user_avatars/119833057151651227b0d87.gif)
|
Posted: Mon Dec 01, 2008 7:06 pm Post subject: Rotating Help needed!!! |
|
|
Hey guys!
I am working on a 3D Engine in C++, and I need help on the lighting part of it.
I am using OpenGl and Sdl.
My program loads a model (in the obj format, but I read it from a text file). It reads vertices and draws triangles given what faces to draw.
What my program does is that, while rotating my model, it also rotates the lighting! So one side will be in eternal darkness while the other side will always be lit up!
I don't know how to individually rotate only the model...if anyone could help me out, I will be ever so grateful
(I attached my program in Codeblocks. You can look at the .exe or my individual source code and headers if u dont have codeblocks)
Description: |
|
![](http://compsci.ca/v3/pafiledb/images/icons/clip.gif) Download |
Filename: |
3D.rar |
Filesize: |
317.36 KB |
Downloaded: |
131 Time(s) |
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
A.J
![](http://compsci.ca/v3/uploads/user_avatars/119833057151651227b0d87.gif)
|
Posted: Tue Dec 02, 2008 3:52 pm Post subject: Re: Rotating Help needed!!! |
|
|
anyone?...
|
|
|
|
|
![](images/spacer.gif) |
CodeMonkey2000
|
Posted: Tue Dec 02, 2008 4:38 pm Post subject: RE:Rotating Help needed!!! |
|
|
Place the glLight commands before all the scale,rotate and translate functions, but right after glLoadIdentity. glTranslate,glRotate and glScale change the GL_MODELVIEW matrix. All drawing type functions get multiplied by the GL_MODELVIEW. glLoadIdentity(); basically sets the matrix to the identity matrix, and when you multiply anything with this matrix, you get itself (it's like multiplying by 1).
|
|
|
|
|
![](images/spacer.gif) |
A.J
![](http://compsci.ca/v3/uploads/user_avatars/119833057151651227b0d87.gif)
|
Posted: Tue Dec 02, 2008 5:27 pm Post subject: Re: Rotating Help needed!!! |
|
|
I tried that before.......the model intermittently goes dark and bright (I want to have a fixed light just above the model, so it looks like it is having light reflected off of it all the time, but the light doesn't move)
Could you tell me what to do then?
|
|
|
|
|
![](images/spacer.gif) |
|
|