Quantcast
Channel: SharpGL
Viewing all 104 articles
Browse latest View live

Created Unassigned: SharpGL interfering with propertyGrid [1622]

$
0
0
SharpGL seems to interfere with the C# propertyGrid control.

A Boolean value in the propertyGrid, has a down arrow which produces a selection box to allow value changing from true to false.

At slow SharpGL frame rates (~10fps) the __drop down selection box stops working__ (first click may work).
The Boolean value can still be changed by double clicking on the True/False text.

It's weird!
It's like the SharpGL control is interfering with the window control messages. Is it possible?

Tested in a separate (bare minimum) project/application (as attached) and have same result.
Tested in XP and win 7.

Issue is of low importance, however I wonder if other controls have similar issues.

New Comment on "Fundamentals"

$
0
0
Near the top of the tutorial you have // Get a reference to the OpenGL object. OpenGL gl = openGLCtrl1.OpenGL; However, I don't have access to this ctrl object.

Created Unassigned: openGLCtrl1? [1625]

$
0
0
Under the 'Fundamentals' section of 'Documentation' you have the following code:

// Get a reference to the OpenGL object.
OpenGL gl = openGLCtrl1.OpenGL;

Where in the world did openGLCtrl1 come from?
I have no access to that object. It doesn't exist.

New Comment on "Sample Applications"

$
0
0
Is there someone I can call to get some immediate help on this? I am trying to get some simple modern SharpGL working and I downloaded the example and all. Thanks.

New Post: SharpGL FBO and High Res Texture Question

$
0
0
I am attempting to create an OpenGL Spherical Viewer using SharpGL and Visual Studio 2010. I used the SharpGL WinForms template to start my code. I am using equrectangular jpeg images that are 8000x4000 pixels in size. I am using the SharpGL.SceneGraph.Texture object to load my images into a texture. I am binding the texture to a sphere created using the SharpGL.SceneGraph.Quadrics.Sphere object.

My first attempt yielded my sphere however the ScheneGraph.Texture code down-sampled my texture to 1024x1024 pixels. OK, at least I got something. After some browsing of this forum I determined that I should change my RenderContextType from DIBSection to FBO. This yielded a sphere with a texture, but again the ScheneGraph.Texture down-sampled my image/texture to 4096x2048. I figure great, I'm half way home.

The next thing I do to remedy my situation is change the OpenGLVersion from OpenGL2_1 to OpenGL4_4. Only now nothing gets rendered and my form remains black. So, I figure I've done something wrong. In an effort to remove my code from the equation I open the SharpGL Examples Solution and debug the "RenderContextsSample" code. It opens and runs with no complaint and displays four tabs, each with a SharpGL control on it and each control us using a different RenderContextType and all are using an OpenGLVersion of OpenGL2_1.

Then I change the OpenGLVersion of the control on the FBO tab from OpenGL2_1 to OpenGL3_0. I debug the project. Low and behold the FBO tab does not work. I modify all the other tabs and none of them work with an OpenGLVersion any higher than OpenGL2_1.

My Video Card is an NVIDIA Quatro 2000 and it is capable of rendering these images at full resolution as I have tested other viewers. I just need to write my own viewer so I can control it and pass information and/or control back and forth between my viewer and my GIS software.

Does anyone have an example using FBO, SharpGL, OpenGL newer than 2.1 and a textured quadric? I know I am asking a lot and will gladly accept guidance over code as long as I am lead closer to my goal.

I believe it was Pascal who said "We are usually convinced more easily by reasons we have found ourselves, than by those which have occurred to others." But that doesn't mean I won't listen to others.

Respectfully;

Windknot

Commented Unassigned: SharpGL interfering with propertyGrid [1622]

$
0
0
SharpGL seems to interfere with the C# propertyGrid control.

A Boolean value in the propertyGrid, has a down arrow which produces a selection box to allow value changing from true to false.

