Close Menu
Techs Slash

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    What's Hot

    How To Develop A Strategy That Works On Khelostar

    July 10, 2025

    Durable, Fast, and Accurate: Industrial-Grade Wrap Around Labeler

    July 10, 2025

    Unlocking the True Potential of Your Mitsubishi: A Guide to Performance Tuning

    July 9, 2025
    Facebook X (Twitter) Instagram
    Techs Slash
    • Home
    • News
      • Tech
      • Crypto News
      • Cryptocurrency
    • Entertainment
      • Actors
      • ANGEL NUMBER
      • Baby Names
      • Beauty
      • beauty-fashion
      • facebook Bio
      • Fitness
      • Dubai Tour
    • Business
      • Business Names
    • Review
      • Software
      • Smartphones & Apps
    • CONTRIBUTION
    Facebook X (Twitter) Instagram
    Techs Slash
    Home»python»Python 3 OpenGL Script to Implement Bresenham Circle Arc Algorithm GUI Desktop App
    python

    Python 3 OpenGL Script to Implement Bresenham Circle Arc Algorithm GUI Desktop App

    Ranveer KumarBy Ranveer KumarOctober 3, 2022No Comments2 Mins Read
    Facebook Twitter Pinterest LinkedIn Tumblr Email

    Warning: Trying to access array offset on value of type bool in /home/cadesimu/techsslash.com/wp-content/themes/smart-mag/partials/single/featured.php on line 78
    Share
    Facebook Twitter LinkedIn Pinterest Email

    Python 3 OpenGL Content to Execute Bresenham Circle Circular segment Calculation GUI Work area Application There might be many questions with regards to this article. We trust that subsequent to perusing this article all questions will be settled. How about we go to the article.

    Python 3 OpenGL Script to Implement Bresenham Circle Arc Algorithm GUI Desktop App

    #@MKchaudhary 15th sept 2018
    #Bresenham's circle drawing python opengl program
    
    from OpenGL.GL import *
    from OpenGL.GLU import *
    from OpenGL.GLUT import *
    import sys
    
    def init():
    	glClearColor(0.0,1.0,1.0,0.0)
    	glColor3f(1.0,0.0,0.0)
    	glPointSize(2.0)
    	glMatrixMode(GL_PROJECTION)
    	glLoadIdentity()
    	gluOrtho2D(0.0,640.0,0.0,480.0)
    
    def readinput_circle():
    	global xcenter,ycenter,radius
    	xcenter=input('xCenter:')
    	ycenter=input('yCenter:')
    	radius=input('Radius:')
    
    def setPixel(xcoordinate,ycoordinate):
    	glBegin(GL_POINTS)
    	glVertex2f(xcoordinate,ycoordinate)
    	glEnd()
    	glFlush()
    
    def Brescircle(xcenter,ycenter,radius):
    	x=0
    	y=radius
    	p=3-2*radius
    	circlePlotpoints(xcenter,ycenter,x,y)
    	while x <= y:
    		x+=1
    		if p<0:
    			p=p+4*x+6
    		else:
    			y-=1
    			p= p+ 4*(x-y) + 10
    		circlePlotpoints(xcenter,ycenter,x,y)
    
    def circlePlotpoints(xcenter,ycenter,x,y):
    	setPixel(xcenter + x , ycenter + y)
    	setPixel(xcenter + x , ycenter - y)
    	setPixel(xcenter - x , ycenter + y)
    	setPixel(xcenter - x , ycenter - y)
    	setPixel(xcenter + y , ycenter + x)
    	setPixel(xcenter + y , ycenter - x)
    	setPixel(xcenter - y , ycenter + x)
    	setPixel(xcenter - y , ycenter - x)
    
    def Display():
    	glClear(GL_COLOR_BUFFER_BIT)
    	Brescircle(xcenter,ycenter,radius)
    
    def main():
    	glutInit(sys.argv)
    	glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB)
    	glutInitWindowSize(600,600)
    	glutInitWindowPosition(50,50)
    	glutCreateWindow("2D Transformation")
    	readinput_circle()
    	glutDisplayFunc(Display)
    	init()
    	glutMainLoop()
    
    main()

    Final Words

    Python 3 OpenGL Content to Execute Bresenham Circle Curve Calculation GUI Work area Application We trust every one of your questions about this point will be settled. See you again in the following article Much obliged.

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Ranveer Kumar
    • Website

    Related Posts

    JSONDecodeError: Expecting value: line 1 column 1 (char 0)

    December 18, 2023

    Why does math.log result in ValueError: math domain error?

    December 17, 2023

    “inconsistent use of tabs and spaces in indentation” [duplicate]

    December 16, 2023
    Leave A Reply Cancel Reply

    Top Posts

    Sapne Me Nahane Ka Matlab

    March 18, 2024

    Sapne Me Nagn Stri Dekhna

    March 18, 2024

    Self Reliance: Release Date, Cast, Plot, Trailer, and More Information

    March 18, 2024

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    ABOUT TECHSSLASH

    Welcome to Techsslash! We're dedicated to providing you with the best of technology, finance, gaming, entertainment, lifestyle, health, and fitness news, all delivered with dependability.

    Our passion for tech and daily news drives us to create a booming online website where you can stay informed and entertained.

    Enjoy our content as much as we enjoy offering it to you

    Most Popular

    Sapne Me Nahane Ka Matlab

    March 18, 2024

    Sapne Me Nagn Stri Dekhna

    March 18, 2024

    Self Reliance: Release Date, Cast, Plot, Trailer, and More Information

    March 18, 2024
    CONTACT DETAILS

    Phone: +92-302-743-9438
    Email: contact@serpinsight.com

    Our Recommendation

    Here are some helpfull links for our user. hopefully you liked it.

    Techs Slash
    Facebook X (Twitter) Instagram Pinterest
    • Home
    • About us
    • contact us
    • Affiliate Disclosure
    • Privacy Policy
    • Disclaimer
    • Terms and Conditions
    • Write for us
    • Daman Game
    © 2025 Techsslash. All Rights Reserved

    Type above and press Enter to search. Press Esc to cancel.