RTT for 1.26

BlitzMax Forums/BlitzMax Programming/RTT for 1.26

The Forum Archive is locked. These are the original blitzbasic.com forums, kept so their posts can still be read and searched. No new topics, replies or edits can be made here. To join the conversation, head over to the Blitz3D+ forums.

Thanks University-lessons to give me some time on my laptop ;D ... what else is useful in "algorithms and programming".


think I got something which is usable...

Add function (or use the given one in the frame-create-function):

	Function NextPowSize(n) 
			Local t = 1
			While t<n
				t:*2
			Wend
			Return t
		End Function


and change TextureRender_End to:
	Function TextureRender_End()
	SetScale 1.0, 1.0

	?Win32
		If dx
			D3D7GraphicsDriver().Direct3DDevice7().EndScene()
		Else
	?
			glBindTexture GL_TEXTURE_2D, GLFrame.name
'			glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, Width, Height, 0)
			glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, NextPowSize(width), NextPowSize(Height), 0) 
			glBindTexture GL_TEXTURE_2D, 0
	?Win32
		EndIf
	?
		ViewportSet(0,0,GraphicsWidth(),GraphicsHeight())
		DrawImageRect Image,-2000,-2000,1,1


	'	debuglog "tRender : TextureRender_End OK"
		Return True
	End Function


As you see I changed the width/height thing... Because Textures are surely saved with power of 2 and some sprites (eg when fullscreen-resolutions) aren't saved this way - the stretching occours.

If now the function nextpowsize returns the correct dimensions - for 800x600 its 1024x1024, all stretching is gone... and it looks smooth again ;D...


Hope it works for you too.

ah and... may be for OGL you can comment out:
		DrawImageRect Image,-2000,-2000,1,1

in the same function - for me commenting it out didnt change a thing in OGL.


bye
MB