At slow SharpGL frame rates (~10fps) the __drop down selection box stops working__ (first click may work).
The Boolean value can still be changed by double clicking on the True/False text.

It's weird!
It's like the SharpGL control is interfering with the window control messages. Is it possible?

Tested in a separate (bare minimum) project/application (as attached) and have same result.
Tested in XP and win 7.

Issue is of low importance, however I wonder if other controls have similar issues.
Comments: ** Comment from web user: AORD **

I guess I may be expecting too much from the windows message system while under massive openGL vertex load.

The solution maybe to use RenderTrigger set to manual (this shows up in the openGLControl properties window depending on SharpGL version) .

Commented Unassigned: openGLCtrl1? [1625]

$
0
0
Under the 'Fundamentals' section of 'Documentation' you have the following code:

// Get a reference to the OpenGL object.
OpenGL gl = openGLCtrl1.OpenGL;

Where in the world did openGLCtrl1 come from?
I have no access to that object. It doesn't exist.
Comments: ** Comment from web user: AORD **


openGLCtrl is a control on your form (like a button or combobox etc). But you have to add the project template.

Try http://www.codeproject.com/Articles/749543/OpenGL-in-NET-Getting-Started

or https://github.com/dwmkerr/sharpgl/releases.

What you do is install the project template (I think for Visual Studio 2010 and 2012 only)

When you start a new C# project by clicking "New Project",
you then select "SharpGL Windows Forms Application" instead of "Windows Form Application".

This sets up all the basic openGL stuff for you!!!!
You will then see OpenGL gl = openGLControl.OpenGL; in the SharpGLForm.

If you can't get that working try downloading an existing SharpGL project and opening it and have a play to see how it works.

New Post: SharpGL FBO and High Res Texture Question

$
0
0
So, I think I found the code that limits me to OpenGLVersion.OpenGL2_1. It is in a portion of the RenderContextProviders module of the SharpGL project. The code follows:
    protected void UpdateContextVersion(OpenGL gl)
    {
        //  If the request version number is anything up to and including 2.1, standard render contexts
        //  will provide what we need (as long as the graphics card drivers are up to date).
        var requestedVersionNumber = VersionAttribute.GetVersionAttribute(requestedOpenGLVersion);
        if (requestedVersionNumber.IsAtLeastVersion(3, 0) == false)
            {
            createdOpenGLVersion = requestedOpenGLVersion;
            return;
        }

        //  Now the none-trivial case. We must use the WGL_ARB_create_context extension to 
        //  attempt to create a 3.0+ context.
        try
        {
            int[] attributes = 
            {
                OpenGL.WGL_CONTEXT_MAJOR_VERSION_ARB, requestedVersionNumber.Major,  
                OpenGL.WGL_CONTEXT_MINOR_VERSION_ARB, requestedVersionNumber.Minor,
                OpenGL.WGL_CONTEXT_FLAGS_ARB, OpenGL.WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,
                0
            };
            var hrc = gl.CreateContextAttribsARB(IntPtr.Zero, attributes);
            Win32.wglMakeCurrent(IntPtr.Zero, IntPtr.Zero);
            Win32.wglDeleteContext(renderContextHandle);
            Win32.wglMakeCurrent(deviceContextHandle, hrc);
            renderContextHandle = hrc; 
        }
        catch(Exception)
        {
            //  TODO: can we actually get the real version?
            createdOpenGLVersion = OpenGLVersion.OpenGL2_1;
        }
    }
So, according to the line " if (requestedVersionNumber.IsAtLeastVersion(3, 0) == false)" when I request version 2.1 or lower the created version gets set to the requested version. However if the version is 3.0 or greater it becomes a "none-trivial case." I gather from the code that it attempts to generate a rendering context handle and should it fail it falls back on OpenGLVersion.OpenGL2_1. Considering that I get a blank screen when I change the controls context version to something higher to 2.1 a new "hrc" and "renderContexHandle" is created, but somehow not used or not used properly. If the "try" code has an exception the fallback it 2.1 which has been demonstrated to work, so I don't think an exception is being raised there. I suppose I could create a break point near this code to check for an exception.

