An pyOpneGL Wrapper
Project description
glpy
glpy is pyOpenGl wrapper which lets you work with pyOpenGl easily.It is not meant to be a replacement for pyOpenGl but runs on top of pyOpenGl to avoid most of the boiler plate setup
Features
- Robust abstraction over pyOpenGl event loop
- decorators to simplify callback functions
Code Example
from glpy import *
app = glpy()
@point(10)
def plotpoints():
glColor3f(100, 150, 200)
glVertex2f(0,0)
app.run(lambda:plotpoints())
find more examples here
Installation
pip install glpy
API Reference
glpy()
allowed keyword arguments
Parameter | Type | Description | Default |
---|---|---|---|
mode | constant | Display mode | GLUT_RGBA |
size | tuple | Window size | (500,500) |
position | tuple | Window position | (0,0) |
bgcolor | tuple | background color | (0, 0, 0, 1.0) |
title | string | window title | new title |
axis_range | tuple | The range of 2D plane | (-100, 100,-100, 100) |
How to use?
-
Make sure you have opengl installed on your system
-
Install the package using pip.
-
import the package and initialilze glpy
app = glpy()
-
you can pass in additional parameters as seen in the API Reference as keyword arguments
app = glpy(title = "line drawing")
-
define your callback function with the help of point decorator which takes the size of the point to be plotted as an argument . NOTE: using a decorator is not neccesory for the library to work but it can significatly reduce the code size
@point(10) def plotpoints(): glColor3f(100, 468, 200) glVertex2f(0,0)
-
call the run the method using the callback function as an argument to run the function NOTE: use a lambda function to pass callback functions with arguments
app.run(lambda:plotpoints())
Contribute
Contributions are what makes the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (git checkout -b feature/AmazingFeature)
- Commit your Changes (git commit -m 'Add some AmazingFeature')
- Push to the Branch (git push origin feature/AmazingFeature)
- Open a Pull Request
License
APACHE © Abhinav TB
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file glpy-0.1.1.tar.gz
.
File metadata
- Download URL: glpy-0.1.1.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ff0e86f54c5ee86583dcce40de14c29f672eb527d435e7009d7094ea0b05740 |
|
MD5 | e74777229739122f3fecbfee6418b566 |
|
BLAKE2b-256 | 1a0c4451f5ede385bf5053cc99118befd6671838733b7fd5bfc8b799d8f5c63c |
File details
Details for the file glpy-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: glpy-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad05a275d91f47b2d08d1a1845e2f8853c8f8f3786f6a03da3b4e10760a08684 |
|
MD5 | 1fab71b76e5358bdf4b66bbbbf454855 |
|
BLAKE2b-256 | cb5be58bcb237ea7a696e2f203993f2044bf13d90930a533458ad7c7bb1104e4 |