Archived

This topic is now archived and is closed to further replies.

klaasbram

opening a OpenGL window in Delphi 5

Recommended Posts

I want to know if it is possible to open a OpenGL from a allready running program (sort of pop-up window like the window that winamp can create while playing music) (see next question only if the first qeustion can be done) For school I + somebody else must make a slotmachine and I want to give it a OpenGL infobox (no problem so far) The problem is the teacher (where I must send the source) don''t want the executable but only the source and the normally about 20kb but with the pictures from the slotmachine this is about 60kb Because I want the program to have a OpenGl window you need the glAux.dll and that''s 1.32MB, is this dll really needed?? (the teacher uses Windows 2000 and Delphi 5 enterprise)

Share this post


Link to post
Share on other sites
I am sure that Windows 2000 ships with OpenGL,
so you should not have any problems there.

to popup a new OpenGL window you would use some code like this.

auxInitDisplayMode(AUX_SINGLE | AUX_RGBA); // type of window
auxInitPosition(0,0,100,100); // Position and size of window
auxInitWindow("This is the title"); // title of the window.


That will create a popup window, you will need to do the rest. If you want a double buffer, use AUX_DOUBLE, instead of AUX_SINGLE.

I hope this helped.

Share this post


Link to post
Share on other sites
Sory about that,
I did not notice the Delphi 5 part of the title,
I should really pay more attention,
All that was for C++.
But you might be able to convert it.

Sorry about that.

Share this post


Link to post
Share on other sites
No, additional libraries are not required. I make all of my demos and applications explicitly to avoid GLaux and GLUT. It''s pretty easy, you just have to supply a context for OpenGL to use and ensure that things like resizing and perspecive are accounted for.

I have several Delphi OpenGL tutorials, all made in D5, online at http://www.magnumstudios.com. If you look at GLDisplay.pas, which weighs in at 17kb, you will see what functions are required for creating the context. The calls in this unit are what most users call in GLaux to create a window, only not nearly as advanced. (I was shooting for simplicity)

GLDisplay

Jason

Share this post


Link to post
Share on other sites
hi,
hmm my copy of win2k didn''t have glaux.dll with it.

Opening a opengl window in delphi is very neat and easy. You must try the TOpenGl component available at www.opengl.com (after it redirects itself to the main page).

Though i personally avoid usign gluax, but still in case u wanna use it, why not include a readme.txt with the code that tell the person to download the "opengl standard sdk" from the official site first. This is something much like what all the crappy Visual Basic programs tend to do tell before installing for the runtime dlls they require...

cyanide.

Share this post


Link to post
Share on other sites
Hoho,
did you find an answer, Klassbram ?
If not here''s how to do it :

procedure WndProc(var message,wparam,lparam ... );
begin
If you want :
Case message of
WM_CLOSE : ...
WM_RESIZE : OpenGLWindowResize;
...
end;
DefWindowProc(message,wparam,lparam);
end;


var
wc : TWndClass;

begin
wc.fdfs
wc.fsdds
wc.messagehandler := @WndProc;
wc.name := ''Opengl'';
...
RegisterWindowClass(wc);

CreateWindow(''OpenGL'',
640,
480,
''Klaasbrams xy''
...'');

Share this post


Link to post
Share on other sites