0
0

More than 5 years have passed since last update.

[GroovyとProcessing]画像を表示する

Posted at

読み込んだ画像をそのまま表示する方法と3Dのオブジェクトにテクスチャとして貼り付ける方法の2通りやってみた

動画リスト:LWJGLのチュートリアル
動画はココ

DisplayTest.groovy
package episode005

import groovy.swing.SwingBuilder
import processing.core.PApplet

import javax.swing.*

class DisplayTest extends PApplet {

    def void setup() {
        size(640, 480, P3D)
        frameRate(60)
    }

    def void draw() {
        background(0, 0, 0)

        def img = loadImage('wood.png')
        image(img, 400, 300)

        beginShape()
        texture(img)
        vertex(15, 15, 0, 0)
        vertex(65, 15, 50, 0)
        vertex(65, 65, 50, 50)
        vertex(15, 65, 0, 50)
        endShape()
    }

    def static void main(args) {
        def display = new DisplayTest()
        new SwingBuilder().frame(
                title: 'Episode 3',
                defaultCloseOperation: JFrame.EXIT_ON_CLOSE,
                size: [640, 480], show: true) {
            widget(display)
        }
        display.init()
    }
}

grocessingGL005.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0