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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:17:23+00:00 2026-05-21T07:17:23+00:00

Check the image I produced, but what I want to do is producing those

  • 0

enter image description here

Check the image I produced, but what I want to do is producing those rectangles with borders, and set the background colour to another. How can I do that?

glRectf(top_left_x, top_left_y, bottom_right_x, bottom_right_y)?




if loop==0:
            ratio = 0.10
            glBegin(GL_QUADS)
            while ratio <= 1.0:
                width = window_width/2
                height = window_height
                long_length = width * ratio
                short_length = height* (1.0 - ratio)
                top_left_x = (width - long_length) / 2.0
                top_left_y = (height - window_height * (1.0-ratio)) /2
                bottom_right_x = top_left_x + long_length
                bottom_right_y = top_left_y + short_length
                glColor(1.0,1.0,1.0,0.5)
                glVertex3f(top_left_x, top_left_y, 0.0)
                glVertex3f(top_left_x + long_length, top_left_y, 0.0)
                glVertex3f(bottom_right_x,bottom_right_y, 0.0)
                glVertex3f(bottom_right_x-long_length,bottom_right_y, 0.0)
                ratio += 0.05
            glEnd()
  • 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-21T07:17:24+00:00Added an answer on May 21, 2026 at 7:17 am

    You can draw a rectangle not filled this way:

    glBegin(GL_LINES);
    
    
    
    glVertex2d(top_left_x, top_left_y);             
    glVertex2d( top_right_x, top_right_y);              
    glVertex2d( bottom_right_x,bottom_right_y);             
    glVertex2d(bottom_left_x,bottom_left_y);
    glVertex2d(top_left_x, top_left_y);                 
    glEnd();    
    

    OpenGL use a state machine. So for changing the color just put :

    glColor3f (R, G, B);
    

    before your drawing primitives.

    So, mixing it up, your step should be:

    1. choose fill color
    2. draw fill rect with glRectf
    3. choose border color
    4. draw unfilled rect with the code I posted

    These steps repeated for each rectangle you are drawing of course.

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

Sidebar

Related Questions

How can i check does image set in ImageView or no, exists standard methods?
i m making APP which do image proceesing using java SE.i want to check
i want to check image size once user select an image from gallery.Because big
I want to check if an image exists using jquery. For example how do
I'm trying to make a checkbox that has a custom check image. I need
I have a png image, which you can see here: http://img10.imageshack.us/img10/9145/archer5.png The background of
My question is how do you check the image's resource? In my onClick method
If you don't know what I mean, check this image out: Multiple images I
I have created a DeclarativeServiceLibrary using VS2010 beta 2, Please check this image of
I am trying to check if a image of a subview is hidden or

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.