Irrlicht and Glut on a Mac

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Paddon
Posts: 43
Joined: Thu Jul 06, 2006 4:09 pm

Irrlicht and Glut on a Mac

Post by Paddon »

Hey all,

I am still attempting to port one of my visualization applications that implements Irrlicht to my Mac. However, my glut primitives will not work the same for me on the mac as they did under linux. This code worked fine under linux. I get nothing plotted on screen though. Essentially what is supposed to happen is some glut cubes of required transparency and color are to be plotted on the screen. It seems like I am just not getting anything drawn to smgr and I cannot figure out why.

Code: Select all

int main()
{
  device->setEventReceiver(&reciever);
  device->getCursorControl()->setVisible(true);	

   createGUI();
   
   while(device->run() && driver)
  {
     if (device->isWindowActive())
     {
		driver->beginScene(true, true, SColor(0,200,200,200));


       if(flag3)
       {
         sprintf(TEMP,"%s.%06i",name.c_str(),i);  // Takes the run name and alters it to the correct file name
          //printf("\n\nTEMP= %s",TEMP);             // within the specified range, these were output by LJ.f
          int tmp=999;
		  tmp = ReadData(TEMP);
       }
		
 if(flag2){
	for (int w=0;w<NUM_PARTICLES;w++)
        {      // loop over all the x,y,z points and plot them

          glColor4f(XYZ[w].f7,(1-XYZ[w].f7),0.0,0.2);
          glPushMatrix();
           glutSolidCube(5);
           glPopMatrix();

           }
		   
        smgr->drawAll();
	 }
		
       env -> drawAll();

	   driver->endScene();

      }
  }	  
 device->drop();
 return 0;
}
Now, if I make any call to my initOpenGL() function, which sets up my lighting and scene rendering attributes, I get nothing on the screen. Not even my GUI, it will disappear. Without the call to initOpenGL(), I still get nothing in my scene, other then my GUI. For the record this is my initOpenGL function.

Code: Select all


void initOpenGL(void){

// Material and lighting data to make things look pretty
    vector3df cam_pos =  camera->getAbsolutePosition();

    float mat_specular[] = { 1.0, 1.0, 1.0, 1.0 };
    float mat_shininess[] = { 20.0 };
    float lightPosition[4];
        
    cam_pos.getAs4Values(lightPosition);

    lightPosition[4] = 20000.0;
    

  // GL initialization stuff

    glShadeModel (GL_SMOOTH);
    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
    glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
    glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);
    glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);


    glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    glEnable(GL_LINE_SMOOTH);
    glEnable(GL_LIGHTING);
    glEnable(GL_BLEND);
    glEnable(GL_LIGHT0);
    glEnable(GL_DEPTH_TEST);
    glEnable(GL_ALPHA_TEST);
    glEnable(GL_COLOR_MATERIAL);
    glEnable(GL_CULL_FACE);
}
 
I have also done the following, with and without a call too initOpenGL and nothing was drawn to the screen. Considering this is the simplest GLUT and Irrlicht implementation, I am really curious as to why this will work under linux but not MacOSX.

Code: Select all

int main()
{
  device->setEventReceiver(&reciever);
  device->getCursorControl()->setVisible(true);	

   createGUI();
   
   while(device->run() && driver)
  {
     if (device->isWindowActive())
     {
		driver->beginScene(true, true, SColor(0,200,200,200));
	     glutSolidCube(5);
	     env -> drawAll();
         smgr->drawAll();
		 
	   driver->endScene();

      }
  }	  
 device->drop();
 return 0;
}
Any information you could provide me with as to why this is happening would be greatly appreciated.
- Jeff Paddon
Undergraduate Research Assistant
Physics Department
St. Francis Xavier University
Post Reply