Вверх ↑
Этот топик читают: Гость
Ответов: 60
Рейтинг: 0
#1: 2020-11-16 17:00:09 ЛС | профиль | цитата
Может кто подсказать, как правильно написать в inline code элемент, который переводит координаты объектов в оконные координаты?

Make(delphi)
ver(4.05 build 186)
Add(MainForm,2953706,273,147)
{
Left=10
Top=10
Width=800
Height=600
Color=12632256
Point(onResize)
Point(Handle)
Point(MouseX)
Point(MouseY)
Point(onMouseMove)
Point(onMouseDown)
Point(onMouseUp)
Point(onMouseWheel)
link(onCreate,4210180:doEvent1,[(373,167)(373,447)])
link(onResize,16240358:doWork1,[(445,174)])
}
Add(GL_Main,12000955,483,441)
{
Color=15780518
TwoSide=0
link(onInit,10666624:doInit,[(569,447)(569,405)])
link(onViewPort,122545:doPerspective,[])
link(Handle,2953706:Handle,[(489,382)(279,382)])
}
Add(HubEx,16240358,441,448)
{
link(onEvent,12000955:doViewPort,[])
}
Add(Hub,4210180,385,441)
{
OutCount=3
link(onEvent1,12000955:doInit,[])
link(onEvent2,16240358:doWork2,[])
link(onEvent3,4672243:doTimer,[(411,461)(411,499)(386,499)(386,524)])
}
Add(GL_GTools,2453505,588,518)
{
Point(doClear)
Point(doPushMatrix)
Point(doPopMatrix)
}
Add(Hub,13876975,448,518)
{
OutCount=5
link(onEvent1,2453505:doClear,[])
link(onEvent2,2453505:doPushMatrix,[])
link(onEvent3,10714674:doWork1,[(522,538)(522,314)])
link(onEvent4,2453505:doPopMatrix,[(561,545)(561,538)])
link(onEvent5,12000955:doFlip,[(472,552)(472,461)])
}
Add(Timer,4672243,392,518)
{
Interval=10
Enable=1
link(onTimer,13876975:doEvent1,[])
}
Add(GL_Perspective,122545,595,448)
{
Aspect=1.78
Fovy=20
}
Add(GL_Light,6579398,854,399)
{
Ambient=-16777215
Diffuse=65280
link(Point,2838183:Point3D,[])
}
Add(GL_GluTools,10666624,595,399)
{
Texture=0
link(onInit,12506858:doEnabled,[])
}
Add(ToolBar,14502848,693,112)
{
Width=784
Height=50
Align=2
Ctl3D=0
Flat=1
Wrapable=1
Buttons=['Сфера'=[ZIP3609000078DAD5954D4B025114866FCBFE41CB162D5A458B106A2124514128044D484264DAC7400995BAE8CB2C2934CD9221F3D74EF738EF81175267B4365D7816DEEB7DCEDC73CE9D492463D3A63F629679CB0C9832B3C102D679F8BE3F16834694B571DC517F4FFAEC7FED374B7653920E9D1A9D9FC8DE551390013AF6895DCB9A19DB6F16F0CCC209D0710E74C89A13BDA67D771A5C12B5010D5206C7D1FC663938AFC9826BA246342D8FA00424C656889FDDAEE501EE57C2835FA9825250A7A1EE39E4DB25B7F24E7884C6AC224FB26F63700CB3883A15C013D181FB8BF030AF31D4EF0CF1AF90FF8272DD217AE4EFD2BC9EB31CE2CFC0CDFE0FA24731BA14E3856264CDF0DA8AFFC07245FDD182BB4BF0199AF00B6721FE24FCD2EF77E46FE139C5F709C4DFA63E2A86F8F5CEE6C82F3C5B1AF06B9EC4FF067F1B3D5C04EB237AD4AE991DCB11EA2CF5BA855FA8C3DF805FB8A73BB81772BFA4C6DBF0BB78CF88BF024F1D35D7783A2F1C86FBFB313683FF993CFCDA4F37A046CE0A727E1AF823BF9B1378F7E6B15F29519C02CDA726F8AEC4912B0735CFC155209CC9DC3FBE332990464CC961FC77DEFFC0374BA472A9],'Координаты'=[ZIP3609000078DAED923B0E8330104427656E9032654EC001E8731A0E40454545938A8A8A8A2B9A016F2403BBC6292251D8D293F0CEF0F896EFE28E7515E4451EC20D4F1F481E2EE75C26737926FEAB93F1BFC632487AE61FD91A0D472C83A429CF30B039EC3CDA6CEBF78DD4F7D4B3DD8B2F3CB6FDBEF5CBB7E878C697B32EF059F9871F9B6697E46ED96CC51B1E1FDD3EB5F61A0D1BCDCEA7CD20D3E335F5F942CDA436EE35CC203BFB9DE979C56965F8C30CB2B3FDF13C93B9123344EA164B]]
link(onClick,6063577:doEvent,[])
}
Add(GL_Point3D,2838183,854,329)
{
X=10
Y=10
Z=10
}
Add(GL_Options,12506858,644,399)
{
Flag=2
link(onEvent,15059546:doEnabled,[])
}
Add(GL_Options,15059546,693,399)
{
Flag=1
link(onEvent,13636378:doEnabled,[])
}
Add(GL_Options,13636378,742,399)
{
link(onEvent,11629760:doEnabled,[])
}
Add(GL_Options,11629760,791,399)
{
Flag=3
link(onEvent,6579398:doEnabled,[])
}
Add(GL_CallList,10231433,742,308)
{
Index=1
}
Add(MultiElement,10714674,581,308)
{
@Hint=#13:Поворот сцены|
link(onEvent1,10036663:doDraw,[])
link(Data1,2953706:MouseX,[(587,269)(286,269)])
link(Data2,2953706:MouseY,[(594,243)(293,243)])
}
BEGIN_SDK
Add(EditMulti,4359962,3,3)
{
EventCount=1
WorkCount=1
DataCount=2
Width=223
Height=109
link(doWork1,3276760:doRotate,[(19,9)(19,55)])
}
Add(GL_Rotate,3276760,35,49)
{
Y=1
link(onRotate,8079493:doRotate,[])
link(Angle,4359962:Data1,[(41,26)(9,26)])
}
Add(GL_Rotate,8079493,112,49)
{
X=1
link(onRotate,4359962:onEvent1,[(189,55)(189,9)])
link(Angle,4359962:Data2,[(118,19)(16,19)])
}
END_SDK
Add(Gl_Axis,10036663,630,308)
{
Length=0.2
TitleScale=0.2
link(onDraw,575588:doTrans,[])
}
Add(ChildForm,1811442,896,112)
{
link(onEvent1,632867:doBeginList,[])
}
BEGIN_SDK
Add(EditMulti,7289067,21,21)
{
EventCount=1
WorkCount=1
VarCount=4
Width=846
Height=662
link(doWork1,11007038:doVisible,[(59,27)(59,111)])
link(Var1,11305281:Result,[(27,410)(384,410)])
link(Var2,14845239:Result,[(34,445)(454,445)])
link(Var3,1832175:Result,[(41,487)(531,487)])
link(Var4,4772517:Result,[(48,609)(559,609)])
}
Add(MainForm,11007038,98,77)
{
Left=35
Top=105
Visible=1
Point(doVisible)
}
Add(Edit,3719246,322,105)
{
Left=45
Top=25
Height=24
Font=[MS Sans Serif,12,0,0,1]
Text="0"
link(onChange,11305281:doOperation,[])
}
Add(Label,14338395,266,112)
{
Left=20
Top=25
Width=15
Height=17
Font=[MS Sans Serif,12,0,0,1]
Caption="x:"
}
Add(Edit,12746354,392,175)
{
Left=135
Top=25
Height=24
Font=[MS Sans Serif,12,0,0,1]
Text="0"
link(onChange,14845239:doOperation,[])
}
Add(Label,10878727,343,175)
{
Left=110
Top=25
Width=15
Height=24
Font=[MS Sans Serif,12,0,0,1]
Caption="y:"
}
Add(Edit,7792038,469,259)
{
Left=235
Top=25
Height=24
Font=[MS Sans Serif,12,0,0,1]
Text="0"
link(onChange,1832175:doOperation,[])
}
Add(Label,7416130,413,259)
{
Left=210
Top=25
Width=16
Height=24
Font=[MS Sans Serif,12,0,0,1]
Caption="z:"
}
Add(Button,4020197,469,448)
{
Left=240
Top=110
Width=80
Height=30
Font=[MS Sans Serif,12,0,0,1]
Caption="Создать"
link(onClick,7289067:onEvent1,[(589,454)(589,27)])
}
Add(Edit,2285558,483,504)
{
Left=45
Top=70
Height=24
Font=[MS Sans Serif,12,0,0,1]
Text="0"
link(onChange,4772517:doOperation,[])
}
Add(Label,3617471,392,518)
{
Left=20
Top=70
Width=20
Height=24
Font=[MS Sans Serif,12,0,0,1]
Caption="R:"
}
Add(Math,1832175,525,259)
{
OpType=3
Op2=1000
}
Add(Math,14845239,448,175)
{
OpType=3
Op2=1000
}
Add(Math,11305281,378,105)
{
OpType=3
Op2=1000
}
Add(Math,4772517,553,504)
{
OpType=3
Op2=1000
}
END_SDK
Add(IndexToChanel,6063577,749,112)
{
link(onEvent1,1811442:doWork1,[])
link(onEvent2,7687885:doWork1,[(867,125)(867,244)])
}
Add(Gl_BeginList,632867,1008,112)
{
Index=1
Mode=1
Point(doDeleteList)
link(onBiginList,2743970:doPushMatrix,[])
}
Add(Gl_EndList,12771157,1393,112)
{
link(onEndList,7687885:doWork2,[(1437,118)(1437,167)(940,167)(940,251)])
}
Add(Gl_Translate,4406422,1127,112)
{
link(onTranslate,12828433:doColor,[])
link(X,398219:Var3,[(1133,72)(1017,72)(1017,198)])
link(Y,3833553:Var3,[(1140,82)(1024,82)(1024,183)])
link(Z,9012244:Var3,[(1147,91)(1031,91)(1031,172)])
}
Add(GL_Sphere,10609890,1260,112)
{
Radius=0.005
Slices=10
Stacks=10
link(onDraw,4079797:doPopMatrix,[])
link(Radius,1811442:Var4,[(1266,100)(1094,100)(1094,156)(923,156)])
}
Add(GL_GTools,2743970,1078,112)
{
Point(doPushMatrix)
link(onEvent,4406422:doTranslate,[])
}
Add(GL_GTools,4079797,1323,112)
{
Point(doPopMatrix)
link(onEvent,12771157:doEndList,[])
}
Add(GL_Color,12828433,1183,112)
{
Color=12632256
link(onColor,10609890:doDraw,[])
}
Add(MultiElementEx,575588,679,308)
{
@Hint=#20:Движение по стрелкам|
link(onTrans,10231433:doCallList,[])
}
BEGIN_SDK
Add(EditMultiEx,3877728,3,3)
{
WorkCount=#7:doTrans|
EventCount=#7:onTrans|
Width=363
Height=242
link(doTrans,5112558:doEvent1,[(15,9)(15,48)])
}
Add(Gl_Translate,2535417,294,203)
{
link(onTranslate,3877728:onTrans,[(345,209)(345,9)])
link(X,7575323:Result,[])
link(Y,8626852:Result,[])
}
Add(Keyboard,16348793,119,42)
{
Key=39
link(onReadKey,14326073:doCase,[])
}
Add(Case,14326073,175,42)
{
Value=Integer(0)
link(onNextCase,16121427:doNext,[])
}
Add(Counter,16121427,238,42)
{
Min=-200
Max=200
link(onNext,7575323:doOperation,[])
}
Add(Keyboard,1433895,119,91)
{
Key=37
link(onReadKey,9907698:doCase,[])
}
Add(Case,9907698,175,91)
{
Value=Integer(0)
link(onNextCase,16121427:doPrev,[(222,97)(222,55)])
}
Add(Math,7575323,294,42)
{
OpType=3
Op2=20
}
Add(Hub,5112558,28,42)
{
OutCount=5
link(onEvent1,16348793:doReadKey,[])
link(onEvent2,1433895:doReadKey,[(108,55)(108,97)])
link(onEvent3,15336481:doReadKey,[(100,62)(100,153)])
link(onEvent4,4395848:doReadKey,[(89,69)(89,202)])
link(onEvent5,2535417:doTranslate,[(72,76)(72,209)])
}
Add(Keyboard,15336481,119,147)
{
Key=38
link(onReadKey,15718529:doCase,[])
}
Add(Case,15718529,175,147)
{
Value=Integer(0)
link(onNextCase,7968343:doNext,[])
}
Add(Counter,7968343,238,147)
{
Min=-200
Max=200
link(onNext,8626852:doOperation,[])
}
Add(Keyboard,4395848,119,196)
{
Key=40
link(onReadKey,13597393:doCase,[])
}
Add(Case,13597393,175,196)
{
Value=Integer(0)
link(onNextCase,7968343:doPrev,[(222,202)(222,160)])
}
Add(Math,8626852,301,147)
{
OpType=3
Op2=20
}
END_SDK
Add(ChildForm,7687885,952,238)
{
link(Data1,398219:Var2,[(958,220)(909,220)])
link(Data2,3833553:Var2,[(965,212)(930,212)])
link(Data3,9012244:Var2,[(972,207)(958,207)])
}
BEGIN_SDK
Add(EditMulti,6317385,21,21)
{
EventCount=1
WorkCount=2
DataCount=3
VarCount=4
Width=783
Height=501
link(doWork1,7245365:doVisible,[(59,27)(59,209)])
link(doWork2,14190198:dogluProject,[(189,34)(189,118)])
}
Add(MainForm,7245365,91,175)
{
Left=35
Top=105
Width=275
Height=197
Visible=1
Point(doVisible)
Point(onShow)
}
Add(Label,904483,266,231)
{
Left=20
Top=55
Width=15
Height=17
Font=[MS Sans Serif,12,0,0,1]
Caption="x:"
}
Add(Label,9884627,343,294)
{
Left=110
Top=55
Width=15
Height=24
Font=[MS Sans Serif,12,0,0,1]
Caption="y:"
}
Add(Label,7037491,357,224)
{
Left=40
Top=55
Font=[MS Sans Serif,12,0,0,1]
Caption=""
AutoSize=1
link(Text,14190198:wx,[])
}
Add(Label,13858049,455,287)
{
Left=135
Top=55
Font=[MS Sans Serif,12,0,0,1]
Caption=""
AutoSize=1
link(Text,14190198:wy,[(461,215)(370,215)])
}
Add(InlineCode,14190198,357,112)
{
WorkPoints=#12:dogluProject|
VarPoints=#2:wx|2:wy|
DataPoints=#2:ox|2:oy|2:oz|
Code=#15:unit HiAsmUnit;|0:|9:interface|0:|28:uses Kol,Share,Debug,OpenGL;|0:|4:type|29: THiAsmClass = class(TDebug)|2: |11: private|33: winx, winy, winz: GLdouble;|6: |10: public|20: ox: THI_Event;|20: oy: THI_Event;|20: oz: THI_Event;|3: |56: procedure dogluProject(var _Data:TData; Index:Word);|46: procedure wx(var _Data:TData; Index:Word);|46: procedure wy(var _Data:TData; Index:Word);|5: end;|0:|14:implementation|0:|0:|64:procedure THiAsmClass.dogluProject(var _Data:TData; Index:Word);|3:var|40: modelmatrix:Array [1..16] of GLdouble;|39: projmatrix:Array [1..16] of GLdouble;|33: viewport:Array [1..4] of GLint;|29: objx, objy, objz: GLdouble;|0:|5:begin|41: glGetintegerv (GL_VIEWPORT, @viewport);|51: glGetdoublev (GL_MODELVIEW_MATRIX, @modelmatrix);|51: glGetdoublev (GL_PROJECTION_MATRIX, @projmatrix);|33: objx := ReadReal(_Data, ox, 0);|33: objy := ReadReal(_Data, oy, 0);|33: objz := ReadReal(_Data, oz, 0);|88: gluProject( objx, objy, objz, modelmatrix, projmatrix, viewport, @winx, @winy, @winz);|4:end;|0:|25:procedure THiAsmClass.wx;|5:begin|25: _Data := _DoData(winx);|4:end;|0:|25:procedure THiAsmClass.wy;|5:begin|25: _Data := _DoData(winy);|4:end;|0:|4:end.|
link(ox,6317385:Data1,[(363,66)(27,66)])
link(oy,6317385:Data2,[(370,51)(34,51)])
link(oz,6317385:Data3,[(377,41)(41,41)])
}
END_SDK
Add(GetDataEx,398219,903,193)
{
Angle=3
link(Data,1811442:Var1,[(902,198)])
}
Add(GetDataEx,3833553,924,178)
{
Angle=3
link(Data,1811442:Var2,[(909,183)])
}
Add(GetDataEx,9012244,952,167)
{
Angle=3
link(Data,1811442:Var3,[(916,172)])
}

