</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<OutputPath>bin\Debug</OutputPath>\r
- <DefineConstants>TRACE;DEBUG;__linux__;DEBUG_LOAD_TIME0;DEBUG_LAYOUTING;DEBUG_BINDING</DefineConstants>\r
+ <DefineConstants>TRACE;DEBUG;__linux__;CAIRO_GL;DEBUG_LOAD_TIME0;DEBUG_LAYOUTING0;DEBUG_BINDING0</DefineConstants>\r
</PropertyGroup>\r
<!-- <PropertyGroup Condition=" '$(Platform)' == 'Linux_x86' ">\r
<DefineConstants>__linux__</DefineConstants>\r
<Package>glib-sharp-3.0</Package>\r
</Reference>\r
<Reference Include="Microsoft.CSharp" />\r
- <Reference Include="OpenTK">\r
- <HintPath>..\opentk\Binaries\OpenTK\Release\OpenTK.dll</HintPath>\r
- </Reference>\r
<Reference Include="Mono.Cairo" />\r
- <Reference Include="rsvg2-sharp, Version=2.18.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">\r
- <Package>rsvg2-sharp-2.0</Package>\r
+ <Reference Include="rsvg2-sharp, Version=2.18.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />\r
+ <Reference Include="OpenTK">\r
+ <HintPath>..\..\src\opentk-git\Binaries\OpenTK\Release\OpenTK.dll</HintPath>\r
</Reference>\r
</ItemGroup>\r
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
<None Include="Images\Icons\Cursors\move" />\r
<None Include="README.md" />\r
</ItemGroup>\r
+ <ProjectExtensions>\r
+ <MonoDevelop>\r
+ <Properties>\r
+ <Policies>\r
+ <TextStylePolicy FileWidth="120" TabsToSpaces="False" EolMarker="Unix" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/x-csharp" />\r
+ <CSharpFormattingPolicy AfterDelegateDeclarationParameterComma="True" inheritsSet="Mono" inheritsScope="text/x-csharp" scope="text/x-csharp" />\r
+ </Policies>\r
+ </Properties>\r
+ </MonoDevelop>\r
+ </ProjectExtensions>\r
</Project>\r
{C2980F9B-4798-4C05-99E2-E174810F7C7B}.Release|Linux_x86.ActiveCfg = Release|Any CPU\r
{C2980F9B-4798-4C05-99E2-E174810F7C7B}.Release|Linux_x86.Build.0 = Release|Any CPU\r
{E9E14DB5-3C67-4E01-B5C3-4D90D7E31A2E}.Debug|Linux_x86.ActiveCfg = Debug|Any CPU\r
- {E9E14DB5-3C67-4E01-B5C3-4D90D7E31A2E}.Debug|Linux_x86.Build.0 = Debug|Any CPU\r
{E9E14DB5-3C67-4E01-B5C3-4D90D7E31A2E}.Release|Linux_x86.ActiveCfg = Release|Any CPU\r
EndGlobalSection\r
GlobalSection(MonoDevelopProperties) = preSolution\r
+ StartupItem = Tests\Tests.csproj\r
Policies = $0\r
$0.StandardHeader = $1\r
$1.Text = @ \n ${FileName}\n \n Author:\n ${AuthorName} <${AuthorEmail}>\n\n Copyright (c) ${Year} ${CopyrightHolder}\n\n This program is free software: you can redistribute it and/or modify\n it under the terms of the GNU General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program. If not, see <http://www.gnu.org/licenses/>.\r
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
+ <CustomCommands>
+ <CustomCommands>
+ <Command type="Execute" command="/usr/local/lib/monodevelop/bin/MonoDevelop.exe --no-redirect" workingdir="/usr/local/lib/monodevelop/bin" />
+ </CustomCommands>
+ </CustomCommands>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
+ <CustomCommands>
+ <CustomCommands>
+ <Command type="Execute" command="/usr/local/lib/monodevelop/bin/MonoDevelop.exe --no-redirect" workingdir="/usr/local/lib/monodevelop/bin" />
+ </CustomCommands>
+ </CustomCommands>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="ICSharpCode.NRefactory">
<HintPath>\usr\local\lib\monodevelop\bin\ICSharpCode.NRefactory.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Mono.Addins">
- <Package>mono-addins</Package>
+ <Package>monodevelop</Package>
</Reference>
+ <Reference Include="Mono.Addins" />
<Reference Include="MonoDevelop.Ide">
<HintPath>\usr\local\lib\monodevelop\bin\MonoDevelop.Ide.dll</HintPath>
- <Private>False</Private>
+ <Package>monodevelop</Package>
</Reference>
<Reference Include="MonoDevelop.Core">
<HintPath>\usr\local\lib\monodevelop\bin\MonoDevelop.Core.dll</HintPath>
+ <Package>monodevelop</Package>
</Reference>
<Reference Include="MonoDevelop.DesignerSupport">
<HintPath>\usr\local\lib\monodevelop\AddIns\MonoDevelop.DesignerSupport\MonoDevelop.DesignerSupport.dll</HintPath>
- <Private>False</Private>
+ <Package>monodevelop-core-addins</Package>
</Reference>
<Reference Include="Mono.Cairo" />
<Reference Include="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
</Reference>
<Reference Include="MonoDevelop.SourceEditor2">
<HintPath>..\..\..\..\..\usr\local\lib\monodevelop\AddIns\DisplayBindings\SourceEditor\MonoDevelop.SourceEditor2.dll</HintPath>
+ <Package>monodevelop-core-addins</Package>
</Reference>
<Reference Include="Mono.TextEditor">
<HintPath>..\..\..\..\..\usr\local\lib\monodevelop\bin\Mono.TextEditor.dll</HintPath>
+ <Package>monodevelop</Package>
</Reference>
</ItemGroup>
<ItemGroup>
<?xml version="1.0"?>\r
-<Border BorderWidth="1" Margin="1" MinimumSize="20;20" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}" >\r
+<Border BorderWidth="1" Margin="1" MinimumSize="100;100" MaximumSize="500;500" Fit="true" >\r
<!-- <Scroller Name="scroller1" Margin="1" VerticalScrolling="true"\r
Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">-->\r
- <VerticalStack Height="-1" Width="{../../../TemplatedWidth}" Name="List" Margin="0" VerticalAlignment="Top"/>\r
+ <VerticalStack Fit="True" Name="List" Margin="0" VerticalAlignment="Top"/>\r
<!-- </Scroller>-->\r
</Border>
\ No newline at end of file
#endregion\r
\r
public GOLIBTests ()\r
- : base(800, 600,"test: press spacebar to toogle test files")\r
+ : base(1280, 1024,"test: press spacebar to toogle test files")\r
{\r
VSync = VSyncMode.Off;\r
}\r
int frameCpt = 0;\r
int idx = 0;\r
string[] testFiles = {\r
+ "test0.goml",\r
+// "test4.goml",\r
// "testCombobox.goml",\r
"testWindow3.goml",\r
"testExpandable.goml",\r
"testWindow.goml",\r
"testWindow2.goml",\r
// "testSpinner.goml",\r
- "test4.goml",\r
"testRadioButton2.goml",\r
"testContainer.goml",\r
"testBorder.goml",\r
<?xml version="1.0"?>
-<Container Width="100" Height="100" Background="Red">
- <Group>
- <Border CornerRadius="5" BorderWidth="1" Margin="5"/>
- <HorizontalStack Fit="true" Background="Clear"
- VerticalAlignment="Top" Left="10">
- <GraphicObject Width="3"/>
- <Label Text="GroupBox"/>
- <GraphicObject Width="5"/>
- </HorizontalStack>
- </Group>
-</Container>
+<GraphicObject Width="200" Background="Green"/>
BorderColor="DimGray" BorderWidth="1"\r
Text="editable text"/>\r
</VerticalStack>\r
- <VerticalStack Fit="true" Margin="0" WidgetSpacing="1">\r
+ <VerticalStack Width="200" Height="-1" Margin="0" WidgetSpacing="1" Background="Blue">\r
<Button Margin="1" Width="150" Height="100">\r
<Image Path="#Tests.image.tetra.png"/>\r
</Button>\r
<Checkbox Name="chk2"/>\r
</VerticalStack> \r
</Expandable>\r
- <HorizontalStack>\r
+ <HorizontalStack Fit="true">\r
<Label Text="Update" FontColor="White"/>\r
<Label Name="labUpdate" Text="{update}" FontSize="16" Width="60" TextAlignment="Center" Background="DarkGreen"/>\r
</HorizontalStack>\r
- <HorizontalStack>\r
+ <HorizontalStack Fit="true">\r
<Label Text="Fps:" Width = "30"/>\r
<Label Name="labFps" Text="{fps}" Font="droid bold, 14"\r
TextAlignment="Center" Background="AoEnglish"/>\r
</HorizontalStack>\r
- <HorizontalStack>\r
- <Label Text="Min:" Width = "30"/>\r
- <Label Name="labFpsMin" Text="{fpsMin}" Font="droid bold, 14"\r
- TextAlignment="Center" Background="AoEnglish"/>\r
- </HorizontalStack>\r
- <HorizontalStack>\r
+ <HorizontalStack Fit="true">\r
<Label Text="Max:" Width = "30"/>\r
<Label Name="labFpsMax" Text="{fpsMax}" Font="droid bold, 14"\r
TextAlignment="Center" Background="AoEnglish"/>\r
</HorizontalStack>\r
+ <HorizontalStack Background="Red" Fit="true">\r
+ <Label Text="Min:" Width = "30"/>\r
+ <Label Name="labFpsMin" Text="{fpsMin}" Font="droid bold, 14"\r
+ TextAlignment="Center" Background="AoEnglish"/>\r
+ </HorizontalStack>\r
</VerticalStack>\r
<HorizontalStack Width="-1">\r
<Scroller Name="scroller1" Background="DimGray" Width="-1" \r
<VerticalStack Name="contentVSStack" Margin="10" Spacing="10">\r
<Slider Name="slider" Height="10" Width="0"/>\r
<Groupbox Text="test" Height="-1" Width="-1" Margin="5">\r
- <VerticalStack Height="-1" Width="0" >\r
+ <VerticalStack Height="-1" Width="-1" >\r
<RadioButton Caption="Radio 1" Background="Red" />\r
<RadioButton Caption="Radio 2" IsChecked="true" />\r
<RadioButton Caption="Radio 3" />\r
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="System.Drawing" />
+ <Reference Include="Mono.Cairo" />
<Reference Include="OpenTK">
- <HintPath>..\..\opentk\Binaries\OpenTK\Release\OpenTK.dll</HintPath>
+ <HintPath>..\..\..\src\opentk-git\Binaries\OpenTK\Release\OpenTK.dll</HintPath>
</Reference>
- <Reference Include="Mono.Cairo" />
</ItemGroup>
<ItemGroup>
<Compile Include="GOLIBTest_5.cs" />
if (idx > 0 && idx < Children.Count - 1)\r
gobjs [0].Slot.Width -= Spacing;\r
if (gobjs [0].LastSlots.Width != gobjs [0].Slot.Width) {\r
- gobjs [0].bmp = null;\r
+ gobjs [0].DeleteCache();\r
gobjs [0].OnLayoutChanges (LayoutingType.Width);\r
gobjs [0].LastSlots.Width = gobjs [0].Slot.Width;\r
}\r
if (idx > 0 && idx < Children.Count - 1)\r
gobjs [0].Slot.Height -= Spacing;\r
if (gobjs [0].LastSlots.Height != gobjs [0].Slot.Height) {\r
- gobjs [0].bmp = null;\r
+ gobjs [0].DeleteCache();\r
gobjs [0].OnLayoutChanges (LayoutingType.Height);\r
gobjs [0].LastSlots.Height = gobjs [0].Slot.Height;\r
}\r
} \r
ComputeChildrenPositions ();\r
//if no layouting remains in queue for item, registre for redraw\r
- if (Interface.LayoutingQueue.Where (lq => lq.GraphicObject == this).Count () <= 0 && bmp==null)\r
+ if (Interface.LayoutingQueue.Where (lq => lq.GraphicObject == this).Count () <= 0 && cacheIsEmpty)\r
this.RegisterForRedraw ();\r
}else\r
base.UpdateLayout(layoutType);\r
using System.Collections.Generic;\r
using System.Linq;\r
using System.Text;\r
-\r
-//using OpenTK.Graphics.OpenGL;\r
+#if CAIRO_GL\r
+using OpenTK.Graphics.OpenGL;\r
+#endif\r
using System.Drawing.Imaging;\r
using System.Diagnostics;\r
using OpenTK.Input;\r
public Rectangle Bounds;\r
public Rectangle Slot = new Rectangle ();\r
public object Tag;\r
+ #if CAIRO_GL\r
+ public static Cairo.Device device;\r
+ public uint texID;\r
+ #else\r
public byte[] bmp;\r
+ #endif\r
#endregion\r
\r
#region ILayoutable\r
}\r
//TODO: only used in group, should be removed from base go object\r
[XmlIgnore]public virtual bool DrawingIsValid\r
- { get { return bmp == null ? \r
- false : \r
- true; } }\r
+ { \r
+ get {\r
+ #if CAIRO_GL\r
+ return GL.IsTexture(texID);\r
+ #else\r
+ return bmp != null; \r
+ #endif\r
+ } \r
+ }\r
+ [XmlIgnore]protected bool cacheIsEmpty\r
+ { \r
+ get {\r
+ #if CAIRO_GL\r
+ return !GL.IsTexture(texID);\r
+ #else\r
+ return bmp == null; \r
+ #endif\r
+ } \r
+ }\r
[XmlAttributeAttribute()][DefaultValue(null)]\r
public virtual string BackgroundImagePath {\r
get { return _backgroundImagePath; }\r
/// </summary>\r
public virtual void registerForGraphicUpdate ()\r
{\r
- bmp = null;\r
+ DeleteCache ();\r
if (TopContainer != null)\r
TopContainer.gobjsToRedraw.Add (this);\r
}\r
if (LastSlots.X == Slot.X)\r
break;\r
\r
- bmp = null;\r
+ DeleteCache ();\r
\r
OnLayoutChanges (layoutType);\r
\r
Slot.Y = Parent.ClientRectangle.Height / 2 - Slot.Height / 2;\r
break;\r
}\r
- }else\r
+ } else\r
Slot.Y = Bounds.Y;\r
\r
if (LastSlots.Y == Slot.Y)\r
break;\r
\r
- bmp = null;\r
+ DeleteCache ();\r
\r
OnLayoutChanges (layoutType);\r
\r
if (LastSlots.Width == Slot.Width)\r
break;\r
\r
- bmp = null;\r
+ DeleteCache ();\r
\r
OnLayoutChanges (layoutType);\r
\r
if (LastSlots.Height == Slot.Height)\r
break;\r
\r
- bmp = null;\r
+ DeleteCache ();\r
\r
OnLayoutChanges (layoutType);\r
\r
}\r
lock (Interface.LayoutingQueue) {\r
//if no layouting remains in queue for item, registre for redraw\r
- if (Interface.LayoutingQueue.Where (lq => lq.GraphicObject == this).Count () <= 0 && bmp == null)\r
+ if (Interface.LayoutingQueue.Where (lq => lq.GraphicObject == this).Count () <= 0 && cacheIsEmpty)\r
this.RegisterForRedraw ();\r
}\r
}\r
{\r
LastPaintedSlot = Slot;\r
\r
+ #if CAIRO_GL\r
+ DeleteCache ();\r
+ GL.GenTextures(1, out texID);\r
+ GL.BindTexture(TextureTarget.Texture2D, texID);\r
+ GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, \r
+ Slot.Width, Slot.Height, 0,\r
+ OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero);\r
+ using (Surface draw = new GLSurface\r
+ (device, Content.ColorAlpha, texID, Slot.Width, Slot.Height)) {\r
+ #else\r
+ bmp = null;\r
int stride = 4 * Slot.Width;\r
\r
int bmpSize = Math.Abs (stride) * Slot.Height;\r
bmp = new byte[bmpSize];\r
\r
- using (ImageSurface draw =\r
- new ImageSurface(bmp, Format.Argb32, Slot.Width, Slot.Height, stride)) {\r
+ using (Surface draw =\r
+ new ImageSurface(bmp, Format.Argb32, Slot.Width, Slot.Height, stride)) {\r
+ #endif\r
using (Context gr = new Context (draw)) {\r
gr.Antialias = Antialias.Subpixel;\r
onDraw (gr);\r
draw.Flush ();\r
//draw.WriteToPng ("/mnt/data/test.png");\r
}\r
+ #if CAIRO_GL\r
+ GL.BindTexture(TextureTarget.Texture2D, 0);\r
+ #endif\r
}\r
/// <summary> Chained painting routine on the parent context of the actual cached version\r
/// of the widget </summary>\r
if (!Visible)\r
return;\r
\r
- if (bmp == null)\r
+ if (cacheIsEmpty)\r
UpdateGraphic ();\r
\r
Rectangle rb = Parent.ContextCoordinates(Slot);\r
\r
- using (ImageSurface source = new ImageSurface(bmp, Format.Argb32, rb.Width, rb.Height, 4 * Slot.Width)) {\r
+ #if CAIRO_GL\r
+ using (Surface source = new GLSurface\r
+ (device, Content.ColorAlpha, texID, rb.Width, rb.Height)) {\r
+ #else\r
+ using (Surface source =\r
+ new ImageSurface(bmp, Format.Argb32, rb.Width, rb.Height, 4 * Slot.Width)) {\r
+ #endif\r
if (this.Background == Color.Clear) {\r
ctx.Save ();\r
ctx.Operator = Operator.Clear;\r
}\r
}\r
\r
+ public void DeleteCache()\r
+ {\r
+ #if CAIRO_GL\r
+ if (GL.IsTexture(texID))\r
+ GL.DeleteTexture(texID);\r
+ #else\r
+ bmp = null;\r
+ #endif \r
+ }\r
+\r
#region Keyboard handling\r
public virtual void onKeyDown(object sender, KeyboardKeyEventArgs e){\r
KeyDown.Raise (sender, e);\r
if (layoutType == LayoutingType.PositionChildren) { \r
ComputeChildrenPositions ();\r
//if no layouting remains in queue for item, registre for redraw\r
- if (Interface.LayoutingQueue.Where (lq => lq.GraphicObject == this).Count () <= 0 && bmp==null)\r
+ if (Interface.LayoutingQueue.Where (lq => lq.GraphicObject == this).Count () <= 0 && cacheIsEmpty)\r
this.RegisterForRedraw ();\r
}else\r
base.UpdateLayout(layoutType);\r
if ( !Visible )\r
return;\r
\r
- if (bmp == null)\r
+ if (cacheIsEmpty)\r
UpdateGraphic ();\r
else {\r
\r
if (!DrawingIsValid || clip != null) {//false when 1 child has changed\r
//child having their content changed has to be repainted\r
//and those with slot intersecting clip rectangle have also to be repainted\r
-\r
- using (ImageSurface cache =\r
- new ImageSurface (bmp, Format.Argb32, Slot.Width, Slot.Height, Slot.Width * 4)) {\r
+ #if CAIRO_GL\r
+ using (Surface cache = new GLSurface\r
+ (device, Content.ColorAlpha, texID, Slot.Width, Slot.Height)) {\r
+ #else\r
+ using (Surface cache =\r
+ new ImageSurface(bmp, Format.Argb32, Slot.Width, Slot.Height, 4 * Slot.Width)) {\r
+ #endif\r
Context gr = new Context (cache);\r
clip.clearAndClip (gr);\r
\r
{
public TexturedShader ()
{
+ vertSource = @"
+ #version 130
+
+ precision highp float;
+
+ uniform mat4 Projection;
+ uniform mat4 ModelView;
+ uniform mat4 Model;
+ uniform mat4 Normal;
+
+ in vec2 in_position;
+ in vec2 in_tex;
+ out vec2 texCoord;
+
+
+ void main(void)
+ {
+ texCoord = in_tex;
+ gl_Position = Projection * ModelView * Model * vec4(in_position, 0, 1);
+ }";
fragSource = @"
#version 130
precision highp float;
public OpenTKGameWindow(int _width, int _height, string _title="golib")\r
: base(_width, _height, new OpenTK.Graphics.GraphicsMode(32, 24, 0, 1), \r
_title,GameWindowFlags.Default,DisplayDevice.GetDisplay(DisplayIndex.Second),\r
- 3,3,OpenTK.Graphics.GraphicsContextFlags.Debug)\r
+ 3,3,OpenTK.Graphics.GraphicsContextFlags.Default)\r
// public OpenTKGameWindow(int _width, int _height, string _title="golib")\r
// : base(_width, _height, new OpenTK.Graphics.GraphicsMode(32, 24, 0, 8), _title)\r
{\r
#region graphic contexte\r
Context ctx;\r
Surface surf;\r
+ #if CAIRO_GL\r
+ public Device device;\r
+ OpenTK.Graphics.IGraphicsContext cairoGLContext;\r
+ #else\r
byte[] bmp;\r
- int texID;\r
+ #endif\r
+\r
+ uint texID;\r
\r
public QuadVAO uiQuad, uiQuad2;\r
go.GLBackend.Shader shader;\r
\r
Rectangle dirtyZone = Rectangle.Empty;\r
void createContext()\r
- { \r
+ {\r
+ #if CAIRO_GL\r
+ cairoGLContext.MakeCurrent(this.WindowInfo);\r
+ #endif\r
+\r
createOpenGLSurface ();\r
\r
+ #if CAIRO_GL\r
+ this.MakeCurrent();\r
+ #endif\r
+\r
if (uiQuad != null)\r
uiQuad.Dispose ();\r
uiQuad = new QuadVAO (0, 0, ClientRectangle.Width, ClientRectangle.Height, 0, 1, 1, -1);\r
(0, ClientRectangle.Width, ClientRectangle.Height, 0, 0, 1); \r
\r
redrawClip.AddRectangle (ClientRectangle);\r
+\r
+\r
}\r
void createOpenGLSurface()\r
{\r
currentWindow = this;\r
\r
- int stride = 4 * ClientRectangle.Width;\r
- int bmpSize = Math.Abs (stride) * ClientRectangle.Height;\r
- bmp = new byte[bmpSize];\r
-\r
//create texture\r
if (GL.IsTexture(texID))\r
GL.DeleteTexture (texID);\r
GL.ActiveTexture (TextureUnit.Texture0);\r
GL.BindTexture(TextureTarget.Texture2D, texID);\r
\r
+ #if CAIRO_GL\r
+ if (surf != null)\r
+ surf.Dispose(); \r
+ GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, \r
+ ClientRectangle.Width, ClientRectangle.Height, 0,\r
+ OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero);\r
+ surf = new Cairo.GLSurface (device, Cairo.Content.ColorAlpha, texID, \r
+ ClientRectangle.Width, ClientRectangle.Height);\r
+ #else\r
+ int stride = 4 * ClientRectangle.Width;\r
+ int bmpSize = Math.Abs (stride) * ClientRectangle.Height;\r
+ bmp = new byte[bmpSize];\r
+\r
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, \r
ClientRectangle.Width, ClientRectangle.Height, 0,\r
OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, bmp);\r
\r
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);\r
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);\r
-\r
+ #endif\r
GL.BindTexture(TextureTarget.Texture2D, 0);\r
\r
- shader.Texture = texID;\r
+ shader.Texture = (int)texID;\r
}\r
void OpenGLDraw()\r
{\r
\r
shader.Enable ();\r
\r
+ #if CAIRO_GL\r
+ #else\r
GL.TexSubImage2D (TextureTarget.Texture2D, 0,\r
0, 0, ClientRectangle.Width, ClientRectangle.Height,\r
OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, bmp);\r
-\r
+ #endif\r
uiQuad.Render (PrimitiveType.TriangleStrip);\r
\r
GL.BindTexture(TextureTarget.Texture2D, 0);\r
shader.Disable ();\r
GL.Viewport (viewport [0], viewport [1], viewport [2], viewport [3]);\r
}\r
-// public void RenderCustomTextureOnUIQuad(int _customTex)\r
-// {\r
-// GL.GetInteger (GetPName.Viewport, viewport);\r
-// GL.Viewport (0, 0, ClientRectangle.Width, ClientRectangle.Height);\r
-//\r
-// shader.Enable ();\r
-//\r
-// GL.ActiveTexture (TextureUnit.Texture0);\r
-// GL.BindTexture (TextureTarget.Texture2D, _customTex);\r
-// GL.Disable (EnableCap.DepthTest);\r
-// uiQuad2.Render (PrimitiveType.TriangleStrip);\r
-// GL.Enable (EnableCap.DepthTest);\r
-// GL.BindTexture(TextureTarget.Texture2D, 0);\r
-// shader.Disable ();\r
-// GL.Viewport (viewport [0], viewport [1], viewport [2], viewport [3]); \r
-// }\r
- \r
+\r
#endregion\r
\r
#region update\r
guTime.Reset ();\r
drawingTime.Reset ();\r
\r
+ #if CAIRO_GL\r
+ GraphicObject.device = device;\r
+ cairoGLContext.MakeCurrent(this.WindowInfo);\r
+ #else\r
surf = new ImageSurface(bmp, Format.Argb32, ClientRectangle.Width, ClientRectangle.Height,ClientRectangle.Width*4);\r
+ #endif\r
+\r
ctx = new Context(surf);\r
\r
if (Interface.LoadingLists.Count > 0) {\r
redrawClip.Reset ();\r
}\r
}\r
+ surf.Flush ();\r
//surf.WriteToPng (@"/mnt/data/test.png");\r
ctx.Dispose ();\r
+ #if CAIRO_GL\r
+ this.MakeCurrent ();\r
+ #else\r
surf.Dispose ();\r
+ #endif\r
+\r
+\r
+\r
// if (ToolTip.isVisible) {\r
// ToolTip.panel.processkLayouting();\r
// if (ToolTip.panel.layoutIsValid)\r
{\r
GLClear ();\r
\r
-\r
base.OnRenderFrame(e);\r
\r
OnRender (e);\r
int mts = GL.GetInteger (GetPName.MaxTextureSize);\r
\r
shader = new go.GLBackend.TexturedShader ();\r
+\r
+ #if CAIRO_GL\r
+ cairoGLContext = OpenTK.Platform.Utilities.CloneGLContext (this);\r
+ IntPtr dpy = OpenTK.Platform.Utilities.GetDisplay(this.WindowInfo);\r
+ cairoGLContext.MakeCurrent(this.WindowInfo);\r
+ device = new Cairo.Device (dpy, \r
+ (cairoGLContext as OpenTK.Graphics.IGraphicsContextInternal).Context.Handle); \r
+ #endif\r
}\r
\r
protected override void OnResize(EventArgs e)\r