Gemeinsame Unterverzeichnisse: fpcupdeluxe/lazarus/components/opengl/example und fpcupdeluxe_stable/lazarus/components/opengl/example. diff fpcupdeluxe/lazarus/components/opengl/glcarbonaglcontext.pas fpcupdeluxe_stable/lazarus/components/opengl/glcarbonaglcontext.pas 24c24 < procedure LOpenGLViewport(Handle: HWND; Left, Top, Width, Height: integer); --- > procedure LOpenGLViewport(Left, Top, Width, Height: integer); 60c60 < procedure LOpenGLViewport(Handle: HWND; Left, Top, Width, Height: integer); --- > procedure LOpenGLViewport(Left, Top, Width, Height: integer); diff fpcupdeluxe/lazarus/components/opengl/glcocoanscontext.pas fpcupdeluxe_stable/lazarus/components/opengl/glcocoanscontext.pas 30,32c30 < function LBackingScaleFactor(Handle: HWND): single; < procedure LSetWantsBestResolutionOpenGLSurface(const AValue: boolean; Handle: HWND); < procedure LOpenGLViewport(Handle: HWND; Left, Top, Width, Height: integer); --- > procedure LOpenGLViewport(Left, Top, Width, Height: integer); 39c37 < DoubleBuffered, AMacRetinaMode: boolean; --- > DoubleBuffered: boolean; 57,62d54 < NSOpenGLViewFix = objccategory external (NSOpenGLView) < procedure setWantsBestResolutionOpenGLSurface(bool: NSInteger); message 'setWantsBestResolutionOpenGLSurface:'; < end; < NSScreenFix = objccategory external (NSScreen) < function backingScaleFactor: CGFloat ; message 'backingScaleFactor'; < end; 73d64 < backingScaleFactor: Single; 114,140c105 < //value > 1 if screen is scaled, e.g. default for MOST retina displays is 2 < function LBackingScaleFactor(Handle: HWND): single; < begin < result := TCocoaOpenGLView(Handle).backingScaleFactor; < end; < < procedure LSetWantsBestResolutionOpenGLSurface(const AValue: boolean; Handle: HWND); < var < View: TCocoaOpenGLView; < begin < if Handle=0 then exit; < View:=TCocoaOpenGLView(Handle); < if not View.respondsToSelector(objcselector('setWantsBestResolutionOpenGLSurface:')) then exit; < if AValue then < View.setWantsBestResolutionOpenGLSurface(1) < else < View.setWantsBestResolutionOpenGLSurface(0); < if (AValue) and (NSScreen.mainScreen.respondsToSelector(objcselector('backingScaleFactor'))) then //MacOS >=10.7 < View.backingScaleFactor := NSScreen.mainScreen.backingScaleFactor < else < View.backingScaleFactor := 1; < end; < < procedure LOpenGLViewport(Handle: HWND; Left, Top, Width, Height: integer); < var < View: NSOpenGLView absolute Handle; < lFinalWidth, lFinalHeight: Integer; --- > procedure LOpenGLViewport(Left, Top, Width, Height: integer); 142,149c107 < lFinalWidth := Width; < lFinalHeight := Height; < if View <> nil then < begin < lFinalWidth := Round(Width * LBackingScaleFactor(Handle)); < lFinalHeight := Round(Height * LBackingScaleFactor(Handle)); < end; < glViewport(Left,Top,lFinalWidth,lFinalHeight); --- > glViewport(Left,Top,Width,Height); 185,186c143 < WSPrivate: TWSPrivateClass; SharedControl: TWinControl; < DoubleBuffered, AMacRetinaMode: boolean; --- > WSPrivate: TWSPrivateClass; SharedControl: TWinControl; DoubleBuffered: boolean; 226d182 < LSetWantsBestResolutionOpenGLSurface(AMacRetinaMode, HWND(View)); 315d270 < NSScreen.mainScreen.colorSpace; 439,441c394,395 < if Assigned(callback) < then callback.MouseUpDownEvent(event) < else inherited mouseDown(event); --- > if not Assigned(callback) or not callback.MouseUpDownEvent(event) then > inherited mouseDown(event); 446,448c400,401 < if Assigned(callback) < then callback.MouseUpDownEvent(event) < else inherited mouseUp(event); --- > if not Assigned(callback) or not callback.MouseUpDownEvent(event) then > inherited mouseUp(event); 453,455c406,407 < if Assigned(callback) < then callback.MouseUpDownEvent(event) < else inherited rightMouseDown(event); --- > if not Assigned(callback) or not callback.MouseUpDownEvent(event) then > inherited rightMouseDown(event); 460,462c412,413 < if Assigned(callback) < then callback.MouseUpDownEvent(event) < else inherited rightMouseUp(event); --- > if not Assigned(callback) or not callback.MouseUpDownEvent(event) then > inherited rightMouseUp(event); 467,469c418,419 < if Assigned(callback) < then callback.MouseUpDownEvent(event) < else inherited otherMouseDown(event); --- > if not Assigned(callback) or not callback.MouseUpDownEvent(event) then > inherited otherMouseDown(event); 474,476c424,425 < if Assigned(callback) < then callback.MouseUpDownEvent(event) < else inherited otherMouseUp(event); --- > if not Assigned(callback) or not callback.MouseUpDownEvent(event) then > inherited otherMouseUp(event); 481,483c430,431 < if Assigned(callback) < then callback.MouseMove(event) < else inherited mouseDragged(event); --- > if not Assigned(callback) or not callback.MouseMove(event) then > inherited mouseDragged(event); 498,500c446,447 < if Assigned(callback) < then callback.MouseMove(event) < else inherited mouseMoved(event); --- > if not Assigned(callback) or not callback.MouseMove(event) then > inherited mouseMoved(event); 505,507c452,453 < if Assigned(callback) < then callback.scrollWheel(event) < else inherited scrollWheel(event); --- > if not Assigned(callback) or not callback.scrollWheel(event) then > inherited scrollWheel(event); diff fpcupdeluxe/lazarus/components/opengl/glgtkglxcontext.pas fpcupdeluxe_stable/lazarus/components/opengl/glgtkglxcontext.pas 110c110 < procedure LOpenGLViewport({%H-}Handle: HWND; Left, Top, Width, Height: integer); --- > procedure LOpenGLViewport(Left, Top, Width, Height: integer); 771c771 < procedure LOpenGLViewport(Handle: HWND; Left, Top, Width, Height: integer); --- > procedure LOpenGLViewport(Left, Top, Width, Height: integer); diff fpcupdeluxe/lazarus/components/opengl/glqtcontext.pas fpcupdeluxe_stable/lazarus/components/opengl/glqtcontext.pas 62c62 < procedure LOpenGLViewport(Handle: HWND; Left, Top, Width, Height: integer); --- > procedure LOpenGLViewport(Left, Top, Width, Height: integer); 126c126 < procedure LOpenGLViewport(Handle: HWND; Left, Top, Width, Height: integer); --- > procedure LOpenGLViewport(Left, Top, Width, Height: integer); diff fpcupdeluxe/lazarus/components/opengl/glwin32wglcontext.pas fpcupdeluxe_stable/lazarus/components/opengl/glwin32wglcontext.pas 20c20 < procedure LOpenGLViewport(Handle: HWND; Left, Top, Width, Height: integer); --- > procedure LOpenGLViewport(Left, Top, Width, Height: integer); 233c233 < procedure LOpenGLViewport(Handle: HWND; Left, Top, Width, Height: integer); --- > procedure LOpenGLViewport(Left, Top, Width, Height: integer); Gemeinsame Unterverzeichnisse: fpcupdeluxe/lazarus/components/opengl/lib und fpcupdeluxe_stable/lazarus/components/opengl/lib. diff fpcupdeluxe/lazarus/components/opengl/openglcontext.pas fpcupdeluxe_stable/lazarus/components/opengl/openglcontext.pas 55d54 < {$DEFINE HasMacRetinaMode} 106,108d104 < TOpenGLControlOption = (ocoMacRetinaMode, ocoRenderAtDesignTime); < TOpenGLControlOptions = set of TOpenGLControlOption; < 114c110 < --- > 127a124 > FDoubleBuffered: boolean; 142d138 < FOptions: TOpenGLControlOptions; 145a142 > procedure SetDoubleBuffered(const AValue: boolean); 148d144 < procedure SetOptions(AValue: TOpenGLControlOptions); 161d156 < function IsOpenGLRenderAllowed: boolean; 167d161 < procedure CMDoubleBufferedChanged(var Message: TLMessage); message CM_DOUBLEBUFFEREDCHANGED; 191,192c185 < property DoubleBuffered stored True default True; < property ParentDoubleBuffered default False; --- > property DoubleBuffered: boolean read FDoubleBuffered write SetDoubleBuffered default true; 207c200 < --- > 210,211c203,204 < You can query OpenGL values GL_SAMPLE_BUFFERS_ARB and GL_SAMPLES_ARB < (see ARB_multisample extension) to see how many samples have been --- > You can query OpenGL values GL_SAMPLE_BUFFERS_ARB and GL_SAMPLES_ARB > (see ARB_multisample extension) to see how many samples have been 219d211 < property Options: TOpenGLControlOptions read FOptions write SetOptions; 313c305 < LOpenGLViewport(Handle,0,0,Width,Height); --- > LOpenGLViewport(0,0,Width,Height); 323c315 < procedure TCustomOpenGLControl.CMDoubleBufferedChanged(var Message: TLMessage); --- > procedure TCustomOpenGLControl.SetDoubleBuffered(const AValue: boolean); 325c317,318 < inherited; --- > if FDoubleBuffered=AValue then exit; > FDoubleBuffered:=AValue; 341,365d333 < procedure TCustomOpenGLControl.SetOptions(AValue: TOpenGLControlOptions); < var < RemovedRenderAtDesignTime: boolean; < begin < if FOptions=AValue then Exit; < < RemovedRenderAtDesignTime:= < (ocoRenderAtDesignTime in FOptions) and < (not (ocoRenderAtDesignTime in AValue)); < < FOptions:=AValue; < < { if you remove the flag ocoRenderAtDesignTime at design-time, < we need to destroy the handle. The call to OpenGLAttributesChanged < would not do this, so do it explicitly by calling ReCreateWnd < (ReCreateWnd will destroy handle, and not create new one, < since IsOpenGLRenderAllowed = false). } < if (csDesigning in ComponentState) and < RemovedRenderAtDesignTime and < HandleAllocated then < ReCreateWnd(Self); < < OpenGLAttributesChanged(); < end; < 454c422 < if HandleAllocated and IsOpenGLRenderAllowed then --- > if HandleAllocated and (not (csDesigning in ComponentState)) then 458,465d425 < { OpenGL rendering allowed, because not in design-mode or because we < should render even in design-mode. } < function TCustomOpenGLControl.IsOpenGLRenderAllowed: boolean; < begin < Result := (not (csDesigning in ComponentState)) or < (ocoRenderAtDesignTime in Options); < end; < 471c431 < if (not IsOpenGLRenderAllowed) and (FCanvas<>nil) then begin --- > if (csDesigning in ComponentState) and (FCanvas<>nil) then begin 511,512c471,472 < if HandleAllocated and < ( ([csLoading,csDestroying]*ComponentState=[]) and IsOpenGLRenderAllowed ) then --- > if HandleAllocated > and ([csLoading,csDesigning,csDestroying]*ComponentState=[]) then 525d484 < ParentDoubleBuffered:=False; 538c497 < if not IsOpenGLRenderAllowed then begin --- > if (csDesigning in ComponentState) then begin 564c523 < procedure TCustomOpenGLControl.Paint; --- > Procedure TCustomOpenGLControl.Paint; 568,572c527,530 < if IsOpenGLRenderAllowed and ([csDestroying]*ComponentState=[]) then begin < if AutoResizeViewport then begin < if not MakeCurrent then exit; < LOpenGLViewport(Handle,0,0,Width,Height); < end; --- > if ([csDesigning,csDestroying]*ComponentState=[]) then begin > if not MakeCurrent then exit; > if AutoResizeViewport then > LOpenGLViewport(0,0,Width,Height); 582,583c540 < and IsOpenGLRenderAllowed < and ([csDestroying]*ComponentState=[]) --- > and ([csDesigning,csDestroying]*ComponentState=[]) 586c543 < LOpenGLViewport(Handle,0,0,Width,Height); --- > LOpenGLViewport(0,0,Width,Height); 593,596c550 < if Assigned(OnPaint) then begin < if not MakeCurrent then exit; < OnPaint(Self); < end; --- > if Assigned(OnPaint) then OnPaint(Self); 608c562 < if not IsOpenGLRenderAllowed then exit(false); --- > if csDesigning in ComponentState then exit(false); 677,678c631 < OpenGlControl:=AWinControl as TCustomOpenGLControl; < if not OpenGlControl.IsOpenGLRenderAllowed then --- > if csDesigning in AWinControl.ComponentState then 684a638 > OpenGlControl:=AWinControl as TCustomOpenGLControl; 692,694d645 < {$IFDEF HasMacRetinaMode} < ocoMacRetinaMode in OpenGlControl.Options, < {$ENDIF} 729a681 >