Jump to content
  • Advertisement
Sign in to follow this  
Isolier

Projective Texture For Water

This topic is 4821 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I have read many resources on projective texturing, but apparently I am not really getting it... This is what I have so far:
		gl.glViewport(0,0,512,512);
		gl.glScalef(1.0f, -1.0f, 1.0f);
		gl.glCallList(terrain);
		gl.glBindTexture(GL.GL_TEXTURE_2D, textureObjects[REFLECT_TEXTURE_ID]);
		gl.glCopyTexImage2D(GL.GL_TEXTURE_2D, 0, GL.GL_RGBA, 0, 0, 512, 512, 0);
		gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
		gl.glViewport(0 , 0,1024 ,768);
		gl.glScalef(1.0f, -1.0f, 1.0f);
		
		gl.glClientActiveTexture(GL.GL_TEXTURE3);
		gl.glActiveTexture(GL.GL_TEXTURE3);
		gl.glEnable(GL.GL_TEXTURE_2D);
		gl.glBindTexture(GL.GL_TEXTURE_2D, textureObjects[REFLECT_TEXTURE_ID]);

                gl.glBegin(GL.GL_QUADS);
        	gl.glNormal3f(0.0f, 1.0f, 0.0f);
        	gl.glMultiTexCoord2f(GL.GL_TEXTURE3, 1.0f, 0.0f); 
        	gl.glVertex3f(512.0f, SEA_LEVEL*MAX_HEIGHT, -512.0f);
        	
        	gl.glMultiTexCoord2f(GL.GL_TEXTURE3, 0.0f, 0.0f);
        	gl.glVertex3f(-512.0f, SEA_LEVEL*MAX_HEIGHT, -512.0f);
        	
        	gl.glMultiTexCoord2f(GL.GL_TEXTURE3, 0.0f, 1.0f);
        	gl.glVertex3f(-512.0f, SEA_LEVEL*MAX_HEIGHT, 512.0f);
        	
        	gl.glMultiTexCoord2f(GL.GL_TEXTURE3, 1.0f, 1.0f);
        	gl.glVertex3f(512.0f,  SEA_LEVEL*MAX_HEIGHT, 512.0f);
                gl.glEnd();
                gl.glDisable(GL.GL_TEXTURE_2D);
		
		gl.glCallList(terrain);
However, what I am getting is a texture that spins with the view of the camera, not to mentiont the "reflection" isn't exactly corrent to begin with... What am I missing? Thank you in advance. [Edited by - Isolier on October 7, 2005 2:55:47 PM]

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!