• Advertisement

Archived

This topic is now archived and is closed to further replies.

Rendering a map via classes

This topic is 5490 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok heres the scenario. I have a class called MAP which naturally contains all the map data as well as functions for loading the data, and retreiving pieces of the data. I have another class called GRAPHICS, which initializes OpenGL and keeps track of graphics related information (client area, array of textures, etc) My problem lies in which class should control drawing the map. The MAP class has half the data and the GRAPHICS class has the other half. Which should call which? I currently have a GRAPHICS* member in my MAP class, which points to the GRAPHICS object. This way I can access the functions in GRAPHICS. With this pointer they are essentially tied together though, and don't work separatly. What is the best way to handle this 2 halfs the data problem? any suggestions welcome. -Will I'm new to classes, so there may be something obvious I don't know about. [edited by - AcidInjury on February 6, 2003 10:24:17 PM]

Share this post


Link to post
Share on other sites
Advertisement
The whole point of having classes is that they should work together... if you don't have any class ever referring to another class or using its function you need to rethink.

No big deal in using another class methods.

Yes, you shouldn't just use all the other classes, but having a graphics class that can draw objects is just fine - as is having a map object which can draw itself on a graphics class with clearly defined functions.

If you're spreading your opengl calls among all the classes then the graphics <-> map collaboration is the least you need to worry about.

[Edit: Clarifications]

[edited by - Stary on February 7, 2003 4:38:21 PM]

Share this post


Link to post
Share on other sites

  • Advertisement