I'm trying to do a texture generator using OpenGl.
The thing I can't seem to get right, is manipulating the pData in gluBuild2DMipmaps which I use to build a bitmap of the generated texture.
I tried using some code I found here on DGDev to do the noise, but this
was rather unsuccesfull since the code uses scanline.
Currently, it throws me an access violation. (of course, even I can see that
it wont work)

So I have a procedure to do the bitmap building of the data pointer, but
have no idea how to get the data pointer right.

[pascal]
type
TRGBArray = array[0..MAXPIXELS - 1] of TRGBTriple;
pRGBArray = ^TRGBArray;

type
TGeneratedTexture=class
private
public
pTextureData: pointer;
Texture: glUint;
procedure GenerateTexture;
procedure AddNoise(R,G,B: byte);
procedure AssignData(Data: pointer);
procedure GetColor(Color: byte);
procedure Bind;
end;

procedure TGeneratedTexture.AddNoise(R,G,B: byte);
var
pData: pRGBArray;
J,I: integer;
begin
for J := 0 to TEXHEIGHT - 1 do
begin
for I := 0 to TEXWIDTH - 1 do
begin
pData[I].rgbtRed:=Random(R);
pData[I].rgbtGreen:=Random(G);
pData[I].rgbtBlue:=Random(B);
end;
pTextureData:=pData;
GenerateTexture;
end;
end;

procedure TGeneratedTexture.GenerateTexture;
begin
glGenTextures(1, Texture);
glBindTexture(GL_TEXTURE_2D, Texture);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, TEXWIDTH, TEXHeight, GL_RGB, GL_UNSIGNED_BYTE, pTextureData);
end;
[/pascal]