Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9004179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:50:37+00:00 2026-06-16T00:50:37+00:00

EDIT: IS there any pre-built libraries to do this for me, that either uses

  • 0

EDIT:
IS there any pre-built libraries to do this for me, that either uses SDL OR runs on Window, Linux, Mac, iOS and Android?

At the moment, I am not sure if the way I am changing contexts is quite a good design, I haven’t completely finished it. I’m just really concerned about wasting my time. I am using SDL for Window management, and event handling.

I currently wrap SDL (specifically SDL 2) in classes to manage this. These are my classes and what they do:

  • Window – Describes a Window
  • WindowContext – Describes a context for the Window (abstract class)
  • WindowDelegate – Used to determine when the context has changed, when the window will open/close, etc.
  • WindowEventListener – Listens to events from the Window (not sure if I should just stick to polling instead of call back functions)

Anyway, here’s an example of how it works:

OglWindowContext* context = new OglWindowContext;
// change context's settings
Window window(ipoint2(), idimension2(640, 480), "Test Window", 
              Window::Resizeable, context, &windowListener, 
              NULL /* window delegate */);

while(window.isOpen())
{
    window.processEvents(); // calls back events to the WindowEventListener
    window.draw(); // calls the context's draw method
}

NOTE:
ipoint2 is a 2d point

And I can change the context midway by calling:

window.setContext(new Dx9Context); // or whatever context you would like

Is there any easier way, or should I say more efficient way, to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:50:38+00:00Added an answer on June 16, 2026 at 12:50 am

    Switching between renderers doesn’t make much sense on any other platform that Windows at the moment, so your request for windows, linux, mac, ios and android support sounds strange. Perhaps you’re looking for a library that helps you to be portable in general?

    To achieve running with one renderer or the other (opengl/d3d), or to achieve portability in general, you need to implement some kind of portability layer.

    Basically, you could start by writing two programs: one that draws a rotating cube in OpenGL, and another, completely separate that does the same with D3D. Next, write a third program that combines these, by:

    • Abstract differing things from the two applications behind a common interface
      • Such as, but not limited to, once you get into various platforms:
        • Application control loop
        • Renderer (i.e, graphics output)
        • File I/O
        • User input
        • Audio
        • System services (threads, etc)
    • Implement the common interfaces on all target platforms
    • Implement application functionality only through the abstraction interfaces

    The D3D and OpenGL on windows can practically be considered separate platforms, but you could pick one or the other during application startup – the choise would probably affect renderer and also the application control loop.

    Switching during runtime is also entirely possible, but probably way too much hassle to be worth it.

    You may note that SDL actually does a lot of the above.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any possible way to edit this code <asp:LoginName ID=LoginName1 runat=server style=top: 165px;
Are there any editors that can edit multi-gigabyte text files, perhaps by only loading
Out of curiousity, is there any way to edit an existing synonym? That is,
Are there any pre-made scripts that I can use for PHP / MySQL to
Is there any external library using which one can edit and save XML files
EDIT: There must be some way I can approach this without writing a whole
EDIT: There's now a doc page on this so this question is irrelevant, also
**EDIT: There are several options below that would work. Please vote/comment according to your
Is there any alternative to file_get_contents that would create the file if it did
Is there a pre-built ModelBinder I can use with LINQ to get an object

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.