Hello,
There is a strange vertical line visible during a texture mapping test, a
screenshot can be seen here:
http://members.home.nl/hbthoupperman...rticalLine.PNG
What do you make of this ?
Driver bug or programming bug ?
Some details about the code:
500 by 400 verteces are draw to OpenGL. (0 to 499 and 0 to 399)
The texture coordinates are set to X/(500-1) and Y/(500-1)
Red = (X/(500-1)) * 255
Green = (Y/(400-1)) * 255
Blue = 255
Image uploaded to gfx card with:
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, mTextureWidth[vTextureIndex],
mTextureHeight[vTextureIndex]-1, 0, GL_RGBA, GL_UNSIGNED_BYTE,
mTexture[vTextureIndex]);
(Was testing height-1 during screenshot but doesn't matter. problem
remains.)
Other settings are:
// after a texture is bound it's settings can be set.
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
// use only original texture no mipmap levels
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, 0 );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 0 );
// sets the mipmap levels to just one/original zero
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0 );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0 );
// don't use border texels.
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
// turn mipmapping off just in case.
glTexParameteri( GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_FALSE);
glViewport(0,0,OpenGLv2.Width,OpenGLv2.Height); //
Resetuje aktuální nastavení
glMatrixMode(GL_PROJECTION);
glLoadIdentity;
gluOrtho2D(0.0-0.5, OpenGLv2.Width-0.5, OpenGLv2.Height-0.5, 0.0 - 0.5);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity;
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
// Smaze obrazovku
glBegin(GL_POINTS);
for for etc
glVertex3f( vX, vY, 0 ); // could be 2f as well for 2d version

tried glVertex2f too... still strange vertical line...
end end
glEnd;
Vertex.cg:
float4x4 WorldViewProj : WorldViewProjection;
struct TVertexShaderIn
{
float3 mPosition : POSITION;
float2 mTextureCoordinate0 : TEXCOORD0;
};
struct TVertexShaderOut
{
float4 mPosition : POSITION;
float2 mTextureCoordinate0 : TEXCOORD0;
};
// void routines not supported by nvidia shader debugger
/*
void TVertexShader_Main( in TVertexShaderIn ParaIn , out TVertexShaderOut
ParaOut )
{
ParaOut.mPosition = mul(WorldViewProj, float4(ParaIn.mPosition.xyz, 1.0));
ParaOut.mTextureCoordinate0 = ParaIn.mTextureCoordinate0;
}
*/
// return routines/functions do work in nvidia shader debugger:
TVertexShaderOut TVertexShader_Main( in TVertexShaderIn ParaIn )
{
TVertexShaderOut ParaOut;
ParaOut.mPosition = mul(WorldViewProj, float4(ParaIn.mPosition.xyz, 1.0));
ParaOut.mTextureCoordinate0 = ParaIn.mTextureCoordinate0;
// ParaOut.mTextureCoordinate0.x = ParaIn.mPosition.x;
// ParaOut.mTextureCoordinate0.y = ParaIn.mPosition.y;
return ParaOut;
}
Pixel.cg:
/*
texture SpaceShipTexture
<
string ResourceName = ""; // must be set in fx composer gui/properties.
string UIName = "SpaceShipTexture";
string ResourceType = "2D";
>;
*/
sampler2D mTexture = sampler_state
{
// Texture = <SpaceShipTexture>;
// MinFilter = Linear;
// MipFilter = Linear;
// MagFilter = Linear;
// AddressU = Clamp;
// AddressV = Clamp;
};
struct TPixelShaderIn
{
float2 mPosition : TEXCOORD0;
const uniform sampler2D mTexture;
};
struct TPixelShaderOut
{
float4 mColor : COLOR;
};
// void not supported by nvidia shader debugger
/*
void TPixelShader_Main( in TPixelShaderIn ParaIn, out TPixelShaderOut
ParaOut )
{
ParaOut.mColor = tex2D( SpaceShipSampler2D, ParaIn.mPosition );
}
*/
float gPI = 3.1415926535897932384626433832795;
float gSeconds : TIME;
// return routines/functions do work in nvidia shader debugger:
TPixelShaderOut TPixelShader_Main( in TPixelShaderIn ParaIn )
{
TPixelShaderOut ParaOut;
float4 vTexel;
float4 vOutput;
// vOutput.x = ParaIn.mPosition.x/500.0; // ParaIn.mPosition.x;
// vOutput.y = ParaIn.mPosition.y/500.0;
vTexel = tex2D( mTexture, ParaIn.mPosition );
vOutput.x = vTexel.x;
vOutput.y = vTexel.y;
vOutput.z = 1.0;
ParaOut.mColor = vOutput;
return ParaOut;
}
Any idea what's wrong ???????????????????????
(Please no driver bug ?? Me praying...)
Doesn't seem like I am doing anything wrong... code is messy... but I don't
see an obvious mistake or anything ?!
I pretty much tried changing everything like +0.5 or -0.5... line doesn't go
away ?!?
Try zooming in on the line and you ll see it are actually pixels and not
just monitor artifact !
I WANT THIS VERTICAL LINE TERMINATED !
HEEEELLPPPP
Bye,
Skybuck.