Stream video to texture/update texture

BlitzMax Modules Forums/MiniB3D/Stream video to texture/update texture

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Function UploadPixtoImg(tex:TTexture,Pixmap:TPixmap)
	Local mip_level:Int = 0
		
		If tex <> Null Then
			If Pixmap.width <> tex.width Or Pixmap.height <> Pixmap.height Then
			ResizePixmap(Pixmap , tex.width , tex.height) 
			End If
			glBindtexture GL_TEXTURE_2D,tex.gltex[0]
			glPixelStorei GL_UNPACK_ROW_LENGTH,pixmap.pitch/BytesPerPixel[pixmap.format]
			glTexSubImage2D GL_TEXTURE_2D,mip_level,0,0,pixmap.width,pixmap.height,GL_BGRA,GL_UNSIGNED_BYTE,pixmap.pixels
			glPixelStorei GL_UNPACK_ROW_LENGTH,0
			glBindtexture GL_TEXTURE_2D , 0
		EndIf
End Function


This function should help you. It is not tested but it should work. Maybe you have to call ClearTextureFilters() at the start. But i think it should work from the beginning.
Also you should create textures with the same size as the received pixmaps to avoid pixmap resizing.