Jump to content
  • Advertisement
Sign in to follow this  
zeeli

Rendering framework

This topic is 3856 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

Greetings! I have been writing my own little engine/library for a while now and now I need some help. I've designed a some kind of a framework that i can write different renderer classes and use them to render to window class. Unfortunately my skills do have a limit... so I really need some help! [sad] Ok, here's what i thought:
/* Pseudo */
class BaseRenderer
{
public:
	virtual void initialize() = 0;
	virtual void render() = 0;
	virtual void resize() = 0;
}

/* Then I could inherit from the base class.. */

class GLRenderer : public BaseRenderer
{
public:
	void initialize() {
		/* GL Stuff */
	}

	/* ... */
}



For the window class, I could pass the renderer as a parameter
/* Something like this */
class Window
{

	Window(BaseRenderer *renderer) {
		if(renderer) {
			renderer->initialize();
		}
	}

}



Then I could use them as follows
int main()
{
	MyGLRenderer *renderer = new GLRenderer(); /* Inherited from GLRenderer */
	Window *window = new Window(renderer);
}



This is the real problem here. If I create a windows application(Win32 API). I'd have to write WINAPI WinMain or something like that, if I don't, the console window will be visible. How do I hide winapi crap from the end users? Also if I want to make it cross-platform, winapi stuff isn't tolerated. How would you guys create such a framework? EDIT: My target is to create cross-platform framework. Best Regards, zEeli [Edited by - zeeli on June 10, 2009 1:42:44 PM]

Share this post


Link to post
Share on other sites
Advertisement
I'd recommend using SDL instead of Win32 for creating a window. They have already solved the problems you're dealing with here.

With SDL the user writes a standard main function and, if using a Win32 application project, SDL handles the call to WinMain and no console is brought up.

Also SDL is cross-platform, works with several 3D libraries (OpenGL, Direct3D and some engines such as Ogre), and is very simple.

Share this post


Link to post
Share on other sites
Quote:
Original post by zeeli
How do I hide winapi crap from the end users? Also if I want to make it cross-platform, winapi stuff isn't tolerated.

Why do you want to hide the (win)main function though?

Why not just make a framework that I, the end user, can call into *from my own code, whatever it looks like*?
Then I'll figure out what kind of main function I want to use. (or if I even want to initialize your framework directly from the main function at all)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!