Micropro's picture

How i Can Use MultySample In My Program Please Help Me?

Hiiiiii

I Make Program and I have a problem with multysample

how i can use it in my program

i upload small program for Edit

please any one can edit in small program

http://www.slingfile.com/file/JAokuXfOkz

or

http://www.megaupload.com/?d=PNAZEZ94

thankssssssssssss
...........


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

In your GameWindow or GLControl constructor, set a GraphicsMode with multisampling (e.g. new GraphicsMode(32, 24, 0, 4) for 4x antialiasing). Check the GameWindow FSAA sample in the example browser for actual code. Check also this forum thread: http://www.opentk.com/node/2355

Micropro's picture

sorry

i Use this code
var game = new GameWindow(1024, 768, new GraphicsMode(32, 24, 0, 4));

but i dont know where insert this code i insert it in glcontrol1_load but my examlpe not runing

please edit example i uploaded

http://www.slingfile.com/file/JAokuXfOkz

or

http://www.megaupload.com/?d=PNAZEZ94

the Fiddler's picture

Oh, you are using GLControl. In that case, you need to create a new custom control that will inherit from GLControl:

class MyGLControl : GLControl
{
    public MyGLControl()
        : base(new GraphicsMode(32, 24, 0, 4)
    {
        InitializeComponents();
    }
}

I don't have visual studio right on this system, but IIRC you can right-click on your project and select "Add custom control" or "Add component" to create your custom control.

Micropro's picture

sorry i dont understand you this is thw code i use it in my program

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using OpenTK.Graphics;
using OpenTK;
using OpenTK.Graphics.OpenGL;
 
using System.Diagnostics;
using System.Drawing.Imaging;
using OpenTK.Input;
 
 
namespace Test_MultySample
{
 
 
    public partial class Form1 : Form
    {
        bool loaded = false;
 
 
        public Form1()
 
 
        {
 
            InitializeComponent();
        }
 
 
 
        private void SetupViewport() 
    { 
      int w = glControl1.Width; 
      int h = glControl1.Height; 
      GL.MatrixMode(MatrixMode.Projection); 
      GL.LoadIdentity(); 
      GL.Ortho(0, w, 0, h, -1, 1); // Bottom-left corner pixel has 
      GL.Viewport(0, 0, w, h); // Use all of the glControl painting 
 
    }
 
 
        private void Form1_Load(object sender, EventArgs e)
        {
 
        }
 
        private void glControl1_Load(object sender, EventArgs e)
        {
 
 
            loaded = true;
            GL.ClearColor(Color.SkyBlue);
            SetupViewport();
            var game = new GameWindow(749, 478, new GraphicsMode(32, 24, 0, 4));
 
        }
 
        private void glControl1_Resize(object sender, EventArgs e)
        {
            if (!loaded)
                return;
 
        }
 
        private void glControl1_KeyDown(object sender, KeyEventArgs e)
        {
 
        }
 
        private void glControl1_Paint(object sender, PaintEventArgs e)
        {
 
            if (!loaded) // Play nice 
                return;
            GL.Clear(ClearBufferMask.ColorBufferBit |
            ClearBufferMask.DepthBufferBit);
 
 
            GL.MatrixMode(MatrixMode.Modelview);
            GL.LoadIdentity();
 
            GL.Rotate(1, 0, 0, 1);
            GL.Color3(Color.Yellow);
            GL.Begin(BeginMode.Triangles);
            GL.Vertex2(10, 20);
            GL.Vertex2(100, 200);
            GL.Vertex2(100, 500);
            GL.End();
 
 
            glControl1.SwapBuffers(); 
        }
 
 
 
 
 
    }
}

please help me where i can insert myltisample

Micropro's picture

i can open the teamviewer program for you to edit in my program
just tell me

please it's important for me

avc81's picture

derive from GLControl and set a default constructor like this:

 Friend Sub New()
      MyBase.New(New GraphicsMode(New ColorFormat(32), 24, 0, 4), 1, 5, GraphicsContextFlags.Default)
 End Sub

hope this helps

Micropro's picture

Friend Sub New()
MyBase.New(New GraphicsMode(New ColorFormat(32), 24, 0, 4), 1, 5, GraphicsContextFlags.Default)
End Sub

i think thus code using in vb i use c#

please edit in my example and insert full code

by theway thanks for your help

Micropro's picture

Please Help me it's important for me................

the Fiddler's picture
  1. Create a new control that inherits from GLControl.
  2. In the constructor of this new control, call the base GLControl constructor with a multisampled GraphicsMode.
  3. Drag and drop your new control onto your Form.

Feel free to ask for more information if you don't know how to implement one of those steps. However, please don't ask other people to write your code from you.