Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Zooming in C# using opengl

Zooming in C# using opengl

Scheduled Pinned Locked Moved C#
graphicscsharpgame-devhelpquestion
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    a_david123
    wrote on last edited by
    #1

    Dear All I have a program for line drawing in C# using CSGL(OpenGL), now i want to Zoom in and out that drawing line in openGL from the menu or from the Zoom button kindly any one help me? Regards:(( David

    david

    A 1 Reply Last reply
    0
    • A a_david123

      Dear All I have a program for line drawing in C# using CSGL(OpenGL), now i want to Zoom in and out that drawing line in openGL from the menu or from the Zoom button kindly any one help me? Regards:(( David

      david

      A Offline
      A Offline
      a_david123
      wrote on last edited by
      #2

      Dear all Regards following is my code for zooming a triangle, but it is not working , i think some problem in GLlookAt(); ----------------CODE---------------------- protected override void OnSizeChanged(EventArgs e) { base.OnSizeChanged(e); System.Drawing.Size s = Size; width = (double)s.Width; height = (double)s.Height; GL.glViewport(0,0,s.Width,s.Height); GL.glMatrixMode(GL.GL_PROJECTION); GL.glLoadIdentity(); GL.gluPerspective(60.0, (float)s.Width / (float)s.Height, 1.0, 50.0); GL.glMatrixMode(GL.GL_MODELVIEW); GL.glLoadIdentity(); } public override void glDraw() { GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer GL.glLoadIdentity(); // Reset The Current Modelview Matrix GL.gluLookAt(0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0); GL.glLoadIdentity(); GL.glTranslatef(-1.5f, 0.0f, -6.0f); // Move Left 1.5 Units And Into The Screen 6.0 GL.glBegin(GL.GL_TRIANGLES); // Drawing Using Triangles GL.glVertex3f(0.0f, 1.0f, 0.0f); // Top GL.glVertex3f(-1.0f, -1.0f, 0.0f); // Bottom Left GL.glVertex3f(1.0f, -1.0f, 0.0f); // Bottom Right GL.glEnd(); this.Refresh(); // GL.glFlush(); } ----------------------End---------------------------------------------------- kindly help me while zooming the above triangle. waiting for your help regards david:((

      david

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups