Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
szabolcsdombi committed May 10, 2018
1 parent ffe6027 commit e2c75a6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 149 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
recursive-include src *.cpp *.hpp
include README.md
include LICENSE
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div align="center">

[![preview](.github/preview.png)](#readme)
[![preview](https://github.com/cprogrammer1994/ModernGL/raw/master/.github/preview.png)](#readme)

</div>

Expand All @@ -13,7 +13,7 @@ pip install ModernGL
- [Documentation](https://moderngl.readthedocs.io/)
- [Examples](https://github.com/cprogrammer1994/ModernGL/tree/master/examples/#readme)
- [ModernGL on Github](https://github.com/cprogrammer1994/ModernGL/)
- [ModernGL on PyPI](https://pypi.python.org/pypi/ModernGL/)
- [ModernGL on PyPI](https://pypi.org/project/ModernGL/)

## Features

Expand Down Expand Up @@ -104,7 +104,7 @@ OpenGL 3.3 came out in February 2010. With **up to date drivers** you will be ab

**NO**, Window creation is up to you. You can choose from a large variety of modules that can create a window: [PyQt5], [pyglet], [pygame], [GLUT] and many others.

[PyQt5]: https://pypi.python.org/pypi/PyQt5/
[PyQt5]: https://pypi.org/project/PyQt5/
[pyglet]: https://bitbucket.org/pyglet/pyglet/wiki/Home
[pygame]: https://www.pygame.org/news
[GLUT]: https://wiki.python.org/moin/PyOpenGL
Expand Down
152 changes: 6 additions & 146 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import platform
import re
import sys

from setuptools import Extension, setup
Expand Down Expand Up @@ -95,151 +96,9 @@

short_description = 'ModernGL: High performance rendering for Python 3'

long_description = '''
ModernGL
========
.. code-block:: sh
pip install ModernGL
* `Documentation <https://moderngl.readthedocs.io/>`_
* `Examples <https://github.com/cprogrammer1994/ModernGL/tree/master/examples/#readme>`_
* `ModernGL on Github <https://github.com/cprogrammer1994/ModernGL/>`_
* `ModernGL on PyPI <https://pypi.python.org/pypi/ModernGL/>`_
Features
--------
* GPU accelerated high quality graphics
* Rendering modern OpenGL scenes with less headache
* Simpler and faster than PyOpenGL
* Can render without a window
* 100% Pythonic
Sample usage
------------
.. code-block:: py
>>> import moderngl
>>> ctx = moderngl.create_standalone_context()
>>> buf = ctx.buffer(b'Hello World!') # allocated on the GPU
>>> buf.read()
b'Hello World!'
For complete examples please visit the
`Examples <https://github.com/cprogrammer1994/ModernGL/tree/master/examples/#readme>`_.
Easy to use with Pillow and Numpy
---------------------------------
.. code-block:: py
>>> img = Image.open('texture.jpg')
>>> ctx.texture(img.size, 3, img.tobytes())
<Texture: 1>
.. code-block:: py
>>> ctx.buffer(np.array([0.0, 0.0, 1.0, 1.0], dtype='f4'))
<Buffer: 1>
Compared to PyOpenGL
--------------------
With the original OpenGL API you have to write a couple of lines to achieve a **simple task** like compiling a shader
or running a computation on the GPU. With ModernGL you will need just a **few lines** to achieve the same result.
Using PyOpenGL
~~~~~~~~~~~~~~
.. code-block:: py
vbo1 = glGenBuffers(1)
GL.glBindBuffer(GL_ARRAY_BUFFER, vbo1)
GL.glBufferData(GL_ARRAY_BUFFER, b'Hello World!', GL_STATIC_DRAW)
vbo2 = glGenBuffers(1)
GL.glBindBuffer(GL_ARRAY_BUFFER, vbo2)
GL.glBufferData(GL_ARRAY_BUFFER, b'\x00' * 1024, GL_DYNAMIC_DRAW)
Using ModernGL
~~~~~~~~~~~~~~
.. code-block:: py
vbo1 = ctx.buffer(b'Hello World!')
vbo2 = ctx.buffer(reserve=1024, dynamic=True)
Build
-----
.. image:: https://img.shields.io/travis/cprogrammer1994/ModernGL/master.svg?label=build
:target: https://travis-ci.org/cprogrammer1994/ModernGL
:alt: build
.. image:: https://img.shields.io/appveyor/ci/cprogrammer1994/ModernGL/master.svg?label=build
:target: https://ci.appveyor.com/project/cprogrammer1994/ModernGL
:alt: build
.. code-block:: sh
python setup.py build_ext --inplace
FAQ
---
Is ModernGL faster than PyOpenGL?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
In some cases **yes**\ , the core functions of ModernGL are written in C++, OpenGL functions are called in quick
succession so these calls together count as a single python function call.
What version of OpenGL is used?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Most of the calls only require **OpenGL 3.3** but Subroutines and Compute Shaders require **OpenGL 4.0** and
**OpenGL 4.3**
Is my old PC supported?
^^^^^^^^^^^^^^^^^^^^^^^
OpenGL 3.3 came out in February 2010. With **up to date drivers** you will be able to use the most of the ModernGL
functions, even on integrated graphics cards. *(No, Compute Shaders won't work)*
Where can I use ModernGL?
^^^^^^^^^^^^^^^^^^^^^^^^^
**Anywhere where OpenGL is supported.** ModernGL is capable of rendering using a
`standalone_context <https://github.com/cprogrammer1994/ModernGL/tree/master/examples/standalone>`_ as well.
Rendering to a window only requires a valid OpenGL context.
Can ModernGL create a Window?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
**NO**\ , Window creation is up to you. You can choose from a large variety of modules that can create a window:
`PyQt5 <https://pypi.python.org/pypi/PyQt5/>`_\ , `pyglet <https://bitbucket.org/pyglet/pyglet/wiki/Home>`_\ ,
`pygame <https://www.pygame.org/news>`_\ , `GLUT <https://wiki.python.org/moin/PyOpenGL>`_ and many others.
Limitations using ModernGL over PyOpenGL?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
All the neccessary calls are (or can be) implemented in ModernGL. However you can interract with the ModernGL objects
from PyOpenGL. If something is missing write an `issue <https://github.com/cprogrammer1994/ModernGL/issues>`_ or raise
a `PR <https://github.com/cprogrammer1994/ModernGL/pulls>`_.
Supported platforms
-------------------
* [x] Windows
* [x] Linux
* [x] Mac
'''
with open('README.md') as f:
long_description = f.read()
long_description = re.sub(r'</?div[^>]*>', '', long_description, flags=re.M)

keywords = [
'ModernGL',
Expand Down Expand Up @@ -270,7 +129,8 @@
name='moderngl',
version='5.1.0',
description=short_description,
long_description=long_description.strip(),
long_description=long_description,
long_description_content_type='text/markdown',
url='https://github.com/cprogrammer1994/ModernGL',
author='Szabolcs Dombi',
author_email='cprogrammer1994@gmail.com',
Expand Down

0 comments on commit e2c75a6

Please sign in to comment.