PDA

View Full Version : works on ati but not on nvdidia?



th0r1000
08-20-2007, 03:16 AM
Hi there,

I am writing a program using shaders but with the code listed below it works only on my ati no other machines. I am sure this piece of code is where the problem is. If anyone can point me in the right direction it would be appreciated

glActiveTextureARB(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D,MainTex);


for k := NUMLAYERS-1 downto 0 do
for j := 0 to Y-1 do
for i := 0 to X-1 do
begin
if MyTile[k,i,j].Active then
begin
glUseProgramObjectARBProgramObject);
glActiveTextureARB(GL_TEXTURE1_ARB);

PGS := 'normalMap'+#0;
loc2 := glGetUniformLocationARB(ProgramObject,PGLCHARARB(P GS));
glUniform1iARB(loc2,1);

glActiveTextureARB(GL_TEXTURE1_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D,MyTile[k,i,j].pic);

glUniform4fARB(loc3,Light0Pos[0],Light0Pos[1],Light0Pos[2],Light0Pos[3]);

glBegin(GL_QUADS);
glEnd;

glUseProgramObjectARB(0);
glBegin(GL_QUADS);
glEnd;

glDisable(GL_TEXTURE_2D);
end;
end;
end;

Trenki
08-20-2007, 04:25 AM
What exactly does not work? Do you get any gl errors? Have you tried GLintercept or something similar? You do glBegin(GL_QUADS) but don't specify any vertices before you do glEnd()! How is this supposed to draw anything?

th0r1000
08-24-2007, 11:13 AM
On my machine(ATI) I use a bump map shader to put an "engraved" image on a block and the above code works 100%. When I take my program to my work machine(Nvidia) it seems the shader doesnt work at all and only draws black blocks with no base image or engraved image. I omitted the code between the glBegin and end because I thought it would waste space, its just glTexcoords' and glVertexs'. I apologise for not stating my problem clearly enough, your help is appreciated.