Skip to main content
GameDev.net gamedev.net
🔒 Locked

Delphi and openGL problem

Started by Dybbuk Jun 3, 2003 at 3:29 AM 5 replies 1.6k views
Original Post
Dybbuk
Dybbuk
Hello all, For an assignment in my Delphi classes i have to make a Program. I decided to make a little openGL game. But i ran into some trouble. I never combined openGL and delphi before so i used jan horn''s framework and texture loading routine to start with. (http://www.sulaco.co.za/) I bind some textures and draw some stuff, so far so good But now for that problem: When i try to load any textures in an other unit than my main unit the texture won''t load, and my object remain white/gray. I declare all variables in the other unit but it wil still not work. I tough, i''ll try to fix that problem later and coded on. Next i wanted to make a display list and again it didn''t work. When i made an app with only one unit that code worked fine, but when i copy ased it in my project nothing was drawn when i called the list. I guess these problems are related but have no clue what is causing it. Is it a Delphi or openGL related problem? I haven''t got much experience with delphi, but this even stumped my teachers.... If somebody want to review my code, reply and i will email it to you.
Jeffno10
Jeffno10
I use Delphi so will look at your code if you like - are you sure in your ''USES'' statement for the other unit you''re including ALL the relevant files? Are there any differences between the Uses statement in the main form ?

If you want to program Opengl in Delphi I would personally recommend the DOT library from Tom Nuydens (totally free!)

(http://www.delphi3d.net)
Dybbuk
Dybbuk
I use the exact same include statements. But it would be nice if you would take a look at the code. I''ll mail it to you asap
MButchers
MButchers
are you trying to load the textures before opengl has been initialised?

Count_Zero
Count_Zero
when you are loading the textures, are all of your buffers set sufficiently large to allow for the number you are generating?

GLuint textures[n];

AUX_RGBImageRec *TextureImage[n];

glGenTextures(n, &texture[0]);

all these lines need the same number of textures "n". I had exactly the same problem, which took me a while to figure out.
BlueCat
BlueCat
Hi

If you download this from the same site it will make things a lot easier.

Just declare a TGLuint:

mytexture: TGLuint;

"- call the load function. LoadTexture(''images/mytexture.jpg'', myTexture, FALSE);
and then you can bind the texture."

This should work from any unit, good luck


______________________________

DGDev - The Delphi Games Development Community
______________________________DGDev - The Delphi Games Development Community
Dybbuk
Dybbuk
Damn i feel stupid...

I generated diplay lists in de form.create, thus before my rendering context was created. I haven''t had tinme to fix it, but i am sure this is the problem...

Doesn''t it always that the simplest problems are the herdest to find..

Thx for all you replies guys!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.