Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6919957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:05:16+00:00 2026-05-27T10:05:16+00:00

Any help with this I’m using OpenGL with C#. I cant use any other

  • 0

Any help with this I’m using OpenGL with C#. I cant use any other libraries other than:

using System;
using OpenGL;
using System.Windows.Forms;
using System.Collections.Generic;
using System.Drawing;

I cant seem to rotate my image so it faces the way its moving.

This is called in my world draw method:

foreach (Bug bug in m_Bugs) 
            {
                double radians = Math.Atan2(bug.getPos().X + bug.getVel().X, bug.getPos().Y + bug.getVel().Y);
                double angle = radians * (180 / Math.PI);

                GL.glRotated(angle, 0, 0, 1);
                bug.Draw(); 
            }

and my draw method is called in the main thread here:

form.RegisterDraw(myWorld.Draw);

my bug.draw works perefectly it displays and blends the textures fine.

the code in the foreach loop in my world.draw method returns the velociity (getVel) and the position (getPos) as 2d vectors.

Any help would be appreciated, cheers.

private void Load(uint[] array, int index, string filepath)
    {
        Bitmap image = new Bitmap(filepath);
        image.RotateFlip(RotateFlipType.RotateNoneFlipY);
        System.Drawing.Imaging.BitmapData bitmapdata;
        Rectangle rect = new Rectangle(0, 0, image.Width, image.Height);
        bitmapdata = image.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format24bppRgb);

        /* Set the correct ID, then load the texture for that ID * from RAM onto the Graphics card */
        GL.glBindTexture(GL.GL_TEXTURE_2D, array[index]);
        GL.glTexImage2D(GL.GL_TEXTURE_2D, 0, (int)GL.GL_RGB8, image.Width, image.Height, 0, GL.GL_BGR_EXT, GL.GL_UNSIGNED_byte, bitmapdata.Scan0);
        GL.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, (int)GL.GL_LINEAR);
        GL.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, (int)GL.GL_LINEAR);

        /* This code releases the data that we loaded to RAM * but the texture is still on the Graphics Card */
        image.UnlockBits(bitmapdata);
        image.Dispose();
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T10:05:16+00:00Added an answer on May 27, 2026 at 10:05 am

    Why Pos + Vel ?

    It looks like you need only Pos. So:

    Math.Atan2( bug.getVel().X, bug.getVel().Y);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

any help with this would be gratefully received. I have a Windows Forms project
I'm very new to this, so any help is appreciated. I'll use the Dinners/RSVPs
Thank you in advance for any help with this problem. The Problem: Using Jquery
thanks for any help with this. I'm using the Three20 Photo Viewer in my
I would appreciate any help on this issue. Lets say I want to load
I can't seem to find any help on this but under the Net tab
Any help most appreciated, this is driving me insane. I'm doing exactly what I
any help you can give is very gratefully accepted. I've been looking at this
Any help here would be greatly appreciated. I have this table hospital Nurse |
I've been stuck on this issue for several days - any help is much

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.