View Full Version : Can I modified the Texture Data??

03-30-2006, 07:57 AM
first , I used the

glBindTexture(GL_TEXTURE_1D, textureID);
glTexImage1D(GL_TEXTURE_1D, 0,3, texImageWidth,
0, 3, GL_FLOAT, NULL);

to copy Null data to GPU Memery, and then in a vertex shader I compute a positon (xpos,ypos,zpos ) , I plan to fill this point into textureID following ruler :xpos->Red,ypos->Green,zpos->Blue

In a word, I creat a NULL Texture data ,and fill some space coordinate into it in a vertex shader.

the reason is that , I do all in a vertex shader , It will accelerate the render speed if I have a great deal of triangle face to render ?

Can I do it ??
I search the Orange book ,but can not find answer?
who can give me somme idea ? No matter the idear is badly or wonderful? May be this idea is stupid???

03-30-2006, 10:27 AM
You cannot write into a texture directly from the vertex or fragment shader.

What you can do is bind your texture as the color buffer of a framebuffer object, then render your data into it, computing your position in the fragment shader.