Original Post
I whant to learn... my first prg...
A simple bitmapped quad...
But it display only a white quad... where''s the problem???
Here''s my little program...
----------------------------
function DrawGLScene():bool; // Here''s Where We Do All The Drawing
var
prova: GLuint;
begin
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
glLoadIdentity(); // Reset The View
prova:=LoadGLTexture(''sfondo.bmp''); //this bitmap exist!!!!
glTranslatef(-1.5,0.0,-6.0);
glDisable(GL_DEPTH_TEST);
glBindTexture(GL_TEXTURE_2D, prova); // sfondo
glBegin(GL_QUADS);
glNormal3f(-2.0, 0.0, 0.0);
glTexCoord2f(0.0, 0.0); glVertex3f(-3.0, -3.0, -3.0);
glTexCoord2f(3.0, 0.0); glVertex3f(-3.0, 3.0, -3.0);
glTexCoord2f(3.0, 3.0); glVertex3f( 3.0, 3.0, -3.0); //1
glTexCoord2f(0.0, 3.0); glVertex3f( 3.0, -3.0, -3.0);
glEnd();
DrawGLScene:=true; // Everything Went OK
end;
Here are my functions:
---------------------
function LoadBMP(Filename : string) : PTAUX_RGBImageRec;
begin
if Filename = '''' then // Make Sure A Filename Was Given
begin
result := nil; // If Not Return NULL
exit;
end;
if fileexists(FileName) then // Does The File Exist?
begin
result := auxDIBImageLoadA(pchar(Filename)); // Load The Bitmap And Return A Pointer
exit;
end;
loadBMP := nil; // If Load Failed Return NULL
end;
function LoadGLTexture(Filename : string) : GLuint;
var
texture1: PTAUX_RGBImageRec;
texture: GLuint;
begin
texture1 := LoadBMP(PChar(Filename));
glGenTextures(1, texture);
glBindTexture(GL_TEXTURE_2D, texture);
glTexImage2D(GL_TEXTURE_2D, 0, 3, texture1.sizeX, texture1.sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, texture1.data);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
result := texture;
end;