| |
|
|
- Page 1 - |
|
Andreas Koch | Hello together,
a short question about opengl and xpse: there a Possibility, a ogl("xyz",...) commands in a nproc incorporate? Konkret goes it around the commands oGL("TestMouse", X, Y, Z), or @oGL("TestXY", X, Y, Z, SX, SY). The Testmodus of opengl not working always so dolle what about me try on the lane, it To bypass.
lovely Greeting
Andreas cook |
|
|
| |
|
|
|
| |
|
- Page 1 - |
|
Andreas Koch | my first attempt was too, a OpenGL-API Substitute for the two obigen functions to find, what not so integrally successful was. therefore vermutete so did i, that a whole row of command behind it stick, The in XProfan to a function zusammengefügt get. around the Api-command take after and directly utilize to, should I but know, as hot. therefore my question, what behind oGL("TestMouse", X, Y, Z), or @oGL("TestXY", X, Y, Z, SX, SY)) stick.
PS: wiki.delphigl.com has me yet with opengl always weitergebracht. |
|
|
| |
|
|
|
RGH | here you are: The Original-code in Delphi:
procedure fnOGLTestMouse;
{-----------------------}
var x, y, z: double;
ix, iy: longint;
fx, fy, fz: double;
modelview: aray[1 .. 16] of double;
projection: aray[1 .. 16] of double;
viewport: aray[1 .. 4] of longint;
R: TRect;
Begin
if oGLWnd = 0 Then FehlerNr(400,'');
GetClientRect(oGLWnd,R);
LesePara(ParStack,',',0);
x := RPar.Dbl;
LesePara(ParStack,',',0);
y := RPar.Dbl;
LesePara(ParStack,')',0);
z := RPar.Dbl;
glGetDoublev(GL_MODELVIEW_MATRIX, @modelView);
glGetDoublev(GL_PROJECTION_MATRIX, @projection);
glGetIntegerv(GL_VIEWPORT, @viewPort);
gluProject(x, y, z, @modelView, @projection, @viewPort, fx, fy, fz);
ix := sqr(round(fx) - Mausx);
iy := sqr((R.Bottom - round(fy)) - Mausy);
If (ix + iy) > 0 then RPar.Lng := round(sqrt(ix + iy)) else RPar.Lng := 0;
RPar.type := 2;
Found := True;
End;
procedure fnOGLTestXY;
{--------------------}
var x, y, z: double;
ix, iy: longint;
dx, dy: longint;
fx, fy, fz: double;
modelview: aray[1 .. 16] of double;
projection: aray[1 .. 16] of double;
viewport: aray[1 .. 4] of longint;
R: TRect;
Begin
if oGLWnd = 0 Then FehlerNr(400,'');
GetClientRect(oGLWnd,R);
LesePara(ParStack,',',0);
x := RPar.Dbl;
LesePara(ParStack,',',0);
y := RPar.Dbl;
LesePara(ParStack,',',0);
z := RPar.Dbl;
LesePara(ParStack,',',0);
dx := RPar.Lng;
LesePara(ParStack,')',0);
dy := RPar.Lng;
glGetDoublev(GL_MODELVIEW_MATRIX, @modelView);
glGetDoublev(GL_PROJECTION_MATRIX, @projection);
glGetIntegerv(GL_VIEWPORT, @viewPort);
gluProject(x, y, z, @modelView, @projection, @viewPort, fx, fy, fz);
ix := sqr(round(fx) - dx);
iy := sqr((R.Bottom - round(fy)) - dy);
If (ix + iy) > 0 then RPar.Lng := round(sqrt(ix + iy)) else RPar.Lng := 0;
RPar.type := 2;
Found := True;
End;
(there Forum only XProfan-code correctly. format can, see it something strange from. with would it rather, it were one Tga, the The Formatierung so can, How I tappt im dunkeln mühevoll arranged have.)
some Notes: LesePara list whom next Parameter the Programmzeile. the Result becomes in both functions in RPar.Lng (Long-Integer) zurückgeliefert.Error 400 besagt, that OGL not initialized watts and it accordingly no OGL-Window gives.
Greeting Roland |
|
|
| Intel Duo E8400 3,0 GHz / 4 GB RAM / 1000 GB HDD - ATI Radeon HD 4770 512 MB - Windows 7 Home Premium 32Bit - XProfan X4 | 01/14/13 ▲ |
|
|
|
|
Andreas Koch | thanks for Help, i think, on it can I me langhangeln.
lovely Greeting
Andreas |
|
|
| |
|
|
|
RGH | helpful Perhaps too yet OGLStartTest and OGLEndTest:
procedure oGLStartTest(mx, my, dx, dy: integer);
{---------------------------------------------}
var
viewport: aray[1 .. 4] of longint;
wh: double;
R: TRect;
width, height: integer;
begin
// net curtain our Viewport
glGetIntegerv(GL_VIEWPORT, @viewport);
// Tell OpenGL the size of our select buffer
glSelectBuffer(512, @SelectBuffer);
// Change our render fashion to GL_SELECT
glRenderMode(GL_SELECT);
// Init the namestack
glInitNames;
glPushName(0);
glMatrixMode(GL_PROJECTION);
glPushMatrix;
glLoadIdentity;
// Zoom the view to dx/dy pixel around the mouse position
gluPickMatrix(mx, viewport[4]-my, dx, dy, @viewport);
GetClientRect(oGLWnd,R);
Height := R.Bottom;
Width := R.Right;
if (Height = 0) then Height := 1;
if OGLwh <= 0 then wh := Width/Height else wh := OGLwh;
gluPerspective(45.0, wh, 0.1, oGLDepth);
End;
function oGLEndTest:longint;
{--------------------------}
var
Hits, Hit, i : Integer;
HitZValue : GLUInt;
begin
glMatrixMode(GL_PROJECTION);
glPopMatrix;
// Now net curtain the number of hits in Hits
Hits := glRenderMode(GL_RENDER);
// Now we look which hit has the lowest Z-Value i.e. what in front
Hit := -1;
HitZValue := High(GLUInt);
for i := 0 to Hits-1 do
if SelectBuffer[(i*4)+1] < HitZValue then
begin
Hit := SelectBuffer[(i*4)+3];
HitZValue := SelectBuffer[(i*4)+1];
end;
Result := Hit;
end; |
|
|
| XProfan X2Intel Duo E8400 3,0 GHz / 4 GB RAM / 1000 GB HDD - ATI Radeon HD 4770 512 MB - Windows 7 Home Premium 32Bit - XProfan X4 | 01/14/13 ▲ |
|
|
|
|
| [offtopic] RGH (14.01.13)(there Forum only XProfan-code correctly. format can, see it something strange from. with would it rather, it were one Tga, the The Formatierung so can, How I tappt im dunkeln mühevoll arranged have.)
have your Postings dahingehend fix machine. will be simply one 2. code-day for to introduce. [/offtopic] |
|
|
| |
|
|
|
| Andreas cook (14.01.13)
first once thanks for response. Sorry, I have the Topic now 2time tuned. (I had not More found.)
Jojo, no Streß.
gives too a Forenübergreifende Overview current Topics: [...] can your Topic simply too self delete, simply under rights with Topic-Options. |
|
|
| |
|
|
|
Andreas Koch | another kurzer Nachtrag,
on the Page of Uwe Pascal Niemeyer [...] there a zipper-File (opengl2004.zipper), where itself a great many Examples to Programming with opengl find. so far I the survey can, becomes thereby on ogl("xyz",...) command gänzlich waived. I suspect, The Codes come from of/ one Time before openGl in XProfan eingebunden was. tappt im dunkeln functions but yet tadellos. there was too an example thereby, the The Original-Delphi Codes of RGH in the integral abbildet. all, The with opengl to do having, can I these Examples only recommend.
lovely Greeting
Andreas cook |
|
|
| |
|
|
|
| is correct, are super. I had then so one 3D-Snake program and white the one so correctly. complex entourages herzaubern can. |
|
|
| |
|
|
| |
|
- Page 2 - |
|
|
| @Roland: Fehlt in your oGLStartTest to gluPerspective(...) one glMatrixMode(GL_MODELVIEW)? |
|
|
| |
|
|
|
RGH | now, it standing there at least not. I dache, it should there neither stand. but I can it Yes time install. you have same mail!
Greeting Roland |
|
|
| XProfan X2Intel Duo E8400 3,0 GHz / 4 GB RAM / 1000 GB HDD - ATI Radeon HD 4770 512 MB - Windows 7 Home Premium 32Bit - XProfan X4 | 01/22/13 ▲ |
|
|
|
|
| |
|
| |
|
|
|
| RGH (22.01.13)
. you have same mail!
Greeting Roland
No Änderung!
crashes likewise on the 3 of 3 Computern ex where The previous Version abstürzte.
on the others 2 Computern where it functions there funktionierts very so as previous Version. |
|
|
| |
|
|