   Reading from 2 textures in vertex shader
  I am trying to implement a Particle System using GLSL. I have run into some troubles rendering the final result of the calculations. An outline of my program is as follows:1: On start of particle system I render the initial positions and velocities to two separate textures using an Frame Buffer Object (FBO) with the two textures attached as render targets.2: I intend to use a Vertex Buffer Object for rendering the Particel System as GL_POINTS. Basically I give an index array to the VBO with consecutive numebers and an array with zeros as positions. When rendering the VBO I use a vertex shader that reads the textures with initial positions and velocities in order to calculate the current position using a uniform variable for the time parameter.The problem is that I cannot get anything to show in my scene. My prime suspition is that I do not get sensible data from the to sampler2D texture look-ups. I have just set one sampler2D to 0 and the other to 1. How can I be sure that I am reading from the correct textures? I would also be thankful for any good pointers or conceptual description of how I should procede to achieve what I want.   
  Are you binding the two textures to two individual texture-units?;Quote:Original post by RasmadrakAre you binding the two textures to two individual texture-units?This is what I have tried. The code for binding the textures prior to rendering the VBO is as follows:glActiveTexture(GL_TEXTURE0);glBindTexture(GL_TEXTURE_2D, v0_p0_fbo_.getRenderTargetId(0));glActiveTexture(GL_TEXTURE1);glBindTexture(GL_TEXTURE_2D, v0_p0_fbo_.getRenderTargetId(1));The shader code lookes like this:uniform float t;// The time since last step.uniform vec4  a;// The acceleration. uniform sampler2D v0_tex;uniform sampler2D p0_tex; void main(){   gl_TexCoord[0].xy = gl_MultiTexCoord0.xy;   gl_Position = gl_ModelViewProjectionMatrix*gl_Vertex;   vec4 v0_val = texture2D(v0_tex, gl_TexCoord[0].st);   vec4 p0_val = texture2D(p0_tex, gl_TexCoord[0].st);    vec4 p = p0_val+v0_val*t+0.5*a*t*t;   p.w = 1.0;   gl_Position = gl_Vertex+gl_ModelViewProjectionMatrix*p;   gl_FrontColor = gl_Color;}   ;  You are writing to gl_Position twice.Also, it depends if you are using mipmapping or nothttp://www.opengl.org/wiki/Common_Mistakes#Creating_a_Textureand for VTFhttp://www.opengl.org/wiki/Vertex_Texture_Fetch;  You also need to tell GLSL what texture unit relates to what sampler by using the glUniform*() commands.   ;Quote:Original post by V-manYou are writing to gl_Position twice.Also, it depends if you are using mipmapping or nothttp://www.opengl.org/wiki/Common_Mistakes#Creating_a_Textureand for VTFhttp://www.opengl.org/wiki/Vertex_Texture_FetchThanks, I am looking at those articles you pointed out, but have not had any luck yet.   ;  Can't you make a test program to make sure the values you receive from the texture is correct?   ;Quote:Original post by V-manCan't you make a test program to make sure the values you receive from the texture is correct?Yes, I am in the process of doing just that. I was using gDEBugger for debuging, but the license has now expired and I am not about to renew just before summer :)