RSS Forums RSS
Please support our C# advertiser: Programming Forums
Views: 6223 | Replies: 6
Reply
Join Date: Apr 2004
Posts: 555
Reputation: Dark_Omen is an unknown quantity at this point 
Rep Power: 6
Solved Threads: 5
Dark_Omen Dark_Omen is offline Offline
Posting Pro

openGL window forms in c#

  #1  
Mar 27th, 2006
Hey does anybody know how to make window forms using openGL in c sharp. Or know of a tutorial online, i've looked but turned up nothing useful, just that csGL is a good library to use for openGL projects.

Thanks
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Mar 2006
Posts: 219
Reputation: Lord Soth is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 3
Lord Soth's Avatar
Lord Soth Lord Soth is offline Offline
Posting Whiz in Training

Re: openGL window forms in c#

  #2  
Mar 27th, 2006
Hi

This is a sample C# app which draws a line using csGL. I hope it helps.

using System;
using System.Drawing;
using System.Windows.Forms;
using CsGL.OpenGL;

public class GLCanvas : Form
{
View view = new View();

public GLCanvas()
{
Text = "C# OpenGL Merhaba Dünya";
view.Dock = DockStyle.Fill;
Controls.Add(view);
}

public static void Main()
{
GLCanvas glc = new GLCanvas();
Application.Run(glc);
}
}


class View : OpenGLControl
{
public override void glDraw()
{
GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
GL.glLoadIdentity();
GL.glTranslatef( 0.0f, 0.0f, -10.0f );
GL.glColor3f(0.5f, 1, 1);

GL.glBegin(GL.GL_LINES);
GL.glVertex3d(0.0, 0.0, 0.0);
GL.glVertex3d(2.0, 2.0, 0.0);
GL.glEnd();
}

protected override void InitGLContext()
{
GL.glShadeModel(GL.GL_SMOOTH);
GL.glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
GL.glClearDepth(1.0f);
GL.glEnable(GL.GL_DEPTH_TEST);
GL.glDepthFunc(GL.GL_LEQUAL);
GL.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST);
}

protected override void OnSizeChanged(EventArgs e)
{
base.OnSizeChanged(e);

Size s = Size;
double aspect_ratio = (double)s.Width /(double) s.Height;

GL.glMatrixMode(GL.GL_PROJECTION);
GL.glLoadIdentity();
GL.gluPerspective(45.0f, aspect_ratio, 0.1f, 100.0f);

GL.glMatrixMode(GL.GL_MODELVIEW);
GL.glLoadIdentity();
}
}

Loren Soth
Reply With Quote  
Join Date: Apr 2004
Posts: 555
Reputation: Dark_Omen is an unknown quantity at this point 
Rep Power: 6
Solved Threads: 5
Dark_Omen Dark_Omen is offline Offline
Posting Pro

Re: openGL window forms in c#

  #3  
Mar 27th, 2006
what about making like GUI's using csGL and c#, do you know any tutorials for that?
Reply With Quote  
Join Date: Mar 2006
Posts: 219
Reputation: Lord Soth is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 3
Lord Soth's Avatar
Lord Soth Lord Soth is offline Offline
Posting Whiz in Training

Re: openGL window forms in c#

  #4  
Mar 28th, 2006
Hi,

I'm sorry I don't know one, but check GLScene (OpenGL Framework for Delphi) they have a cool OpenGL GUI subsystem with all the windows controls and HUD support, if you don't mind porting from Delphi to C#.

Loren Soth
Reply With Quote  
Join Date: Apr 2004
Posts: 555
Reputation: Dark_Omen is an unknown quantity at this point 
Rep Power: 6
Solved Threads: 5
Dark_Omen Dark_Omen is offline Offline
Posting Pro

Re: openGL window forms in c#

  #5  
Apr 7th, 2006
What about directX, can you make a GUI from that?
Reply With Quote  
Join Date: Mar 2006
Posts: 219
Reputation: Lord Soth is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 3
Lord Soth's Avatar
Lord Soth Lord Soth is offline Offline
Posting Whiz in Training

Re: openGL window forms in c#

  #6  
Apr 11th, 2006
Hi,

There are some frameworks on top of DirectX 9 Managed SDK but I am not familiar.

Loren Soth
Crimson K. Software _________________________________________________________________ Crimson K. Blog
Reply With Quote  
Join Date: Apr 2004
Posts: 555
Reputation: Dark_Omen is an unknown quantity at this point 
Rep Power: 6
Solved Threads: 5
Dark_Omen Dark_Omen is offline Offline
Posting Pro

Re: openGL window forms in c#

  #7  
Apr 17th, 2006
Do you know where I could find an API for that?
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 2:11 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC