DGL https://delphigl.com/forum/ |
|
Try to compile but ... https://delphigl.com/forum/viewtopic.php?f=19&t=9237 |
Seite 1 von 1 |
Autor: | azrael11 [ Mo Mai 31, 2010 00:32 ] |
Betreff des Beitrags: | Try to compile but ... |
I try to compile this code from the viewtopic.php?f=2&t=5914&p=51135&hilit=avi+texture#p51135 but i get and error says Code: [Error] main.pas(84): Undeclared identifier: 'avi' [Error] main.pas(87): Incompatible types: 'IAVIStream' and 'PAVIStream' [Error] main.pas(90): Incompatible types: 'IAVIStream' and 'PAVIStream' [Error] main.pas(91): Incompatible types: 'IAVIStream' and 'PAVIStream' [Warning] main.pas(91): Combining signed and unsigned types - widened both operands [Error] main.pas(104): Incompatible types: 'IAVIStream' and 'PAVIStream' [Error] main.pas(228): Incompatible types: 'IGetFrame' and 'PGetFrame' [Warning] main.pas(229): Combining signed and unsigned types - widened both operands [Fatal Error] test.dpr(5): Could not compile used unit 'main.pas' What happend... |
Autor: | Coolcat [ Mo Mai 31, 2010 08:15 ] |
Betreff des Beitrags: | Re: Try to compile but ... |
Since line numbers absolutely don't match the code you could start by posting the real code. E.g. there is no identifier "avi" in the whole code. If this is really the code you probably have some kind of compiler cache problem. Try to delete all temporary files generated by the compiler and try again. |
Autor: | azrael11 [ Mo Mai 31, 2010 11:45 ] |
Betreff des Beitrags: | Re: Try to compile but ... |
Coolcat hat geschrieben: Since line numbers absolutely don't match the code you could start by posting the real code. E.g. there is no identifier "avi" in the whole code. If this is really the code you probably have some kind of compiler cache problem. Try to delete all temporary files generated by the compiler and try again. sorry for the above here is the code Code: unit main; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, vfw, dglOpenGL, Opengl; type TForm1 = class(TForm) procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); procedure ApplicationEventsIdle(Sender: TObject; var Done: Boolean); procedure GrabAVIFrame(frame: integer); procedure xUpdate(milliseconds: DWORD); private { Private declarations } Texture: TGLuint; Data: Pointer; LastFrame, Next: Integer; mpf: integer; bmih: BITMAPINFOHEADER; h_bitmap: HBITMAP; pdata: PGLubyte; fhdd: HDRAWDIB; frame: integer; lastTickCount: Cardinal; VideoWidth, VideoHeight: Integer; StartTick : Cardinal; Frames : Integer; psi: TAVIStreamInfo; pavi: IAVIStream; pgf: IGetFrame; public { Public declarations } RC : HGLRC; DC : HDC; VDC : HDC; // VideoDeviceContext ShowFPS : Boolean; FontBase : GLUInt; FPS : Single; procedure BuildFont(pFontName : String); procedure OpenAVI(szFile: LPCSTR); procedure PrintText(pX,pY : Integer; const pText : String); procedure ShowText; end; var Form1: TForm1; implementation {$R *.dfm} { TForm1 } procedure TForm1.BuildFont(pFontName: String); var Font : HFONT; begin FontBase := glGenLists(96); Font := CreateFont(16, 0, 0, 0, FW_MEDIUM, 0, 0, 0, ANSI_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY, FF_DONTCARE or DEFAULT_PITCH, PChar(pFontName)); SelectObject(DC, Font); wglUseFontBitmaps(DC, 0, 256, FontBase); DeleteObject(Font) end; procedure TForm1.OpenAVI(szFile: LPCSTR); var bmi: BITMAPINFO; begin AVIFileInit; // P?ipravi' knihovnu AVIFile na pouz(iti' if AVIStreamOpenFromFile(pavi,szFile,streamtypeVIDEO,0,OF_READ,nil) <> 0 then // Otev?e AVI proud MessageBox(HWND_DESKTOP,'Failed To Open The AVI Stream','Error',MB_OK or MB_ICONEXCLAMATION); // Chybova' AVIStreamInfo(pavi,psi,sizeof(psi)); VideoWidth := psi.rcFrame.Right - psi.rcFrame.Left; VideoHeight := psi.rcFrame.Bottom - psi.rcFrame.Top; lastframe := AVIStreamLength(pavi); mpf := AVIStreamSampleToTime(pavi,lastframe) div lastframe; with bmih do begin biSize := sizeof(BITMAPINFOHEADER); biPlanes := 1; biBitCount := 24; biWidth := 256; biHeight := 256; biCompression := BI_RGB; end; bmi.bmiHeader := bmih; h_bitmap := CreateDIBSection(VDC,bmi,DIB_RGB_COLORS,data,0,0); SelectObject(VDC,h_bitmap); pgf := AVIStreamGetFrameOpen(pavi,nil); if pgf = nil then MessageBox(HWND_DESKTOP,'Failed To Open The AVI Frame','Error',MB_OK or MB_ICONEXCLAMATION); end; procedure TForm1.PrintText(pX, pY: Integer; const pText: String); begin if (pText = '') then exit; glPushAttrib(GL_LIST_BIT); glRasterPos2i(pX, pY); glListBase(FontBase); glCallLists(Length(pText), GL_UNSIGNED_BYTE, PChar(pText)); glPopAttrib; end; procedure TForm1.ShowText; begin glDisable(GL_DEPTH_TEST); glDisable(GL_TEXTURE_2D); glMatrixMode(GL_PROJECTION); glLoadIdentity; glOrtho(0,640,480,0, -1,1); glMatrixMode(GL_MODELVIEW); glLoadIdentity; PrintText(5,15, FloatToStr(FPS)+' fps'); glEnable(GL_DEPTH_TEST); glEnable(GL_TEXTURE_2D); end; procedure TForm1.FormCreate(Sender: TObject); begin Data := NIL; Texture := 0; LastFrame := 0; mpf := 0; Frame := 0; Next := 0; VideoWidth := 0; VideoHeight := 0; InitOpenGL; DC := GetDC(Handle); RC := CreateRenderingContext(DC, [opDoubleBuffered], 32, 24, 0, 0, 0, 0); ActivateRenderingContext(DC, RC); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LESS); glClearColor(0,0,0,0); glGenTextures(1, @Texture); glBindTexture(GL_TEXTURE_2D, Texture); glEnable(GL_TEXTURE_2D); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 256, 256, 0, GL_BGR, GL_UNSIGNED_BYTE, @data); VDC := CreateCompatibleDC(0); fhdd := DrawDibOpen; OpenAVI('1.avi'); BuildFont('MS Sans Serif'); Application.OnIdle := ApplicationEventsIdle; StartTick := GetTickCount; end; procedure TForm1.FormDestroy(Sender: TObject); begin DeactivateRenderingContext; wglDeleteContext(RC); ReleaseDC(Handle, DC); ChangeDisplaySettings(devmode(nil^), 0); end; procedure TForm1.ApplicationEventsIdle(Sender: TObject; var Done: Boolean); var tickCount: cardinal; Left_Min, Top_Min, Right_Max, Bottom_Max: Integer; begin glMatrixMode(GL_PROJECTION_MATRIX); glLoadIdentity; glViewPort(0, 0, ClientWidth, ClientHeight); glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); Left_Min := 0; Top_Min := 0; Right_Max := ClientWidth; Bottom_Max := ClientHeight; glOrtho(0,ClientWidth,ClientHeight,0, 0,128); GrabAVIFrame(frame); glLoadIdentity; glBindTexture(GL_TEXTURE_2D, Texture); glBegin(GL_QUADS); glTexCoord2f(0,0); glVertex3f(0,Top_Min,0); glTexCoord2f(0,1); glVertex3f(0,Bottom_Max,0); glTexCoord2f(1,1); glVertex3f(Right_Max,Bottom_Max,0); glTexCoord2f(1,0); glVertex3f(Right_Max,0,0); glEnd; tickCount := GetTickCount; xUpdate(tickCount - lastTickCount); lasttickcount := tickCount; ShowText; SwapBuffers(DC); Done := False; sleep(10); inc(Frames); if GetTickCount - StartTick >= 500 then begin FPS := Frames/(GetTickCount-StartTick)*1000; Frames := 0; StartTick := GetTickCount end; end; procedure TForm1.GrabAVIFrame(frame: integer); var lpbi: PBitmapInfoHeader; begin lpbi := AVIStreamGetFrame(pgf,frame); pdata := Pointer(Integer(lpbi) + abs(lpbi.biSize) + lpbi.biClrUsed * sizeof(RGBQUAD)); DrawDibDraw(fhdd,VDC,0,0,256,256,lpbi,pdata,0,0,VideoWidth,VideoHeight,0); glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 256, 256, GL_BGR, GL_UNSIGNED_BYTE, data); end; procedure TForm1.xUpdate(milliseconds: DWORD); begin Inc(next,milliseconds); frame := next div mpf; if frame >= lastframe then begin frame := 0; next := 0; end; end; end. How can i erase the compiler cache ? |
Autor: | azrael11 [ Di Jun 01, 2010 06:52 ] |
Betreff des Beitrags: | Re: Try to compile but ... |
i Change the Code: psi: TAVIStreamInfo; pavi: IAVIStream; pgf: IGetFrame; make it Code: psi: PAVIStreamInfo; pavi: PAVIStream; pgf: PGetFrame; It compiles put i get an access violation in atiogxx.dll ... Any help please... My project count on this |
Autor: | Coolcat [ Di Jun 01, 2010 07:44 ] |
Betreff des Beitrags: | Re: Try to compile but ... |
Do you have a stack trace of the access violation? If not, you could use a debugger to find the exact location in your code. When working without debugger you could write some debug message on standard output to track down the error. I can't help you with the problem itself, I have no idea what you are doing there, except that it has obviously something to do with AVI streams. Zitat: How can i erase the compiler cache ? I have no idea how to do that on Delphi. I'm using qmake/GCC on Linux...there you just have to call "make clean" and possibly regenerate your makefile. However, Delphi does probably not use Makefiles...but if I had to guess...a button somewhere near the compile button labeled "clean" or "recompile". |
Autor: | Wölfchen [ Di Jun 01, 2010 07:55 ] |
Betreff des Beitrags: | Re: Try to compile but ... |
azrael11 hat geschrieben: sorry for the above here is the code Code: unit main; interface uses {...} dglOpenGL, Opengl; type {...} not sure but i read somewhere this can cause trouble too... to use 2 opengl headers in same project regards |
Autor: | azrael11 [ Di Jun 01, 2010 08:44 ] |
Betreff des Beitrags: | Re: Try to compile but ... |
Coolcat hat geschrieben: Do you have a stack trace of the access violation? If not, you could use a debugger to find the exact location in your code. When working without debugger you could write some debug message on standard output to track down the error. i use the debugger and i get this message in this line Code: VideoWidth := psi.rcFrame.Right - psi.rcFrame.Left; Code: [Warning] main.pas(92): Combining signed and unsigned types - widened both operands [Hint] main.pas(187): Value assigned to 'Left_Min' never used [Warning] main.pas(230): Combining signed and unsigned types - widened both operands This works only if i change the Code: psi: TAVIStreamInfo; pavi: IAVIStream; pgf: IGetFrame; to Code: psi: PAVIStreamInfo; pavi: PAVIStream; pgf: PGetFrame; Coolcat hat geschrieben: I can't help you with the problem itself, I have no idea what you are doing there, except that it has obviously something to do with AVI streams. This code is to show avi movies to a texture. A simple code that is show in this thread viewtopic.php?f=2&t=5914&p=51135&hilit=avi+texture#p51135 This put the avi in the six panels of a cude. Thanks for your anwser... |
Autor: | azrael11 [ Di Jun 01, 2010 08:47 ] |
Betreff des Beitrags: | Re: Try to compile but ... |
Wölfchen hat geschrieben: azrael11 hat geschrieben: sorry for the above here is the code Code: unit main; interface uses {...} dglOpenGL, Opengl; type {...} not sure but i read somewhere this can cause trouble too... to use 2 opengl headers in same project regards Thanks for that ... But have no effect if is in here or not. In the last compile no use of it... If there is someone that compile the code succesfully can he provide the source and the exe code so i test it? The thread that i prefer above is in german so i don't speak german ... Please help... |
Seite 1 von 1 | Alle Zeiten sind UTC + 1 Stunde |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |