Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Rotating Help needed!!!
Index -> Programming, C++ -> C++ Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
A.J




PostPosted: 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 Very Happy

(I attached my program in Codeblocks. You can look at the .exe or my individual source code and headers if u dont have codeblocks)



3D.rar
 Description:
Here it is!!!

Download
 Filename:  3D.rar
 Filesize:  317.36 KB
 Downloaded:  131 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
A.J




PostPosted: Tue Dec 02, 2008 3:52 pm   Post subject: Re: Rotating Help needed!!!

anyone?... BooHoo
CodeMonkey2000




PostPosted: 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).
A.J




PostPosted: 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?
Display posts from previous:   
   Index -> Programming, C++ -> C++ Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: