Git Product home page Git Product logo

pyglfw's Introduction

# -----------------------------------------------------------------------------
#  GLFW - An OpenGL framework
#  API version: 3.0.1
#  WWW:         http://www.glfw.org/
#  ----------------------------------------------------------------------------
#  Copyright (c) 2002-2006 Marcus Geelnard
#  Copyright (c) 2006-2010 Camilla Berglund
#
#  Python bindings - Copyright (c) 2013 Nicolas P. Rougier
#
#  This software is provided 'as-is', without any express or implied
#  warranty. In no event will the authors be held liable for any damages
#  arising from the use of this software.
#
#  Permission is granted to anyone to use this software for any purpose,
#  including commercial applications, and to alter it and redistribute it
#  freely, subject to the following restrictions:
#
#  1. The origin of this software must not be misrepresented; you must not
#     claim that you wrote the original software. If you use this software
#     in a product, an acknowledgment in the product documentation would
#     be appreciated but is not required.
#
#  2. Altered source versions must be plainly marked as such, and must not
#     be misrepresented as being the original software.
#
#  3. This notice may not be removed or altered from any source
#     distribution.
#
# -----------------------------------------------------------------------------

pyglfw's People

Contributors

drluke avatar kidsunbo avatar landersson avatar larsoner avatar rougier avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pyglfw's Issues

Needs a setup.py

There is no setup.py file, so installation via pip is not currently possible.

glfw.glfwGetVideoMode(monitor) failing

On python3, glfw.glfwGetVideoMode(monitor) will fail with the following error:

File "/home/drluke/prog/cockamamie/pyglfw/glfw.py", line 576, in glfwGetVideoMode
    return (c_mode.width,
AttributeError: 'LP_GLFWvidmode' object has no attribute 'width'

One working fix is to change the function from

def glfwGetVideoMode(monitor):
    _glfw.glfwGetVideoMode.restype = POINTER(GLFWvidmode)
    c_mode = _glfw.glfwGetVideoMode(monitor)
    return (c_mode.width,
            c_mode.height,
            c_mode.redBits,
            c_mode.blueBits,
            c_mode.greenBits,
            c_mode.refreshRate )

to

def glfwGetVideoMode(monitor):
    _glfw.glfwGetVideoMode.restype = POINTER(GLFWvidmode)
    c_mode = _glfw.glfwGetVideoMode(monitor)
    return (c_mode[0].width,
            c_mode[0].height,
            c_mode[0].redBits,
            c_mode[0].blueBits,
            c_mode[0].greenBits,
            c_mode[0].refreshRate )

I am not certain if this breaks functionality for python2 though, so I didn't yet submit a pullrequest.

Only one letter shown as title when creating a window on Windows.

Only one letter shown as title when creating a window on Windows. Except that, everything works fine. If I deleted the explicit title parameter, only a G is shown at the position of the title.
How to solve that?
The system is Windows 10 and with Python 3.7.3. The version of GLFW is 3.3.

Segfault in glfwGetVideoModes()

Hi, first of all, thanks for maintaining this wrapper. I just tried to get full screen mode working under Mac OS X (El Capitan) and I'm getting a segfault when trying to use the monitor information functions. This python code will crash:

import glfw
glfw.glfwInit()
monitor = glfw.glfwGetPrimaryMonitor()
print("Monitor:", monitor, type(monitor))
print(glfw.glfwGetVideoModes(monitor))

This will print:

Monitor: 441455392 <class 'int'>
Segmentation fault: 11

I'm finding it a bit strange that monitor is listed with type 'int'... shouldn't it be size_t or similar?

The equivalent C++ code works fine. I'll try it on a 64 bit Linux machine tomorrow.

Question

What file should _glfw_file point to?
_glfw = ctypes.CDLL(_glfw_file)

Or the GLFW_LIBRARY system variable if you will.

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.