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   | 
		 
		
			
				
				
				  | 
					
						  
						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 ?     
 
Thanks in advance 
Best regard. 
		
		
		[Updated on: Mon, 20 July 2020 18:14] Report message to a moderator  
 |  
	| 
		
	 | 
 
 
 |  
  
 
Goto Forum:
 
 Current Time: Tue Nov 04 14:38:01 CET 2025 
 Total time taken to generate the page: 0.00809 seconds 
 |