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++ Library : Other (not classified elsewhere) » [Proposal] GLCtrl and textures (Not sure where to make a call to pre-generate a texture)
[Proposal] GLCtrl and textures [message #56489] Thu, 18 March 2021 20:41 Go to next message
jjacksonRIAB is currently offline  jjacksonRIAB
Messages: 219
Registered: June 2011
Experienced Member
I get the dreaded white texture of death rendering a quad and I discovered the only place I can get it to work is in GLPaint, but that kind of defies the purpose of creating a texture beforehand and binding it. I looked through the source for GLCtrl and could find no obvious hook for getting calls in right after a gl initialization call so I added a callback WhenGLInit and call it here:

void GLCtrl::ExecuteGL(Event<> paint, bool swap_buffers)
{
	MemoryIgnoreLeaksBlock __;

	glXMakeCurrent(s_Display, win, s_GLXContext);

	ONCELOCK {
		glewInit();
		WhenGLInit();
	}

	paint();

	if(swap_buffers)
		glXSwapBuffers(s_Display, win);
	else
		glFlush();

	glXMakeCurrent(s_Display, None, NULL);
}


Textures work fine after that. Is there some other hook that I can make calls right after GL has been initialized/context has been created and I simply missed it? Is there a more appropriate way to do this?

[Updated on: Thu, 18 March 2021 21:17]

Report message to a moderator

Re: GLCtrl and textures [message #56490 is a reply to message #56489] Thu, 18 March 2021 21:13 Go to previous messageGo to next message
jjacksonRIAB is currently offline  jjacksonRIAB
Messages: 219
Registered: June 2011
Experienced Member
Or perhaps just add an empty override:

protected:
	// Called on paint events
	virtual void GLPaint() { WhenGLPaint(); }
	virtual void GLInit()  { };
	void Init();


and call it after GL has been initialized in linux and win32
Re: GLCtrl and textures [message #56499 is a reply to message #56490] Fri, 19 March 2021 13:04 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
I am sorry as I am sort of "detuned" from OpenGL, but I believe that you can force the initializations by

GLCtrl::CreateContext();

call. If I remember well, it should be fine to create textures after that.

Mirek
Re: GLCtrl and textures [message #56503 is a reply to message #56499] Fri, 19 March 2021 16:38 Go to previous message
jjacksonRIAB is currently offline  jjacksonRIAB
Messages: 219
Registered: June 2011
Experienced Member
Hmm, I already tried putting my call at the end of CreateContext and I got white textures of death. I'll follow execution and see if I'm getting a double-initialization somewhere. Thanks, Mirek.
Previous Topic: Can I build static library using U++?
Next Topic: Eigen and UppHub
Goto Forum:
  


Current Time: Thu Mar 28 11:45:19 CET 2024

Total time taken to generate the page: 0.00828 seconds