Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Widgets - General questions or Mixed problems » OpenGL bad context in key function
OpenGL bad context in key function [message #54444] Mon, 20 July 2020 18:13 Go to next message
Xemuth is currently offline  Xemuth
Messages: 387
Registered: August 2018
Location: France
Senior Member
hello, I have some context problem using OpenGL Ctrl. Let me present my problem using the OpenGL package (reference assembly) :

in the void GLPaint() function I add this at the end :
auto test =wglGetCurrentContext(); //Get current OpenGL context, NULL if no context is active
if(test == NULL)Cout() << "Bad Context" << EOL;
else Cout() << "Good Context" << EOL;
		
auto test2 = GetCurrentThreadId(); //Get current thread PID
Cout() << "Thread PID :" << test2 << EOL;

The goal of this code is to print if the function handle a valid openGL context and then print the PID of the current thread

The result of this bunch of code is simple :
Good context

However when using this bunch of code in Key function, it print me bad context with the same PID than in the GLpaint function
wich is problematique because I can't execute some opengl function direclty in the key handler !

Can someone explain me why this happen ? Confused

Thanks in advance
Best regard.

[Updated on: Mon, 20 July 2020 18:14]

Report message to a moderator

Re: OpenGL bad context in key function [message #54446 is a reply to message #54444] Tue, 21 July 2020 15:03 Go to previous message
Xemuth is currently offline  Xemuth
Messages: 387
Registered: August 2018
Location: France
Senior Member
Ok I have found why I lose my OpenGL context in Ctrl base override function :

wglMakeCurrent(NULL, NULL); wich is call in ExecuteGL Funtion.

Previous Topic: Edit controls are focused even not being the first
Next Topic: [Question] Can SetCapture/ReleaseCapture be used with middle mouse button?
Goto Forum:
  


Current Time: Fri Jun 21 23:53:58 CEST 2024

Total time taken to generate the page: 0.00782 seconds