In order to create a work around and try newer versions of OpenGL, I modified the "if...IsAtLeast..." line to pass on contexts < 4.4 because I am confident my video card uses version 4.4. This work around did change the behavior of the form and it successfully rendered my sphere and texture when I set the OpenGLVersion of the control to 3.0 and up to 4.3. However this work around did not solve my initial problem with the down-sampling of the texture "resolution." I am definitely going to have to take another look at the "Texture" class of the SharpGL.ScheneGraph Project.

Respectfully;

Windknot

New Post: SharpGL FBO and High Res Texture Question

$
0
0
First and foremost I would like to thank Dave Kerr for all his work on the SharpGL project. I would also like to thank him for posting his source code so that novices such as myself can learn. My initial question was why can't I use a texture where the initial image was 8000x4000 pixels. I've been dancing around the solution for a few days now and finally pinned it down to code in the "Texture" class of the SharpGL.SceneGraph project. More specifically in "Create" method of the SharpGL.SceneGraph.Assets.Texture code.
        /// <summary>
        /// This function creates the texture from an image.
        /// </summary>
        /// <param name="gl">The OpenGL object.</param>
        /// <param name="image">The image.</param>
        /// <returns>True if the texture was successfully loaded.</returns>
        public virtual bool Create(OpenGL gl, Bitmap image)
        {
            //  Create the underlying OpenGL object.
            Create(gl);

            //  Get the maximum texture size supported by OpenGL.
            int[] textureMaxSize = { 0 };
            gl.GetInteger(OpenGL.GL_MAX_TEXTURE_SIZE, textureMaxSize);

            //  Find the target width and height sizes, which is just the highest
            //  posible power of two that'll fit into the image.

            int targetWidth = textureMaxSize[0];
            int targetHeight = textureMaxSize[0];

            for (int size = 1; size <= textureMaxSize[0]; size *= 2)
            {
                if (image.Width < size)
                {
                    targetWidth = size / 2;
                    break;
                }
                if (image.Width == size)
                    targetWidth = size;

            }

            for (int size = 1; size <= textureMaxSize[0]; size *= 2)
            {
                if (image.Height < size)
                {
                    targetHeight = size / 2;
                    break;
                }
                if (image.Height == size)
                    targetHeight = size;
            }

            //  If need to scale, do so now.
            if (image.Width != targetWidth || image.Height != targetHeight)
            {
                System.Windows.Forms.MessageBox.Show("IWidth: " + image.Width.ToString() + "  IHeight: " + image.Height.ToString() + " TWidth: " + targetWidth.ToString() + " THeight: " + targetHeight.ToString());

                //  Resize the image.
                Image newImage = image.GetThumbnailImage(targetWidth, targetHeight, null, IntPtr.Zero);

                //  Destory the old image, and reset.
                image.Dispose();
                image = (Bitmap)newImage;
            }

            //  Lock the image bits (so that we can pass them to OGL).
            BitmapData bitmapData = image.LockBits(new Rectangle(0, 0, image.Width, image.Height),
                ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);

            //  Set the width and height.
            width = image.Width;
            height = image.Height;

            //  Bind our texture object (make it the current texture).
            gl.BindTexture(OpenGL.GL_TEXTURE_2D, TextureName);

            //  Set the image data.
            gl.TexImage2D(OpenGL.GL_TEXTURE_2D, 0, (int)OpenGL.GL_RGBA,
                width, height, 0, OpenGL.GL_BGRA, OpenGL.GL_UNSIGNED_BYTE,
                bitmapData.Scan0);

            //  Unlock the image.
            image.UnlockBits(bitmapData);

            //  Dispose of the image file.
            image.Dispose();

            //  Set linear filtering mode.
            gl.TexParameter(OpenGL.GL_TEXTURE_2D, OpenGL.GL_TEXTURE_MIN_FILTER, OpenGL.GL_LINEAR);
            gl.TexParameter(OpenGL.GL_TEXTURE_2D, OpenGL.GL_TEXTURE_MAG_FILTER, OpenGL.GL_LINEAR);

            //  We're done!
            return true;
        }
