
Texture sizes
Posted Monday, 8 June, 2009 - 08:32 by Soundbomber inHow do I scale the size of a texture?
I have the correct mapping of my texture but it is tiny, how can I make the size bigger?
Dim iTextureID As Integer
Dim oData As Imaging.BitmapData = Nothing
Dim bmp As Bitmap = Nothing
If m_bUseTextures Then
oGL.Hint(HintTarget.PerspectiveCorrectionHint, HintMode.Nicest)
oGL.GenTextures(1, iTextureID)
oGL.BindTexture(TextureTarget.Texture2D, iTextureID)
oGL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, _
TextureMinFilter.Linear)
oGL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, _
TextureMinFilter.Linear)
oGL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, _
TextureWrapMode.Repeat)
oGL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, _
TextureWrapMode.Repeat)
bmp = My.Resources.resResources.old_steel_big
oData = bmp.LockBits(New Rectangle(0, 0, bmp.Width, bmp.Height), _
Imaging.ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb)
oGL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, oData.Width, _
oData.Height, 0, OpenTK.Graphics.PixelFormat.Bgra, PixelType.UnsignedByte, oData.Scan0)
oGL.Enable(EnableCap.Texture2D)
oGL.Enable(EnableCap.TextureGenS)
oGL.Enable(EnableCap.TextureGenT)
oGL.TexGen(TextureCoordName.S, TextureGenParameter.TextureGenMode, _
TextureGenMode.EyeLinear)
oGL.TexGen(TextureCoordName.T, TextureGenParameter.TextureGenMode, _
TextureGenMode.EyeLinear)
End If

Comments
Re: Texture sizes
Could you draw a screenshot of what you are trying to do?
Re: Texture sizes
View1.png shows my object full size with the textures applied.
View2 shows a close up with many very small texture bitmaps instead of of one or two texture bitmaps drawn at full size and repeated.
Re: Texture sizes
You should be able to multiply the texture matrix with a Scale matrix (0.1, 0.1, 0.1). At least that is my guess; I am not sure if the texture matrix is applied when you use TexGen functions, but I think so:
Re: Texture sizes
That worked a treat, but now the texture isn't rotating a with the view. It just appears to be always rendering at a fixed point.
Re: Texture sizes
Are you using TexGen?
Re: Texture sizes
Yes
Re: Texture sizes
Don't use TexGen. Specify texture coordinates manually with glTexCoord - like you specify vertex coordinates with glVertex. Or if you use VA or VBO, then use glTexCoordPointer.
Re: Texture sizes
I want to automatically generate my texture coords. My model is too complex to do it by hand.
Re: Texture sizes
TexGen + texture matrix scaling should be possible, see for example this PDF:
http://developer.nvidia.com/attach/6750