   Class based OpenGL
  Hi all, I and two other friends are in an independant study in OpenGL.We are trying to design a class based OpenGL SDK.  For example having a SKY_DOME class that takes parameters and creates a Sky Dome based on what you pass it.  Anyway, would each of these classes need a render function specific to that class?  I''ve written SKY_BOX classes and haven''t had any luck in getting them to render.Thanks a lot 
  I am by no means a C++ expert, but I do have some experience.  Everything that you want to draw to the screen in openGL has to be rendered somehow.  So if each class doesn''t have its own "render" function where you actually specify vertices & colors & normals & modes, then that class would have had to been derived from a base class which has a "render" function. HOWEVER, to do this would be a lil weird, unless you feel like arranging all your data in every sub-class derived from the base class in such a way so that it has all the expected data for that parent method.  For instace: a vertex array, a texture (array), a color array, a normal array, or perhaps more advanced trees or maybe even simpler defined types like: box, line, point.  In any case... if you have data that represents something, you have to render it SOMEWHERE!!!!! ;  At the simplest level all you have to do is create an instance of your class and then in the main loop call whatever function it defines to render its self (Render() would be a sane name) and it would draw its self using OpenGL commandsThe other, slightly more complex method, is to have a Renderer class which asks each object in turn for (or gets told by each object) the data required to render it then it does the OpenGL drawing commands.But, as the person above says, basicaly the calls to OpenGL have to be made SOMEWHERE, either in the class its self or in a renderer class ;  It's simple.The way i do it is that i have a class that handels the redering by calling the render funtions defined by a render list.this class contains several sub classes, and each of these classes handels the different methods and functions each object uses.These classes contains objects, characters, maps, particle systems and sutch.The character class for instance handels such things as colition detection, stencil volume functions, skeletal animation and rendering.So yes it's better if each class does it's own rendering.But make shure that you do call every render function in correct order, otherwise you can get strange effect's(it did for me).   ---------------------------------For an overdose of l33tness, flashbang.nu [edited by - lc_overlord on February 11, 2004 6:52:57 PM]