Skip to main content
gamedev.net
🔒 Locked

Texture projection - GLSL

Started by Eitsch Apr 13, 2006 at 4:17 PM 1 replies 1k views
Original Post
Eitsch
Eitsch
i want to project a texture onto a terrain with glsl. my vertex shader looks like:

const vec4 xplane = vec4(10.0,0.0,0.0,0.0);
const vec4 yplane = vec4(0.0,10.0,0.0,0.0);


void main()
{
	vec4 ambient = vec4(0.2,0.2,0.2,1.0);

	vec4 x = gl_ModelViewMatrixInverse * xplane;
	vec4 y = gl_ModelViewMatrixInverse * yplane;
	
	vec4 p =  gl_ModelViewMatrix * gl_Vertex;

	float s = p.x * x.x + p.y * x.y + p.z * x.z + x.w * p.w;
	float t = p.x * y.x + p.y * y.y + p.z * y.z + y.w * p.w;

	gl_TexCoord[1] = vec4(s,t,1.0,1.0);
whats wrong here. i need something like the fixed pipeline GL_EYE_LINEAR texgen mode.
Eitsch
Eitsch
push
Eitsch
Eitsch
no idea?

Topic Locked

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

Sign in to reply to this topic.