Getting started with 2.1: PaintEventArgs vs. RenderEventArgs

Feb 9, 2013 at 6:51 PM
Edited Feb 9, 2013 at 7:27 PM
I am trying to create a new application based on your SimpleDrawingSample app, but am having problems.

I am using SharpGL 2.1. I uinstalled the 2.0 Visual Studio Extension and then installed 2.1. I verified in Extension manager that 2.1 is installed.

Then I created a new project based on the SharpGL template.

I observed that the created SharpGLForm uses PaintEventArgs, not RenderEventArgs:
"openGLControl_OpenGLDraw(object sender, PaintEventArgs e)"

My understanding is that it should have used RenderEventArgs.

I copied the SimpleDrawingApp .cs and .resx files into the same directory and added them to the project, intending to later replace SharpGLForm with the new form (FormSimpleDrawingSample) but when I tried to compile FormSimpleDrawingSample I got an error message that RenderEventArgs could not be found.

This sounds to me like it is still using SharpGL 2.0, which I thought that I had removed from the system.

Any suggestions on what I should do? I am running VS2010 Pro, Windows 7 64-bit Pro.

Thanks in advance,
Michael Bate
Feb 9, 2013 at 7:27 PM
Edited Feb 9, 2013 at 7:29 PM
I found something suspicious: Buried deep within my Windows AppData directory, at:

C:\Users\Michael\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Dave Kerr\SharpGL\2.1.0\~PC\ProjectTemplates\CSharp\1033\\Dependencies

are SharpGL.DLL (and SceneGraph and WinForms DLLs). When I check the properties of these files, I find that SharpGL.DLL (and also the Winforms DLL) are designated as version 2.0, NOT 2.1 which I would expect. SceneGraph has version 1.0.

If I check the versions of the binary files downloaded from this site, I find that all three DLLs are version 2.1.

The AppData directory above appears to be where the Visual Studio Extension for SharpGL is stored. If I look at the .cs files in the higher level directory, I see that they are all dated July 2012, prior to the release of version 2.1.

Appears to be a bug in SharpGL.vsix, unless I'm missing something.

Michael Bate
Feb 10, 2013 at 9:31 AM
Hi Michael,

It's a bug in the template - I'll raise it as a bug and fix it now, thanks for letting me know :)
Feb 10, 2013 at 9:37 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Feb 10, 2013 at 11:07 AM
OK Resolved, on the downloads page i've updated the templates :)
Apr 5, 2013 at 10:57 AM
When I make a WinForms app using the Wizard for 2012 and distributed dll's/references the demo app runs.
If I remove the distributed SharpGL refs and add the SharpGL and SharpGLWinForms projects into the same solution I get 2 errors. I think I am using latest soruce code.
        this.__openGLControl.BitDepth = 24;
        this.openGLControl.Dock = System.Windows.Forms.DockStyle.Fill;
        this.openGLControl.DrawFPS = true;
        this.openGLControl.FrameRate = 20;
        this.openGLControl.Location = new System.Drawing.Point(0, 0);
        this.openGLControl.Name = "openGLControl";
        this.openGLControl.RenderContextType = SharpGL.RenderContextType.FBO;
        this.openGLControl.Size = new System.Drawing.Size(624, 391);
        this.openGLControl.TabIndex = 0;
        this.openGLControl.OpenGLInitialized += new System.EventHandler(this.openGLControl_OpenGLInitialized);
        this.openGLControl.OpenGLDraw += new System.Windows.Forms.PaintEventHandler(this.openGLControl_OpenGLDraw);
C:\User Folders\SimFlex\src\util\Test\Test\SharpGLForm.Designer.cs(37,32,37,40): error CS1061: 'SharpGL.OpenGLControl' does not contain a definition for 'BitDepth' and no extension method 'BitDepth' accepting a first argument of type 'SharpGL.OpenGLControl' could be found (are you missing a using directive or an assembly reference?)
4>C:\User Folders\SimFlex\src\util\Test\Test\SharpGLForm.Designer.cs(47,46,47,119): error CS0029: Cannot implicitly convert type 'System.Windows.Forms.PaintEventHandler' to 'SharpGL.RenderEventHandler'