The VRAM texture flag

BlitzMax Forums/MiniB3D Module/The VRAM texture flag

Kryzon(Posted 2014) [#1]
From the Blitz3D documentation on CreateTexture:

256: Store texture in vram. In some circumstances, this makes for much faster dynamic textures - ie. when using CopyRect between two textures. When drawing to cube maps in real-time, it is preferable to use this flag.

OpenGL has an equivalent functionality from glPrioritizeTextures() or from glTexParameterf() with the parameter GL_TEXTURE_PRIORITY.
More information: http://www.cs.rit.edu/~ncs/Courses/570/UserGuide/OpenGLonWin-13.html#MARKER-9-21

If you want to include this flag in your MiniB3D module, the line is the following:
If tex.flags&256 Then glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_PRIORITY, 1.0 )
This line needs to be added to the CreateTexture, LoadAnimTexture and CreateCubeMapTexture functions inside TTexture.BMX.
You can add this line below a certain block in these functions. The location is the following:
		Local name:Int
		glGenTextures 1,Varptr name
		glBindtexture GL_TEXTURE_2D,name

		'[ Paste the the line here ]
All the three functions have the above in them, so there's no chance for error. The cubemap function uses a different parameter for the glBindTexture function, but it's almost the same.

To use this functionality, create or load textures with the "vram" flag 256, like in Blitz3D.