Лучше всего динамические языки для OpenGL, графического / общего графический

Которые являются самыми сформировавшимися и хорошо поддерживаемыми решениями для записи графических программ?

Я использовал C++ с OpenGL/избытком, но хотел бы попробовать более гибкий и выразительный подход.

Ruby и Обработка? Python и ЛЮДОЕД? Какие вещи работали хорошо на Вас?

7
задан Internet man 15 December 2009 в 00:17
поделиться

4 ответа

Given you are familiar with C++, you might give Lua a try. Lua is a dynamic language that can be embedded in any C/C++ program. It is very popular in the game industry.

5
ответ дан 6 December 2019 в 08:43
поделиться

If you are just interested in experimenting, I'd suggest picking a 3D framework with bindings for a dynamic language you are already familiar with.

I started doing experiments with Ruby/OpenGL a year or three ago and that was easy enough to play around with.

If you seriously want to build a project (for whatever reason), I'd suggest picking a framework based on a combination of

  • The native language it's implemented in (or runtime it runs on)
  • The dynamic language bindings available for the engine or runtime
  • The license of the framework

If you want your project to be fairly easily running across different OS'es, you'll probably want to pick a framework written in Java (because the JVM runs everywhere) with bindings in Ruby (jRuby) or JavaScript (because these languages are well supported there). This would, however, limit the frameworks available to you. (This is my OSS + linux bias showing).

Wikipedia has a list of game engines. Based on several criteria I started a project with jMonkeyEngine (v2) and found it easy to work with and control from Rhino (a JVM JavaScript implementation).

I recently saw a presentation from another Java-based framework with bindings for several languages that looked really cool (inspired by the Ogre engine), but I forget the name and can't find it in the list.

Doing C# at the time I did look at projects/frameworks targeting both dotNet and Mono for running across platforms but it was too much hassle to get the development builds of the (Tao?) framework and the Mono Lua bindings running. Maybe things have changed.

To sum it up, pick a framework that can run on the environment(s) you want with bindings for the dynamic language that you want to use. Even if the framework library code available for the dynamic language you want to use is fairly minimal you can easily extend it if you can work with the underlying language. If you're fluent with C++, Java and C# shouldn't be too much of a stretch.

8
ответ дан 6 December 2019 в 08:43
поделиться

Если вы ищете динамические языки, которые поддерживают OpenGL прямо из коробки (без внешних привязок), попробуйте эти :

2
ответ дан 6 December 2019 в 08:43
поделиться

Я хотел бы упомянуть Python с PyOpenGL как вариант для рассмотрения.

Если вы уже знакомы с OpenGL, PyOpenGL - это, по сути, оболочка API, написанная на Python. Меня сначала удивило, насколько похож код на Python и на C ++. Вот так (обратите внимание, что я также использую Pyglet ):

def setup_render(self):
    '''First rendering setup'''
    glClearColor(0.0, 0.0, 0.0, 1.0) 
    glClearDepth(1.0)       

    glEnable(GL_LIGHTING)       
    glEnable(GL_DEPTH_TEST)    
    glEnable(GL_ALPHA_TEST)         
    glEnable(GL_CULL_FACE)              

def draw(self, time_passed):
    '''Drawing events'''
    if self.has_exit:
        pyglet.app.exit()
        return

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
    glUseProgram(self.shader.program)
    self.set_lights()

    # Draw objects here
    glTranslate(0, 0, -10)
    glScale(5.0, 5.0, 5.0)
    glutSolidSphere(1, 16, 16)

Посмотрите, насколько он похож на код C ++.

Мне удалось быстро освоить PyOpenGL в Python и реализовать класс Quaternion до 200 строк. Если вам нравится Python, я без колебаний порекомендую вам его попробовать.

Кстати, документация по API PyOpenGL гораздо более читабельна, чем официальная .

4
ответ дан 6 December 2019 в 08:43
поделиться