PDA

View Full Version : PRoblem :)



bojkar
12-23-2004, 01:01 PM
Hello
I have function in my class:




void CShader::sendToShader(char *varname,GLint v0)
{

int loc = glGetUniformLocationARB(my_program, varname);
glUniform1iARB(loc, v0);


}


And i have fragment program:




uniform sampler2D basetex;
uniform sampler2D bumptex;
varying vec3 eyeVec;

void main()
{
vec2 texUV, srcUV = gl_TexCoord[0].xy;
float height = texture2D(bumptex, srcUV).r;
float v = height * 0.04 - 0.02;
vec3 eye = normalize(eyeVec);
texUV = srcUV + (eye.xy * v);
vec3 rgb = texture2D(basetex, texUV).rgb;
gl_FragColor = vec4(vec3(rgb), 1.0);
// gl_FragColor = vec4(vec3(rgb)*height, 1.0);
}

in my engin code:
shader.start();
shader.sendToShader("bumptex",0);
render_scene();
shader.stop();

And when i run this i have error "memory can't be read"

What is wrong?

Humus
12-24-2004, 02:54 PM
Sounds like a pointer problem to me. You're probably trying to read a pointer that has already been freed or something like that.

bojkar
12-24-2004, 03:38 PM
ok i know what is wrong. I Was forget about define this extanasion(glUniform1iARB)

Sorry and thanks!