How to get a cards texture limit?

BlitzMax Forums/BlitzMax Programming/How to get a cards texture limit?

GW(Posted 2005) [#1]
In B3d is fairly easy to find out the whether a video card supports a certain texture size. You can create a new texture and then check its dimentions to see if it was what you told it to be. But how can you deterimine is a texture size is supported in Bmax/Ogl?


N(Posted 2005) [#2]
See if it crashes. Or something.


Robert(Posted 2005) [#3]
Try this:

Framework BRL.Blitz

Import BRL.Max2D
Import BRL.GLMax2D
Import BRL.StandardIO

Graphics 800,600,0

Print texSizeSupported(640,480)
Print texSizeSupported(800,600)
Print texSizeSupported(2096,2096)

Function texSizeSupported(w,h)

	Local supported=True
	
	Try
		CreateImage(w,h)
	Catch o:Object
		supported=False
	End Try

	FlushMem
	
	Return supported
	
End Function


Edit: On my laptop, the above code prints:

1
1
0


N(Posted 2005) [#4]
Local maxTexSize:Int
glGetIntegerv(GL_MAX_TEXTURE_SIZE, Varptr maxTexSize)



LarsG(Posted 2005) [#5]
Robert:
try changing your number 2096 to 2048..


N(Posted 2005) [#6]
I don't trust people who can't use OpenGL without a wrapper of some sort ;)


GW(Posted 2005) [#7]
Thanks Robert, Noel!


Robert(Posted 2005) [#8]
Robert:
try changing your number 2096 to 2048..


I was just proving that it returns False when the size is invalid.

In any case, Noel's suggested method is clearly much better. The only advantage of doing it the way I suggested is that it doesn't matter what back-end is currently being used (either OpenGL or DirectX)


Perturbatio(Posted 2005) [#9]
The only advantage of doing it the way I suggested is that it doesn't matter what back-end is currently being used (either OpenGL or DirectX)

Your code returns 1 for me for all three sizes, not sure if my card simply steps the texture size up to the next power of 2 or if the drivers simply lie.


RGR(Posted 2005) [#10]
Print texSizeSupported(4096,4096)
Adding this as 4th testline displays 1 1 1 0 here


MrCredo(Posted 2005) [#11]
4x4=16mb
16x3=48mb + more vram for backbuffer, fonts etc...
if you have 64-mb-gfx-card - you can only allocate max. 64 mb vram