Some random developer-oriented questions

Some questions from Mark:

  • XCode/Cocoa: If you make a change to the Core and recompile, do you need to recompile the Server too? My (basic) understanding is that the Server links to the Core framework instead of embedding it. Is that right?
  • MWorks setup_variables.xml specifies refresh_rate for the monitor. What does that do, and how does it interact with the refresh rate set in System Preferences → Display?
  • Do I ever need to make an openGL call to swap the front and back buffers, or does MWorks do that automatically for me?
  • Is there a good way, in MWorks, to get the current display background color? Should I just use glGetPixels()?

Hey Mark,

If you make a change to the Core and recompile, do you need to recompile the Server too? My (basic) understanding is that the Server links to the Core framework instead of embedding it. Is that right?

In general, no, you don’t need to recompile the server. MWServer links dynamically to the MWorksCore framework, so usually all you need to do is restart it.

The exception is when you modify core header files that get included in the MWServer source (e.g. anything pulled in via Server.h). In that case, you should recompile the server. In practice, though, you probably don’t need to worry about it.

MWorks setup_variables.xml specifies refresh_rate for the monitor. What does that do, and how does it interact with the refresh rate set in System Preferences → Display?

In MWorks 0.4.4 (and earlier, I presume), the refresh_rate_hz setting was used when creating the main display’s OpenGL context. If it didn’t match the actual refresh rate, MWorks would generate an error message.

As of the latest HEAD, it appears that the parameter is completely unused (although MWorks will still warn if it’s missing).

Do I ever need to make an openGL call to swap the front and back buffers, or does MWorks do that automatically for me?

MWorks takes care of swapping the buffers.

Is there a good way, in MWorks, to get the current display background color? Should I just use glGetPixels()?

This should do the trick:

GLfloat clearColor[4];
glGetFloatv(GL_COLOR_CLEAR_VALUE, clearColor);
//fprintf(stderr, "red = %g, green = %g, blue = %g, alpha = %g\n",
//        clearColor[0], clearColor[1], clearColor[2], clearColor[3]);

Chris