Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 

 Home / 3D Theory & Graphics / OpenGL matrix problem Account Manager
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
kinzeron

March 24, 2005, 02:37 PM

Hi there,
I have a little problem considering OpenGL coordinate system, I want to change the coordinate system to be like the one in 3D Studio Max, the problem is that my method doesn't work:

  1.  
  2. glMatrixMode(GL_MODELVIEW);
  3. GLfloat minit[16] = {
  4.         1.0f, 0.0f, 0.0f, 0.0f,
  5.         0.0f, 0.0f, -1.0f, 0.0f,
  6.         0.0f, 1.0f, 0.0f, 0.0f,
  7.         0.0f, 0.0f, 0.0f, 1.0f
  8. };
  9. glMultMatrix(minit);
  10.  
  11. gluPerspective(0.0, -600.0, 0.0,
  12.     0.0, 0.0, 0.0,
  13.     1.0, 0.0, 0.0);
  14.  


the problem is that I get nothing on the screen, I don't know where the problem is, hope someone can point me to the problem, because I m stuck here...

Thx...


 
Chad Austin

March 24, 2005, 02:49 PM

  1.  
  2. glMatrixMode(GL_PROJECTION);
  3. glLoadIdentity();
  4. gluPerspective(...);
  5.  
  6. GLfloat minit[16] = {
  7.         1.0f, 0.0f, 0.0f, 0.0f,
  8.         0.0f, 0.0f, -1.0f, 0.0f,
  9.         0.0f, 1.0f, 0.0f, 0.0f,
  10.         0.0f, 0.0f, 0.0f, 1.0f
  11. };
  12. glMultMatrix(minit);
  13.  
  14. glMatrixMode(GL_MODELVIEW);
  15. glLoadIdentity();
  16.  


I think that should do what you want...

HTH,
Chad

 
kinzeron

March 24, 2005, 04:18 PM

sorry it was gluLookAt, but it aint working neither in GL_PROJECTION mode

  1.  
  2. glViewport(0, 0, g_width, g_height);
  3. glMatrixMode(GL_PROJECTION);
  4. glLoadIdentity();
  5.  
  6. gluPerspective(45.0, (GLdouble)g_width/g_height, 1.0, 1000.0);
  7. GLfloat minit[16] = {
  8.         1.0f, 0.0f, 0.0f, 0.0f,
  9.         0.0f, 0.0f, -1.0f, 0.0f,
  10.         0.0f, 1.0f, 0.0f, 0.0f,
  11.         0.0f, 0.0f, 0.0f, 1.0f
  12. };
  13. glLoadMatrixf(minit);
  14.        
  15. glMatrixMode(GL_MODELVIEW);
  16. glLoadIdentity();
  17. gluLookAt(0.0, -600.0, 0.0,
  18.  0.0, 0.0, 0.0,
  19.  0.0, 0.0, 1.0);
  20.  


that's the code I m using, and it ain't working!!! :(

 
KreK

March 25, 2005, 01:01 AM

This doesn't make much sense. First you are uploading a projection matrix with the gluPerspective, then you are replacing it with the new one by glLoadMatrix. Use either one or the other to setup your projection.

If you want to modify the results from gluPerspective, use glMultMatrix instead of glLoadMatrix.

For displaying 3ds models, instead of trying to modify projection matrix, why don't you simply change the vertex coordinates of your 3ds model? If I am not mistaken, the conversion is something like this (from 3ds to GL): (x,y,z) -> (-x, z, y).

 
This thread contains 4 messages.
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.