Jump to content
  • Advertisement
Sign in to follow this  
SuBG

WIN + wxWidgets + SDL + OGL = MESS!

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

I have a problem integrating SDL_Surface in wxPanel. The SDL_Surface is not in place and i think there is absolutely no way to fit it inside the wx system. 2 days wondering in google, reading wx and sdl sources and banging my head, still no result. The situation is: 1) I have very complex wxWidgets form made with the wxFormBuilder 2) The viewport panel is located as a page of an aui-notebook 3) The application is going to be a level editor 4) I have engine that i build statically with the app. 5) The engine uses SDL+OPENGL setup 6) All OGL functionality is implemented in a dll driver What I do is: 1) I create a custom widget(wxPanel) with overriden events for paint/idle 2) I initialize the engine in Application::OnRun event with the following settings: --- The handle of the custom panel is sent to the engine --- SDL_SetVideoMode( width, height, bpp, window_flags | SDL_OPENGL | SDL_NOFRAME | SDL_RESIZABLE ) is executed on engine side 3) Recieve the SDL_Surface from the engine (SDL_GetVideoSurface();) 4) On idle event i render stuff and generate EVT_PAINT event Problems I encountered: 1) When I include EVT_PAINT function all pending widgets fail to paint until i close the aui page. All other events do not execute but stack... 2) Cant position the SDL_Surface in place Goals: 1) 100.1% portable! Here is the result: http://xs233.xs.to/xs233/08450/mustfithere521.png Here is the source:
bool CApp::OnInit() {
... splash screen and mainframe creation
	if( !Engine.InitSystem( "SIYAL",           g_MainFrame->GetViewport()->GetHandle(), 200, 200, 32 ) )
		return false;
...
}

int CApp::OnRun() {
...
	// generate an initial idle event to start things
	wxIdleEvent event_;
	event_.SetEventObject( g_MainFrame->GetViewport() );
	g_MainFrame->GetViewport()->AddPendingEvent( event_ );

	// start the main loop
	return wxApp::OnRun();
}

void SDLPanel::onIdle(wxIdleEvent &) {
	if( !m_VideoSurface ){
		m_VideoSurface = PLATFORM_SYS.GetVideoSurface();
	}

	if( m_VideoSurface == NULL ) return;

	MODEL_SYS->GetCUSTOM("gizmos")->RenderMesh("axii",MainScreen);
	RENDER_SYS->RenderFrame();

	Refresh();

	// throttle to keep from flooding the event queue
	wxMilliSleep(33);
}
onPaint is excluded because it makes problems
so i wonder if there is any way to fix all this I dug to the bottom of the bottomless internet and dont find anything Is it just a challenge or is it unpossible?

Share this post


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

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!