PDA

View Full Version : A Problem with glBindTexture



nickcartwright
10-05-2003, 07:25 AM
Hiya,

Im just dabbling with textures for a Uni project. I am trying to place them in video memory and refrence them with an integer.

I understand that I need to use glBindTexture for this - however, I get an 'unidentified identifire 'glBindTexture' error when I try and use it.

Am I being totally stupid here?

I think I am using openGL 1.1 or greater, how can I verify this?

Thanks!

EDIT: I just read another thread and i think the reason for my problems are because i'm using Delphi 7. Anyone know how I can resolve the problem?

[This message has been edited by nickcartwright (edited 10-05-2003).]

Mihail121
10-05-2003, 09:18 AM
Make sure you register a valid texture identification integer(the reference) by calling glGenTextures and make sure that the generated ID is different than 0. Here is a sample code:

GLuint myID;

glGenTextures(1,&myID);
if(myID == 0) return false;

// Now you can safely bind

glBindTexture(GL_TEXTURE_(1/2/3)D,myID);

nickcartwright
10-05-2003, 09:32 AM
Thanks, I think that was a potential problem... but Delphi doesn't like glGenTextures either.

I'v been doing a bit of research and I think Delphi doesn't actually include these routines.

Does anyone know of a good library I can use to replace my current openGL Libs?

Mazy
10-05-2003, 10:19 PM
delphis 'opengl' unit should have all that.. it seems like you havent even created a opengl render context, becourse those functions should be in that unit as awell.

nickcartwright
10-05-2003, 10:48 PM
All I do is stick openGL in the uses clause..

Should I need to do anything else?

PanzerSchreck
10-06-2003, 01:44 AM
The opengl.pas that comes with Delphi isn't that good,as some things are declared wrong and some functions are missing.
But I'm working in a OpenGL2-Port-Team for delphi and we've released an OpenGL1.5-Header here (http://www.delphigl.com/forum/viewtopic.php?t=1863) which should work much better than the one that comes with delphi.

nickcartwright
10-06-2003, 06:09 AM
Thankyou!

I'v just downloaded it and replaced all my unit uses clases from

uses openGL

to

uses dglOpenGL

and it compiles, But I get an Access Violation error at address 00000000 and my project won't work.

Does dglOpenGL require a different initalisation to the normal Delphi openGL headder?

PanzerSchreck
10-06-2003, 06:30 AM
Yes,sorry that I forget to tell that.You'll have to call the function InitOpenGL before you can use the OpenGL-functions in that unit.
The rest of it is like Mike Lischke's OpenGL12.pas.So to init your program and get a valid rendercontext you'll have to do something like this :


var
DC : HDC;
RC : HGLRC;
...
procedure TGLForm.Init;
begin
InitOpenGL;
DC := GetDC(Handle);
RC := CreateRenderingContext(DC, [opDoubleBuffered], 32, 24, 0, 0, 0, 0);
...
end;

nickcartwright
10-06-2003, 06:55 AM
That works like a dream!

Thanks everyone for their help on this Thread. Much appreciated!

Nick.