Skip to main content
GameDev.net gamedev.net
🔒 Locked

Texture mapping - Problem

Started by enkei Apr 23, 2009 at 3:57 AM 2 replies 550+ views
Original Post
enkei
enkei
I'm trying to map a texture onto a large terrain. Terrain data: 4096x4096 The data is not the problem, just the texture I map on it. If I use a 1024x1024 texture, it looks like this: Image Hosted by ImageShack.us
BUT if is use a 4096x4096 texture, it looks like this; Image Hosted by ImageShack.us
So, my graphics hardware properties: - ATI Radeon 4850 - GL_MAX_TEXTURE_SIZE: 8192 Does anyone know, why the big texture doesn't work properly? I'm confused. Thanks for the help.
Black Knight
Black Knight
Are you using any numbers in setting the texture coords like 1024?
Does it work for 2048x2048?Can you show some code from loading,setting texture coords and drawing of the mesh.
enkei
enkei
I'm using:
- GL_LINEAR as filter mode
- GL_CLAMP_TO_EDGE for texture wrapping

In my vertex shader, I compute the texcoord from the vertex position. This is possible, because the vertex ranges from 0,0 to 4096,4096:

uniform vec2 mapSize;varying vec2 texCoord;...texCoord = vec2(v.xy)/mapSize;


In fragment shader:
uniform sampler2D colorMap;varying vec2 texCoord;...gl_FragColor = texture2D(colorMap,texCoord.ts);


Now, I scale the image to 2048x2048 and test it.
enkei
enkei
With texture size 2048x2048, it works also fine.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.