Transferring textures to GLUT Game Mode?

I have a game which does a lot of rendering to textures, highly nested in one another. I can’t reload and re-render everything after entering the game mode. It’s just stupid.

I need to transfer the textures with all the rendering made onto them (Done by FBOs).

How is it done if it can be done?

Thank you.

What about :
http://www.opengl.org/sdk/docs/man/xhtml/glGetTexImage.xml

I’ve tried that already (This is python):

if self.enter_fullscreen or self.exit_fullscreen:
			for surface in Surface.texture_ready:
				if surface.texture != None:
					glBindTexture(GL_TEXTURE_2D, surface.texture)
					glGetTexImage(GL_TEXTURE_2D,0,GL_RGBA,GL_UNSIGNED_BYTE,surface.data)
					surface.texture = None
			Surface.texture_ready = []

“Surface” objects with textures that have been made are put into the texture_ready list and when it switches screen modes the program is supposed to loop through that list and copy the texture data to the object’s data attribute, which stores pixel data before textures are rendered (Else used for loading images and things like that.). When surface.texture is None, when the data needs to be rendered to anything, the texture will then be created from the data attribute. The texture attribute then carries the texture ID.

I’ve tested and found out that these “Surface” objects are being processed after if surface.texture != None: That is the problem. I suppose the way they are being processed is.

I’ve done a test

surf = Surface((50,50))
		surf.fill((255,100,50))
		self.blit(surf,(10,500))
		glBindTexture(GL_TEXTURE_2D, surf.texture)
		surf2 = Surface((50,50))
		glGetTexImage(GL_TEXTURE_2D,0,GL_RGBA,GL_UNSIGNED_BYTE,surf2.data)
		self.blit(surf2,(100,500))

The first rendered surface shows as orange, as it should but the second doesn’t contain the copied texture data from the first and is black. :frowning:

surf2.data is None before and after the glGetTexImage call. Why?

What? I read you have to use the function that way but instead the data is returned from the function. :frowning: Well I have it working now.

		if self.enter_fullscreen or self.exit_fullscreen:
			for surface in Surface.texture_ready:
				glBindTexture(GL_TEXTURE_2D, surface.texture)
				surface.data = glGetTexImage(GL_TEXTURE_2D,0,GL_RGBA,GL_UNSIGNED_BYTE)
				surface.texture = None
			Surface.texture_ready = []