Coder Social home page Coder Social logo

antonovsyannikov / pyopengl_examples_savetofile Goto Github PK

View Code? Open in Web Editor NEW
22.0 1.0 2.0 94 KB

Several examples of how to use PyOpenGL for off-screen rendering and saving rendered image to file. 3 methods are used: using GLUT hidden window, using WGL to create context with default buffer, as well as creation of OpenGL Framebuffer Object by hands and display results with anti-aliasing in the interactive window .

Python 100.00%

pyopengl_examples_savetofile's Introduction

PyOpenGL_Examples_SaveToFile

Several examples of how to use PyOpenGL for off-screen rendering and saving rendered image to file. 3 methods are used: using GLUT hidden window, using WGL to create context with default buffer, as well as creation of OpenGL Framebuffer Object by hands and display results with anti-aliasing in the interactive window .

Important! PyOpenGL 3.1.1 have a bug!

When you just import WGL, glReadPixels() starts to crash with

ctypes.ArgumentError: argument 7: : wrong type

Go to [package dir]\OpenGL\raw\WGL_types.py , find the following lines

HANDLE = POINTER(None)  # /home/mcfletch/pylive/OpenGL-ctypes/src/wgl.h:60
# TODO: figure out how to make the handle not appear as a void_p within the code...
HANDLE.final = True

replace by

HANDLE = UINT64 # for x64, UINT32 for x86
HANDLE.final = True

=======

OpenGL_Offscreen_FBO.py

Offscreen rendering using manually created OpenGL Framebuffer Object

OpenGL_Offscreen_FBO_standalone.py

Offscreen rendering using manually created OpenGL Framebuffer Object Standalone code - not using LibGL from this repository

OpenGL_Offscreen_GLUT.py

Offscreen rendering using GLUT hidden window

OpenGL_Offscreen_GLUT_standalone.py

Offscreen rendering using GLUT hidden window Standalone code - not using LibGL from this repository

OpenGL_Offscreen_WGL.py

Offscreen rendering using WGL default buffers with hidden window

OpenGL_Offscreen_WGL_standalone.py

Offscreen rendering using WGL default buffers with hidden window Standalone code - not using LibGL from this repository

OpenGL_Window_FBO_AA.py

Render using manually created OpenGL Framebuffer Object Then resize rendered image with anti-aliasing and display it in the window Use mouse to rotate the view

OpenGL_Window_GLUT.py

Simple GLUT-based init and double-buffered OpenGL rendering Use keys to rotate the view

OpenGL_Window_Simple.py

Standard double-buffered OpenGL rendering Using WGL SwapBuffers() to show rendered result in the main window Use mouse to rotate the view

OpenGL_Window_WGL_AA.py

Render using default WGL buffers in the second hidden window Then resize rendered image with anti-aliasing and display it in the window Use mouse to rotate the view

pyopengl_examples_savetofile's People

Contributors

antonovsyannikov avatar

Stargazers

 avatar  avatar fabyday avatar AnodeAday avatar LucaScheller avatar Tho avatar  avatar Alex Smith avatar  avatar Dirco avatar  avatar Big Totoro avatar  avatar Shengjie Lin avatar Bemmu Sepponen avatar LiErlong avatar  avatar  avatar  avatar David Landa avatar Gopal Sharma avatar Xudong Lin avatar

Watchers

James Cloos avatar

pyopengl_examples_savetofile's Issues

OpenGL_Offscreen_GLUT_standalone not working on Linux

Hi,
I am trying the OpenGL_Offscreen_GLUT_standalone.py script on a Linux pc.
However, glutHideWindow() makes the offscreen rendering NOT work for me.
According to this post , rendering to a hidden window has no effects at all w/o a framebufferobject.
Therefore, I am wondering why and how this script works for you?

Cheers,
Changgong

How to use these scripts for linux

I want to do some rendering on Slurm based cluster that run linux. I cannot open a window as there is no x11 server. Can you suggest ways in which I can use your scripts in linux. More specifically alternatives to these packages:

from LibGL.Win32 import *
from LibGL.Context import *
from LibGL.Buffers import *

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.