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 7024809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:53:28+00:00 2026-05-27T23:53:28+00:00

is there anyone who is able to help me? I have a function Renderframe

  • 0

is there anyone who is able to help me? I have a function Renderframe which returns a bitmap but I want to paint there something in 3D with OpenGL(TK) in c# – is it possible to return the rotated cube? Or how should I do it to get the valid code?

Many thanks for every idea or help 🙂

public Animation ()
{
}

public void Draw3D()
{

    GL.Begin(BeginMode.Quads);

    GL.Color3(0.0f, 1.0f, 0.0f);          // Set The Color To Green
    GL.Vertex3(1.0f, 1.0f, -1.0f);        // Top Right Of The Quad (Top)
    GL.Vertex3(-1.0f, 1.0f, -1.0f);       // Top Left Of The Quad (Top)
    GL.Vertex3(-1.0f, 1.0f, 1.0f);        // Bottom Left Of The Quad (Top)
    GL.Vertex3(1.0f, 1.0f, 1.0f);         // Bottom Right Of The Quad (Top)

    GL.Color3(1.0f, 0.5f, 0.0f);          // Set The Color To Orange
    GL.Vertex3(1.0f, -1.0f, 1.0f);        // Top Right Of The Quad (Bottom)
    GL.Vertex3(-1.0f, -1.0f, 1.0f);       // Top Left Of The Quad (Bottom)
    GL.Vertex3(-1.0f, -1.0f, -1.0f);      // Bottom Left Of The Quad (Bottom)
    GL.Vertex3(1.0f, -1.0f, -1.0f);       // Bottom Right Of The Quad (Bottom)

    GL.Color3(1.0f, 0.0f, 0.0f);          // Set The Color To Red
    GL.Vertex3(1.0f, 1.0f, 1.0f);         // Top Right Of The Quad (Front)
    GL.Vertex3(-1.0f, 1.0f, 1.0f);        // Top Left Of The Quad (Front)
    GL.Vertex3(-1.0f, -1.0f, 1.0f);       // Bottom Left Of The Quad (Front)
    GL.Vertex3(1.0f, -1.0f, 1.0f);        // Bottom Right Of The Quad (Front)

    GL.Color3(1.0f, 1.0f, 0.0f);          // Set The Color To Yellow
    GL.Vertex3(1.0f, -1.0f, -1.0f);       // Bottom Left Of The Quad (Back)
    GL.Vertex3(-1.0f, -1.0f, -1.0f);      // Bottom Right Of The Quad (Back)
    GL.Vertex3(-1.0f, 1.0f, -1.0f);       // Top Right Of The Quad (Back)
    GL.Vertex3(1.0f, 1.0f, -1.0f);        // Top Left Of The Quad (Back)

    GL.Color3(0.0f, 0.0f, 1.0f);          // Set The Color To Blue
    GL.Vertex3(-1.0f, 1.0f, 1.0f);        // Top Right Of The Quad (Left)
    GL.Vertex3(-1.0f, 1.0f, -1.0f);       // Top Left Of The Quad (Left)
    GL.Vertex3(-1.0f, -1.0f, -1.0f);      // Bottom Left Of The Quad (Left)
    GL.Vertex3(-1.0f, -1.0f, 1.0f);       // Bottom Right Of The Quad (Left)

    GL.Color3(1.0f, 0.0f, 1.0f);          // Set The Color To Violet
    GL.Vertex3(1.0f, 1.0f, -1.0f);        // Top Right Of The Quad (Right)
    GL.Vertex3(1.0f, 1.0f, 1.0f);         // Top Left Of The Quad (Right)
    GL.Vertex3(1.0f, -1.0f, 1.0f);        // Bottom Left Of The Quad (Right)
    GL.Vertex3(1.0f, -1.0f, -1.0f);       // Bottom Right Of The Quad (Right)

    GL.End();

    GL.Rotate(50, 1.0, 0, 0);
}


static Bitmap GetSnapShot(int width, int height)
{
    var snapShotBmp = new Bitmap(width, height);
    BitmapData bmpData = snapShotBmp.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
    GL.ReadPixels(0, 0, width, height, OpenTK.Graphics.OpenGL.PixelFormat.Bgr, PixelType.UnsignedByte, bmpData.Scan0);
    snapShotBmp.UnlockBits(bmpData);
    return snapShotBmp;
}

public Bitmap RenderFrame ( int width, int height, int currentFrame, int totalFrames )
{



  Draw3D();

  return GetSnapShot(width, height);


}
  • 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-27T23:53:28+00:00Added an answer on May 27, 2026 at 11:53 pm

    You can use the following method to get the pixels that have been rendered:

        static Bitmap GetSnapShot(int width, int height)
        {
            var snapShotBmp = new Bitmap(width, height);
            BitmapData bmpData = snapShotBmp.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.WriteOnly,
                                                      PixelFormat.Format24bppRgb);
            GL.ReadPixels(0, 0, width, height, OpenTK.Graphics.OpenGL.PixelFormat.Bgr, PixelType.UnsignedByte,
                          bmpData.Scan0);
            snapShotBmp.UnlockBits(bmpData);
            return snapShotBmp;
        }
    

    where width and height are the dimensions of your viewport.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there anyone who have encountered Processing Dirty Regions error in MyEclipse? Actually everytime
Is there anyone who knows this? I have been trying this for the last
Is there anyone who knows how to destroy a javascript (jquery) function? I'm using
is there anyone who makes use of the Microsoft Open XML SDK 2.0 for
Is there anyone who has used or looked into using Jitterbit as well as
Is there anyone who has already tried to use the Microsoft Bing translator web
Anyone out there who knows what are the differences between BasicRenderEngine and LazyRenderEngine?
Anyone who's tried to study mathematics using online resources will have come across these
is there anyone who has had experience with csv's and ruby. i am new
Is there anyone who has succeeded in making a self-contained .war file using Tomcat

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.