карма: 1

0
vip
#1.1контекстная реклама от партнеров
Ответов: 8593
Рейтинг: 795
#2: 2020-11-16 21:14:01 ЛС | профиль | цитата
Gik, посмотрите вот это: https://yadi.sk/d/VBczuvcWLCNM1Q, вдруг поможет
карма: 18

0
Ответов: 1929
Рейтинг: 627
#3: 2020-11-17 08:58:22 ЛС | профиль | цитата
Gik, на форуме МАV выкладывал готовое решение. Воспользуйтесь поиском, наверняка найдёте.
карма: 9

0
Ответов: 60
Рейтинг: 0
#4: 2020-11-17 17:44:46 ЛС | профиль | цитата
У меня пишет ошибку не правильные типы переменных. Ошибка в gluProject. Call by var for arg no. 9 has to match exactly: Got "Pointer" expected "Double".

Редактировалось 1 раз(а), последний 2020-11-17 17:58:18
карма: 1

0
Ответов: 60
Рейтинг: 0
#5: 2020-11-17 19:05:26 ЛС | профиль | цитата
Кажется нашел ошибку, исправил.
В Opengl.pas надо исправить строки 4231,4232:
function gluProject (objx, objy, obyz: GLDouble;modelMatrix: TGLMatrixd4;projMatrix: TGLMatrixd4;viewport: TGLVectori4;var winx, winy, winz: GLDouble): Integer; stdcall; external glu32;
function gluUnProject(winx, winy, winz: GLdouble;modelMatrix: TGLMatrixd4;projMatrix: TGLMatrixd4;viewport: TGLVectori4;var objx, objy, objz: GLdouble): Integer; stdcall; external glu32;
Теперь программа вроде работает
Make(delphi)
ver(4.05 build 186)
Add(MainForm,2953706,273,147)
{
Left=10
Top=10
Width=800
Height=600
Color=12632256
Point(onResize)
Point(Handle)
Point(MouseX)
Point(MouseY)
Point(onMouseMove)
Point(onMouseDown)
Point(onMouseUp)
Point(onMouseWheel)
link(onCreate,4210180:doEvent1,[(373,167)(373,447)])
link(onResize,16240358:doWork1,[(445,174)])
}
Add(GL_Main,12000955,483,441)
{
Color=15780518
TwoSide=0
link(onInit,10666624:doInit,[(569,447)(569,405)])
link(onViewPort,122545:doPerspective,[])
link(Handle,2953706:Handle,[(489,382)(279,382)])
}
Add(HubEx,16240358,441,448)
{
link(onEvent,12000955:doViewPort,[])
}
Add(Hub,4210180,385,441)
{
OutCount=3
link(onEvent1,12000955:doInit,[])
link(onEvent2,16240358:doWork2,[])
link(onEvent3,4672243:doTimer,[(411,461)(411,499)(386,499)(386,524)])
}
Add(GL_GTools,2453505,588,518)
{
Point(doClear)
Point(doPushMatrix)
Point(doPopMatrix)
}
Add(Hub,13876975,448,518)
{
OutCount=5
link(onEvent1,2453505:doClear,[])
link(onEvent2,2453505:doPushMatrix,[])
link(onEvent3,10714674:doWork1,[(522,538)(522,314)])
link(onEvent4,2453505:doPopMatrix,[(561,545)(561,538)])
link(onEvent5,12000955:doFlip,[(472,552)(472,461)])
}
Add(Timer,4672243,392,518)
{
Interval=10
Enable=1
link(onTimer,13876975:doEvent1,[])
}
Add(GL_Perspective,122545,595,448)
{
Aspect=1.78
Fovy=20
}
Add(GL_Light,6579398,854,399)
{
Ambient=-16777215
Diffuse=65280
link(Point,2838183:Point3D,[])
}
Add(GL_GluTools,10666624,595,399)
{
Texture=0
link(onInit,12506858:doEnabled,[])
}
Add(ToolBar,14502848,693,112)
{
Width=784
Height=50
Align=2
Ctl3D=0
Flat=1
Wrapable=1
Buttons=['Сфера'=[ZIP3609000078DAD5954D4B025114866FCBFE41CB162D5A458B106A2124514128044D484264DAC7400995BAE8CB2C2934CD9221F3D74EF738EF81175267B4365D7816DEEB7DCEDC73CE9D492463D3A63F629679CB0C9832B3C102D679F8BE3F16834694B571DC517F4FFAEC7FED374B7653920E9D1A9D9FC8DE551390013AF6895DCB9A19DB6F16F0CCC209D0710E74C89A13BDA67D771A5C12B5010D5206C7D1FC663938AFC9826BA246342D8FA00424C656889FDDAEE501EE57C2835FA9825250A7A1EE39E4DB25B7F24E7884C6AC224FB26F63700CB3883A15C013D181FB8BF030AF31D4EF0CF1AF90FF8272DD217AE4EFD2BC9EB31CE2CFC0CDFE0FA24731BA14E3856264CDF0DA8AFFC07245FDD182BB4BF0199AF00B6721FE24FCD2EF77E46FE139C5F709C4DFA63E2A86F8F5CEE6C82F3C5B1AF06B9EC4FF067F1B3D5C04EB237AD4AE991DCB11EA2CF5BA855FA8C3DF805FB8A73BB81772BFA4C6DBF0BB78CF88BF024F1D35D7783A2F1C86FBFB313683FF993CFCDA4F37A046CE0A727E1AF823BF9B1378F7E6B15F29519C02CDA726F8AEC4912B0735CFC155209CC9DC3FBE332990464CC961FC77DEFFC0374BA472A9],'Координаты'=[ZIP3609000078DAED923B0E8330104427656E9032654EC001E8731A0E40454545938A8A8A8A2B9A016F2403BBC6292251D8D293F0CEF0F896EFE28E7515E4451EC20D4F1F481E2EE75C26737926FEAB93F1BFC632487AE61FD91A0D472C83A429CF30B039EC3CDA6CEBF78DD4F7D4B3DD8B2F3CB6FDBEF5CBB7E878C697B32EF059F9871F9B6697E46ED96CC51B1E1FDD3EB5F61A0D1BCDCEA7CD20D3E335F5F942CDA436EE35CC203BFB9DE979C56965F8C30CB2B3FDF13C93B9123344EA164B]]
link(onClick,6063577:doEvent,[])
}
Add(GL_Point3D,2838183,854,329)
{
X=10
Y=10
Z=10
}
Add(GL_Options,12506858,644,399)
{
Flag=2
link(onEvent,15059546:doEnabled,[])
}
Add(GL_Options,15059546,693,399)
{
Flag=1
link(onEvent,13636378:doEnabled,[])
}
Add(GL_Options,13636378,742,399)
{
link(onEvent,11629760:doEnabled,[])
}
Add(GL_Options,11629760,791,399)
{
Flag=3
link(onEvent,6579398:doEnabled,[])
}
Add(GL_CallList,10231433,742,308)
{
Index=1
link(onCallList,7687885:doWork2,[(863,314)(863,251)])
}
Add(MultiElement,10714674,581,308)
{
@Hint=#13:Поворот сцены|
link(onEvent1,10036663:doDraw,[])
link(Data1,2953706:MouseX,[(587,269)(286,269)])
link(Data2,2953706:MouseY,[(594,243)(293,243)])
}
BEGIN_SDK
Add(EditMulti,4359962,3,3)
{
EventCount=1
WorkCount=1
DataCount=2
Width=223
Height=109
link(doWork1,3276760:doRotate,[(19,9)(19,55)])
}
Add(GL_Rotate,3276760,35,49)
{
Y=1
link(onRotate,8079493:doRotate,[])
link(Angle,4359962:Data1,[(41,26)(9,26)])
}
Add(GL_Rotate,8079493,112,49)
{
X=1
link(onRotate,4359962:onEvent1,[(189,55)(189,9)])
link(Angle,4359962:Data2,[(118,19)(16,19)])
}
END_SDK
Add(Gl_Axis,10036663,630,308)
{
Length=0.2
TitleScale=0.2
link(onDraw,575588:doTrans,[])
}
Add(ChildForm,1811442,896,112)
{
link(onEvent1,632867:doBeginList,[])
}
BEGIN_SDK
Add(EditMulti,7289067,21,21)
{
EventCount=1
WorkCount=1
VarCount=4
Width=846
Height=662
link(doWork1,11007038:doVisible,[(59,27)(59,111)])
link(Var1,11305281:Result,[(27,410)(384,410)])
link(Var2,14845239:Result,[(34,445)(454,445)])
link(Var3,1832175:Result,[(41,487)(531,487)])
link(Var4,4772517:Result,[(48,609)(559,609)])
}
Add(MainForm,11007038,98,77)
{
Left=35
Top=105
Visible=1
Point(doVisible)
}
Add(Edit,3719246,322,105)
{
Left=45
Top=25
Height=24
Font=[MS Sans Serif,12,0,0,1]
Text="0"
link(onChange,11305281:doOperation,[])
}
Add(Label,14338395,266,112)
{
Left=20
Top=25
Width=15
Height=17
Font=[MS Sans Serif,12,0,0,1]
Caption="x:"
}
Add(Edit,12746354,392,175)
{
Left=135
Top=25
Height=24
Font=[MS Sans Serif,12,0,0,1]
Text="0"
link(onChange,14845239:doOperation,[])
}
Add(Label,10878727,343,175)
{
Left=110
Top=25
Width=15
Height=24
Font=[MS Sans Serif,12,0,0,1]
Caption="y:"
}
Add(Edit,7792038,469,259)
{
Left=235
Top=25
Height=24
Font=[MS Sans Serif,12,0,0,1]
Text="0"
link(onChange,1832175:doOperation,[])
}
Add(Label,7416130,413,259)
{
Left=210
Top=25
Width=16
Height=24
Font=[MS Sans Serif,12,0,0,1]
Caption="z:"
}
Add(Button,4020197,469,448)
{
Left=240
Top=110
Width=80
Height=30
Font=[MS Sans Serif,12,0,0,1]
Caption="Создать"
link(onClick,7289067:onEvent1,[(589,454)(589,27)])
}
Add(Edit,2285558,483,504)
{
Left=45
Top=70
Height=24
Font=[MS Sans Serif,12,0,0,1]
Text="0"
link(onChange,4772517:doOperation,[])
}
Add(Label,3617471,392,518)
{
Left=20
Top=70
Width=20
Height=24
Font=[MS Sans Serif,12,0,0,1]
Caption="R:"
}
Add(Math,1832175,525,259)
{
OpType=3
Op2=1000
}
Add(Math,14845239,448,175)
{
OpType=3
Op2=1000
}
Add(Math,11305281,378,105)
{
OpType=3
Op2=1000
}
Add(Math,4772517,553,504)
{
OpType=3
Op2=1000
}
END_SDK
Add(IndexToChanel,6063577,749,112)
{
link(onEvent1,1811442:doWork1,[])
link(onEvent2,7687885:doWork1,[(867,125)(867,244)])
}
Add(Gl_BeginList,632867,1008,112)
{
Index=1
Mode=1
Point(doDeleteList)
link(onBiginList,2743970:doPushMatrix,[])
}
Add(Gl_EndList,12771157,1393,112)
{
}
Add(Gl_Translate,4406422,1127,112)
{
link(onTranslate,12828433:doColor,[])
link(X,398219:Var3,[(1133,72)(1017,72)(1017,198)])
link(Y,3833553:Var3,[(1140,82)(1024,82)(1024,183)])
link(Z,9012244:Var3,[(1147,91)(1031,91)(1031,172)])
}
Add(GL_Sphere,10609890,1260,112)
{
Radius=0.005
Slices=10
Stacks=10
link(onDraw,4079797:doPopMatrix,[])
link(Radius,1811442:Var4,[(1266,100)(1094,100)(1094,156)(923,156)])
}
Add(GL_GTools,2743970,1078,112)
{
Point(doPushMatrix)
link(onEvent,4406422:doTranslate,[])
}
Add(GL_GTools,4079797,1323,112)
{
Point(doPopMatrix)
link(onEvent,12771157:doEndList,[])
}
Add(GL_Color,12828433,1183,112)
{
Color=12632256
link(onColor,10609890:doDraw,[])
}
Add(MultiElementEx,575588,679,308)
{
@Hint=#20:Движение по стрелкам|
link(onTrans,10231433:doCallList,[])
}
BEGIN_SDK
Add(EditMultiEx,3877728,3,3)
{
WorkCount=#7:doTrans|
EventCount=#7:onTrans|
Width=363
Height=242
link(doTrans,5112558:doEvent1,[(15,9)(15,48)])
}
Add(Gl_Translate,2535417,294,203)
{
link(onTranslate,3877728:onTrans,[(345,209)(345,9)])
link(X,7575323:Result,[])
link(Y,8626852:Result,[])
}
Add(Keyboard,16348793,119,42)
{
Key=39
link(onReadKey,14326073:doCase,[])
}
Add(Case,14326073,175,42)
{
Value=Integer(0)
link(onNextCase,16121427:doNext,[])
}
Add(Counter,16121427,238,42)
{
Min=-200
Max=200
link(onNext,7575323:doOperation,[])
}
Add(Keyboard,1433895,119,91)
{
Key=37
link(onReadKey,9907698:doCase,[])
}
Add(Case,9907698,175,91)
{
Value=Integer(0)
link(onNextCase,16121427:doPrev,[(222,97)(222,55)])
}
Add(Math,7575323,294,42)
{
OpType=3
Op2=20
}
Add(Hub,5112558,28,42)
{
OutCount=5
link(onEvent1,16348793:doReadKey,[])
link(onEvent2,1433895:doReadKey,[(108,55)(108,97)])
link(onEvent3,15336481:doReadKey,[(100,62)(100,153)])
link(onEvent4,4395848:doReadKey,[(89,69)(89,202)])
link(onEvent5,2535417:doTranslate,[(72,76)(72,209)])
}
Add(Keyboard,15336481,119,147)
{
Key=38
link(onReadKey,15718529:doCase,[])
}
Add(Case,15718529,175,147)
{
Value=Integer(0)
link(onNextCase,7968343:doNext,[])
}
Add(Counter,7968343,238,147)
{
Min=-200
Max=200
link(onNext,8626852:doOperation,[])
}
Add(Keyboard,4395848,119,196)
{
Key=40
link(onReadKey,13597393:doCase,[])
}
Add(Case,13597393,175,196)
{
Value=Integer(0)
link(onNextCase,7968343:doPrev,[(222,202)(222,160)])
}
Add(Math,8626852,301,147)
{
OpType=3
Op2=20
}
END_SDK
Add(ChildForm,7687885,952,238)
{
link(Data1,398219:Var2,[(958,220)(909,220)])
link(Data2,3833553:Var2,[(965,212)(930,212)])
link(Data3,9012244:Var2,[(972,207)(958,207)])
}
BEGIN_SDK
Add(EditMulti,6317385,21,21)
{
EventCount=1
WorkCount=2
DataCount=3
VarCount=4
Width=783
Height=501
link(doWork1,7245365:doVisible,[(59,27)(59,209)])
link(doWork2,12301254:doEvent1,[(189,34)(189,118)])
}
Add(MainForm,7245365,91,175)
{
Left=35
Top=105
Width=275
Height=197
Visible=1
Point(doVisible)
Point(onShow)
}
Add(Label,904483,266,231)
{
Left=20
Top=55
Width=15
Height=17
Font=[MS Sans Serif,12,0,0,1]
Caption="x:"
}
Add(Label,9884627,343,294)
{
Left=110
Top=55
Width=15
Height=24
Font=[MS Sans Serif,12,0,0,1]
Caption="y:"
}
Add(Label,7037491,357,224)
{
Left=40
Top=55
Height=24
Font=[MS Sans Serif,12,0,0,1]
Caption=""
AutoSize=1
link(Text,14190198:wx,[])
}
Add(Label,13858049,455,287)
{
Left=135
Top=55
Height=24
Font=[MS Sans Serif,12,0,0,1]
Caption=""
AutoSize=1
link(Text,14190198:wy,[(461,215)(370,215)])
}
Add(InlineCode,14190198,357,112)
{
WorkPoints=#12:dogluProject|
VarPoints=#2:wx|2:wy|
DataPoints=#2:ox|2:oy|2:oz|
Code=#15:unit HiAsmUnit;|0:|9:interface|0:|28:uses Kol,Share,Debug,OpenGL;|0:|4:type|29: THiAsmClass = class(TDebug)|2: |11: private|33: winx, winy, winz: GLdouble;|6: |10: public|20: ox: THI_Event;|20: oy: THI_Event;|20: oz: THI_Event;|3: |56: procedure dogluProject(var _Data:TData; Index:Word);|46: procedure wx(var _Data:TData; Index:Word);|46: procedure wy(var _Data:TData; Index:Word);|5: end;|0:|14:implementation|0:|0:|64:procedure THiAsmClass.dogluProject(var _Data:TData; Index:Word);|3:var|27: modelmatrix: TGLMatrixd4;|26: projmatrix: TGLMatrixd4;|24: viewport: TGLVectori4;|29: objx, objy, objz: GLdouble;|0:|5:begin|41: glGetintegerv (GL_VIEWPORT, @viewport);|51: glGetdoublev (GL_MODELVIEW_MATRIX, @modelmatrix);|51: glGetdoublev (GL_PROJECTION_MATRIX, @projmatrix);|33: objx := ReadReal(_Data, ox, 0);|33: objy := ReadReal(_Data, oy, 0);|33: objz := ReadReal(_Data, oz, 0);|85: gluProject( objx, objy, objz, modelmatrix, projmatrix, viewport, winx, winy, winz);|4:end;|0:|25:procedure THiAsmClass.wx;|5:begin|25: _Data := _DoData(winx);|4:end;|0:|25:procedure THiAsmClass.wy;|5:begin|25: _Data := _DoData(winy);|4:end;|0:|4:end.|
link(ox,6317385:Data1,[(363,66)(27,66)])
link(oy,6317385:Data2,[(370,51)(34,51)])
link(oz,6317385:Data3,[(377,41)(41,41)])
}
Add(Hub,12301254,294,112)
{
OutCount=3
link(onEvent1,14190198:dogluProject,[])
link(onEvent2,7037491:doText,[(332,125)(332,230)])
link(onEvent3,13858049:doText,[(382,132)(382,293)])
}
END_SDK
Add(GetDataEx,398219,903,193)
{
Angle=3
link(Data,1811442:Var1,[(902,198)])
}
Add(GetDataEx,3833553,924,178)
{
Angle=3
link(Data,1811442:Var2,[(909,183)])
}
Add(GetDataEx,9012244,952,167)
{
Angle=3
link(Data,1811442:Var3,[(916,172)])
}


Редактировалось 1 раз(а), последний 2020-11-17 19:07:23
карма: 1

0
Ответов: 1929
Рейтинг: 627
#6: 2020-11-19 19:46:13 ЛС | профиль | цитата
Gik, повторюсь: MAV делал элемент GL_gluCoord (Обратные преобразования оконных и мировых координат) и выкладывал его на форуме с примером.
Для ленивых:
type
THIGL_gluCoord = class(TDebug)
private
Viewport: Array [0..3] of GLInt; // параметры viewport-a.
ProjMatrix: Array [0..15] of GLDouble;// матрица проекции.
mvMatrix: Array [0..15] of GLDouble; // видовая матрица.
wX,wY,wZ:GLdouble; // возвращаемые оконные/мировые координаты.


procedure THIGL_gluCoord._work_doGluProject; // преобразование мировых координат в оконные
var
X : Real;
Y : Real;
Z : Real;
begin
X:=ReadReal(_data,_data_X,_prop_X);
Y:=ReadReal(_data,_data_Y,_prop_Y);
Z:=ReadReal(_data,_data_Z,_prop_Z);
glGetIntegerv(GL_VIEWPORT,@Viewport); // узнаём параметры viewport-a.
glGetDoublev(GL_PROJECTION_MATRIX,@ProjMatrix); // узнаём матрицу проекции.
glGetDoublev(GL_MODELVIEW_MATRIX,@mvMatrix); // узнаём видовую матрицу.
gluProject(X,Y,Z, @mvMatrix, @ProjMatrix, @Viewport, wx, wy, wz);
_hi_onEvent(_event_onGluProject);
end;


Редактировалось 1 раз(а), последний 2020-11-19 19:46:51
карма: 9

0
Ответов: 60
Рейтинг: 0
#7: 2020-11-19 20:02:22 ЛС | профиль | цитата
Я не нашел примеров. Я не знаю, может я что-то неправильно написал, я плохо знаю Delphi. Во втором примере по другому написал inline cod.
И я проверил, моя программа с исправленным opengl.pas вроде работает.

Редактировалось 8 раз(а), последний 2020-11-19 20:34:27
карма: 1

0
Ответов: 1929
Рейтинг: 627
#8: 2020-11-19 21:22:54 ЛС | профиль | цитата
Gik писал(а):
Я не нашел примеров.
Ссылка на тему
Сссылка на архив с элементом
карма: 9

0
8
Сообщение
...
Прикрепленные файлы
(файлы не залиты)