View Full Version : C# OpenGL moving Balls

12-12-2011, 05:00 PM
Hello all please can I have your help. I'm trying to get this program to work. basically its balls moving around the screen, but i can't seem to get it to work. I know its to do with my update method but i'm not to sure how about to go and correct this. here is my code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenGL;
using _08240FormsLibrary;

namespace LearnVector2d
class World

private Circle m_Circle = new Circle(new Vector2d(0.0f, 0.0f), new Vector2d(1.0f, 0.0f), 1.0f);
private List<Circle> m_Circles = new List<Circle>();

private HiResTimer m_Timer = new HiResTimer();

public void Draw()

GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); // clear some buffers //to give a fresh scene
GL.glLoadIdentity(); // Load Identity Matrix
GL.glTranslatef(0.0f, 0.0f, -3.0f); // Translate 3 Units Into The Screen
foreach(Circle circle in m_Circles)
GL.glFlush(); // Flush commands to graphics card

public void Update()
float timeStep = m_Timer.Seconds;


public World()
for (float i = 0, yPos = -1, xVel = 0.4f; i < 10; ++i, yPos += 0.2f, xVel += 0.2f)
Circle circle = new Circle(new Vector2d(0.0f, yPos), new Vector2d(xVel, 0.0f), 0.1f); m_Circles.Add(circle);

Much Appreciated

carsten neumann
12-12-2011, 05:12 PM
Please use [ code]/[ /code] (without space after '[') around code snippets to make them more readable.

You are not saying what exactly the problem is, i.e. what is happening vs. what you'd want to happen. Also, all the interesting stuff of the update presumably happens in Circle::Update(float time), but you haven't posted that code, please do.

The Forum Posting Guidelines (http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&amp;Number=305969&amp;an=2#Pos t305969) have additional hints how to make posts in a way that they can be easily answered.