The first thing this code does is to get the Max Texture Size form the current OpenGL context. In my case that is 16384. Then it runs through two loops calculating powers of 2 (stored in the "size" variable) from 1 to the Max Texture Size (1, 2, 4, 8, 16, ... 1024, 2048, 4096, 8192, ...) till the power of 2 was greater than the image height or width (depending on the loop). When the power of 2 jumps beyond the image size, it divides the power of 2 or "size" by 2 to get the largest power of 2 not greater than the image size. Where this hoses me for my width is the loop counts up to 8192 which is greater than my width of 8000 and then divides that by 2 which ends up being 4096. The same thing happens for my height of 4000. The code loops through to 4096 which is greater than 4000, so it divides by two and returns 2048. 4096x2048 is just over half the resolution of my image.

The code then goes on to compare the "targetWidth" and "targetHeight" to the image width and height. If they don't match, the code then re-samples the image to the "targetWidth" and "targetHeight" which ends giving me a texture at a little over 1/2 my initial resolution. My work around is to let it do its thing and then just set the "targetWidth" and "targetHeight" to my image's width and height prior to the code that ordinarily would re-scale the image / texture.

I have learned a lot from Mr. Kerr's code. However the most important thing I've learned is that I still have a lot to learn.

Respectfully;


Windknot

New Post: SharpGL FBO and High Res Texture Question

$
0
0
"Does anyone have an example using FBO, SharpGL, OpenGL newer than 2.1 and a textured quadric?"

I have an image example using FBO, using a gl.BindTexture to OpenGL.GL_QUADS.
I'm running Nvidia Geforce GT560 which uses (installs) 4.1 or 4.1 OpenGL.

My example project is in VS 2010 but I can convert to VS2012 or VS2013 if you want it.
Not sure where I can upload my project?
If you give me you email I can email to you.

Attached is complete code, which might be enough:
public partial class SharpGLForm : Form
    {
        private bool TexturesInitialised = false;

        private Bitmap gImage1;
        private System.Drawing.Imaging.BitmapData gbitmapdata;
        private uint[] gtexture = new uint[1];

        public SharpGLForm()
        {
            InitializeComponent();
        }

        private void IntialiseTexture(ref OpenGL gl)
        {
            gImage1 = new Bitmap(@"C:\Ruapehu 8000x4000 super big.jpg");  //Environment.GetFolderPath(Environment.SpecialFolder.MyPictures)

            Rectangle rect = new Rectangle(0, 0, gImage1.Width, gImage1.Height);
            gbitmapdata = gImage1.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
            gImage1.UnlockBits(gbitmapdata);
            gl.GenTextures(1, gtexture);
            gl.BindTexture(OpenGL.GL_TEXTURE_2D, gtexture[0]);
            gl.TexImage2D(OpenGL.GL_TEXTURE_2D, 0, (int)OpenGL.GL_RGB8, gImage1.Width, gImage1.Height, 0, OpenGL.GL_BGR_EXT, OpenGL.GL_UNSIGNED_BYTE, gbitmapdata.Scan0);
            uint[] array = new uint[] { OpenGL.GL_NEAREST };
            gl.TexParameterI(OpenGL.GL_TEXTURE_2D, OpenGL.GL_TEXTURE_MIN_FILTER, array);
            gl.TexParameterI(OpenGL.GL_TEXTURE_2D, OpenGL.GL_TEXTURE_MAG_FILTER, array);

            TexturesInitialised = true;
        }

      
        private void openGLControl_OpenGLDraw(object sender, RenderEventArgs e)
        {  
            OpenGL gl = openGLControl.OpenGL;
            gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT);

            gl.LoadIdentity();

            if (!TexturesInitialised)
                IntialiseTexture(ref gl);

            gl.Enable(OpenGL.GL_TEXTURE_2D);
           
            gl.BindTexture(OpenGL.GL_TEXTURE_2D, gtexture[0]);
           
            gl.Color(1.0f, 1.0f, 1.0f, 0.1f); //Must have, weirdness!
            gl.Begin(OpenGL.GL_QUADS);
            gl.TexCoord(1.0f, 1.0f);            
            gl.Vertex(gImage1.Width, gImage1.Height, 1.0f);     
            gl.TexCoord(0.0f, 1.0f);            
            gl.Vertex(0.0f, gImage1.Height, 1.0f);      
            gl.TexCoord(0.0f, 0.0f);        
            gl.Vertex(0.0f, 0.0f, 1.0f);
            gl.TexCoord(1.0f, 0.0f);        
            gl.Vertex(gImage1.Width, 0.0f, 1.0f);       
            gl.End();
            gl.Disable(OpenGL.GL_TEXTURE_2D); 
        }

        private void openGLControl_OpenGLInitialized(object sender, EventArgs e)
        {
            OpenGL gl = openGLControl.OpenGL;
            gl.ClearColor(0, 0, 0, 0);
        }

        private void openGLControl_Resized(object sender, EventArgs e)
        { 
            OpenGL gl = openGLControl.OpenGL;
            gl.MatrixMode(OpenGL.GL_PROJECTION);
            gl.LoadIdentity();
            gl.Perspective(60.0f, (double)Width / (double)Height, 100, 100000.0); //Changed
            gl.LookAt(0, 0, -20000, 0, 0, 0, 0, 1, 0);//Changed
            gl.MatrixMode(OpenGL.GL_MODELVIEW);
        }
    }

New Post: Querying for max texture units returns 0

$
0
0
These calls worked for me:
            int[] max1 = new int[1];
            gl.GetInteger(OpenGL.GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB, max1);

            int[] max2 = new int[1];
            gl.GetInteger(OpenGL.GL_MAX_TEXTURE_BUFFER_SIZE, max2);

            int[] max3 = new int[1];
            gl.GetInteger(OpenGL.GL_MAX_TEXTURE_UNITS_ARB, max3);
max1[0] = 192
max2[0] = 134,217,728
max3[0] = 4

"Is there something I should be doing on my system to support textures? " I don't think so.
I think SharpGL just passes on the methods to openGL and textures are an important part of openGL, so they would be included in all versions.

From https://github.com/dwmkerr/sharpgl"SharpGL wraps all modern OpenGL features."

From https://github.com/dwmkerr/sharpgl/wiki
"OpenGL constants are named in exactly the same way as they are in OpenGL and are constant members of the OpenGL class"
"OpenGL functions are named in exactly the same way as they are in OpenGL - except that the 'gl' prefix is removed"

From https://github.com/dwmkerr/sharpgl/wiki/OpenGL-Compatibility
"SharpGL supports almost all extensions and the core functionality of OpenGL to version 4.2."

New Post: SharpGL FBO and High Res Texture Question

$
0
0
The following Sphere with Texture code works for me:

However, I'm not 100% sure if the image is scaled. It looks ok to me. How could you tell, did it look f-ugly?
I'm just calling gl.BindTexture before the sphere.Render to texture map.
I'm not sure how the texture mapping lines up to the sphere or how to change it.

Settings:
8000x4000 pixels
OpenGLVersion = OpenGL2_1
RenderContextType = FBO or NativeWindow

It is a hack together (not checked for bugs).
       public partial class SharpGLForm : Form
    {
        private bool TexturesInitialised = false;
        private float rotation = 0.0f;
        private float Scale = 1;

        private Bitmap gImage1;
        private System.Drawing.Imaging.BitmapData gbitmapdata;
        private uint[] gtexture = new uint[1];

        SharpGL.SceneGraph.Quadrics.Sphere sphere = new SharpGL.SceneGraph.Quadrics.Sphere();

        public SharpGLForm()
        {
            InitializeComponent();
        }

        private void InitialiseTexture(ref OpenGL gl)
        {
            gImage1 = new Bitmap(@"C:\Ruapehu 8000x4000 super big.bmp");//Environment.GetFolderPath(Environment.SpecialFolder.MyPictures)

            Rectangle rect = new Rectangle(0, 0, gImage1.Width, gImage1.Height);
            gbitmapdata = gImage1.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
            gImage1.UnlockBits(gbitmapdata);
            gl.GenTextures(1, gtexture);
            gl.BindTexture(OpenGL.GL_TEXTURE_2D, gtexture[0]);
            gl.TexImage2D(OpenGL.GL_TEXTURE_2D, 0, (int)OpenGL.GL_RGB8, gImage1.Width, gImage1.Height, 0, OpenGL.GL_BGR_EXT, OpenGL.GL_UNSIGNED_BYTE, gbitmapdata.Scan0);
            uint[] array = new uint[] { OpenGL.GL_NEAREST };
            gl.TexParameterI(OpenGL.GL_TEXTURE_2D, OpenGL.GL_TEXTURE_MIN_FILTER, array);
            gl.TexParameterI(OpenGL.GL_TEXTURE_2D, OpenGL.GL_TEXTURE_MAG_FILTER, array);

            TexturesInitialised = true;
        }

        private void InitialiseSphere(ref OpenGL gl)
        {
            sphere.QuadricDrawStyle = SharpGL.SceneGraph.Quadrics.DrawStyle.Fill;
            sphere.CreateInContext(gl);
            sphere.Slices = 100;
            sphere.Stacks = 100;
            sphere.TextureCoords = false;
            sphere.Radius = 4000;
            sphere.TextureCoords = true;
        }
      
        private void openGLControl_OpenGLDraw(object sender, RenderEventArgs e)
        {  
            OpenGL gl = openGLControl.OpenGL;
            gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT);

            gl.LoadIdentity();

            gl.Rotate(rotation, 0.0f, 1.0f, 0.0f);
            gl.Scale(Scale, Scale, Scale);

            if (!TexturesInitialised)
            {
                InitialiseTexture(ref gl);
                InitialiseSphere(ref gl);
            }

            gl.Enable(OpenGL.GL_TEXTURE_2D);
           
            gl.BindTexture(OpenGL.GL_TEXTURE_2D, gtexture[0]);

            gl.Color(1.0f, 1.0f, 1.0f, 0.1f); //Must have, weirdness!
            sphere.Render(gl, SharpGL.SceneGraph.Core.RenderMode.Render);

           // gl.Color(1.0f, 1.0f, 1.0f, 0.1f); //Must have, weirdness!
            gl.Begin(OpenGL.GL_QUADS);
            gl.TexCoord(1.0f, 1.0f);            
            gl.Vertex(gImage1.Width, gImage1.Height, 1.0f);     
            gl.TexCoord(0.0f, 1.0f);            
            gl.Vertex(0.0f, gImage1.Height, 1.0f);      
            gl.TexCoord(0.0f, 0.0f);        
            gl.Vertex(0.0f, 0.0f, 1.0f);
            gl.TexCoord(1.0f, 0.0f);        
            gl.Vertex(gImage1.Width, 0.0f, 1.0f);       
            gl.End();
            gl.Disable(OpenGL.GL_TEXTURE_2D);
        }

        private void openGLControl_OpenGLInitialized(object sender, EventArgs e)
        {
            OpenGL gl = openGLControl.OpenGL;
            gl.ClearColor(0, 0, 0, 0);
        }

        private void openGLControl_Resized(object sender, EventArgs e)
        { 
            OpenGL gl = openGLControl.OpenGL;
            gl.MatrixMode(OpenGL.GL_PROJECTION);
            gl.LoadIdentity();
            gl.Perspective(60.0f, (double)Width / (double)Height, 100, 100000.0); //Changed
            gl.LookAt(0, 0, -20000, 0, 0, 0, 0, 1, 0);//Changed
            gl.MatrixMode(OpenGL.GL_MODELVIEW);
        }

        private void buttonRotate_Click(object sender, EventArgs e)
        {
           rotation += 3.0f;
        }

        private void buttonZoomIn_Click(object sender, EventArgs e)
        {
            Scale -= 0.5f;        
        }

        private void buttonZoomOut_Click(object sender, EventArgs e)
        {
            Scale += 0.5f;
        }
    }

New Post: SharpGL FBO and High Res Texture Question

$
0
0
AORD;

Thanks for your reply. I did not know if I needed a version greater than 2.1 or not. I was having a problem and thought that perhaps version 2.1 was limiting the resolution. I thought "older version = less memory = smaller bitmaps." It turns out I was wrong, but I wanted to change one variable in an ocean of unknowns. Even so, I also thought that what does work in version 2.1 should also work in version 3.0 and greater. However, the SharpGL code uses version 2.1 as a default.

When a user requests that SharpGL use a higher version the SharpGL code "attempts" to create a rendering context to the requested version. This "attempt" is within a "Try" and "Catch" block that rolls the rendering context back to version 2.1 "if" there is an exception. The problem with this "attempt" is that it appears to successfully create a rendering context by making calls to Windows and OpenGL and appears to never throw the exception, at least on my computer. However, the context that is created does not seem to make its way back to the control and your screen remains blank.

Respectfully;


Windknot

New Post: SharpGL FBO and High Res Texture Question

$
0
0
AORD;

I wish to publicly thank you for posting your examples. I will contact you outside of this discussion to let you know how I can be reached and set up a means by which you can send me your VS 2010 projects.

Sincerely;


Windknot

New Post: How to create a solid cone

$
0
0
How to draw solid cone with specific height using SharpGL?

New Post: How to create a solid cone

$
0
0
To make a Cone:

You can use gl.Cylinder( IntPtr, baseRadius, topRadius, height, slices, stackes);
https://www.opengl.org/sdk/docs/man2/xhtml/gluCylinder.xml
IntPtr i = new IntPtr();
i = gl.NewQuadric();
gl.QuadricNormals(i, OpenGL.GL_SMOOTH);
gl.Cylinder(i, 0, 2, 8, 120, 16);
Note:
I think, Cylinder is likely to use deprecated code (OpenGL 3.0 changed 2008/2009 to use vertex arrays for drawing).
Cylinder I believe, is part of GLUT utility toolkit that I believe uses depreciated OpenGL commands http://en.wikipedia.org/wiki/OpenGL_Utility_Toolkit.
I would still use this if I could easily change the code if required (used within my company or personal use or update customers code easily).
I guess what will happen at some stage, newer graphic cards will stop supporting OpenGL deprecated code.
Somebody please comment if I'm wrong on any of this (or if correct)!

To draw using Modern OpenGL you would use Vertex Array Object (VAO and VBO)
I would google "OpenGL Cylinder VAO" (which I didn't find much). You might find some C++ code and try to convert.
I would use VAO's and start by drawing triangles then a disk then use the disk points to draw to a point above the disk.

New Post: How to create a solid cone

$
0
0
Opp's you may want it to appear solid by adding a disk to the end!
IntPtr i = new IntPtr();
i = gl.NewQuadric();
gl.QuadricNormals(i, OpenGL.GL_SMOOTH);
gl.Cylinder(i, 2, 0, 8, 120, 16);
gl.Disk(i, 2, 0, 120, 1); 

New Post: SharpGL FBO and High Res Texture Question

New Post: gl.DrawElements example

New Post: gl.DrawElements example

$
0
0
Your link is faulty sends people to example.com?!?!?
Viewing all 104 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>