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

  • Home
  • SEARCH
  • 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 6205689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:19:09+00:00 2026-05-24T05:19:09+00:00

I am trying to create a tool that will draw a shape in openGL

  • 0

I am trying to create a tool that will draw a shape in openGL and then modify the values of the properties of that shape in a windows form. So if my shape is a rectangle, I will create a form that will allow the user to control the size, color etc of the rectangle. I have written the openGL code in managed c++ and the form in c#, and as some of these shapes got more complicated I decided to make display lists for them (for both performance and predictability purposes).

I define the display list in the constructor for the shape and I call the display lists in the render method.

My issue is that my display lists won’t run at all. The parts that I render outside of a display list will be rendered, but the parts inside the display list will not be rendered.

Here’s some sample code of my process:

//c# side
GLRectangle rect
public CSharpRectangle() {
    rect = new GLRectangle();
}

//managed c++ side
public GLRectangle() {
   width = 50;
   height = 50;
   //initialize more values
   rectDL = glGenLists(1);
   glNewList(rectDL, GL_COMPILE);
        renderRect();
   glEndList();
}
public render() {
     //Draw border
glBegin(GL_LINE_LOOP);
    glVertex2f(0, 0);
    glVertex2f(width, 0);
    glVertex2f(width, height);
    glVertex2f(0, height);
glEnd();

     //Draw interior
     glCallList(rectDL);
}
private renderRect() {
     glRectf(0,0,width,height);
}

In this example, the border of the rectangle would be rendered, but the rectangle itself won’t be rendered… if I replace the display list with simply a method call, the rectangle is rendered fine. Does anyone know why this might be happening?

  • 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-24T05:19:10+00:00Added an answer on May 24, 2026 at 5:19 am

    I want to give my 2 cents.

    The code in your question seems correct to me, so probably there something else in your application that make your display list not runnable.

    The only thing I can think is there’s no current context when compiling the display list (indeed when executing GlRectangle constructor). So, is that routine executed in the same thread which have called glMakeCurrent? Is that routine called after glMakeCurrent?

    Further, check with glGetError after each OpenGL routine in order to validate the operation. In the case it returns an error, you can know what’s wrong in your code..

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

Sidebar

Related Questions

I'm trying to create a tool that can generate XSDs for the XAML produced
First, context: I'm trying to create a command-line-based tool (Linux) that requires login. Accounts
I'm trying to create a tool that converts the dynamic DHCP-provided IPv4 address, gateway
I am trying to create a WPF application that will be a central point
I'm trying to create a generic graphics export tool which works by implementing the
I am trying create a WCF service that leverages the WPF MediaPlayer on the
Trying to create my first iPhone app that would play back audio. When I
I am trying to use R within a script that will act as a
I'm trying to create a programming challenge that would require developers to hack into
Is there an incantation of mysqldump or a similar tool that will produce a

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.