Skip to content

Instantly share code, notes, and snippets.

View xranby's full-sized avatar
🧘
guru meditation

Xerxes Rånby xranby

🧘
guru meditation
View GitHub Profile
wget http://jogamp.org/deployment/jogamp-current/archive/jogamp-all-platforms.7z
7z x jogamp-all-platforms.7z
wget https://gist.github.com/xranby/42ffcd1d4298356dd177/raw/aca00bd10252496a3c772914ede5a54cad0ed2f7/TextRendering.java
javac -cp ./jogamp-all-platforms/jar/gluegen-rt.jar:./jogamp-all-platforms/jar/jogl-all.jar:. TextRendering.java
java -cp ./jogamp-all-platforms/jar/gluegen-rt.jar:./jogamp-all-platforms/jar/jogl-all.jar:. TextRendering
xranby@Xerxes-ESPRIMO:~/rpi-buildroot/output/build/openjdk-jdk9-b36$ quilt diff
Index: openjdk-jdk9-b36/jdk/make/Import.gmk
===================================================================
--- openjdk-jdk9-b36.orig/jdk/make/Import.gmk 2014-11-06 14:26:21.676125373 +0100
+++ openjdk-jdk9-b36/jdk/make/Import.gmk 2014-11-07 15:34:49.776899332 +0100
@@ -214,7 +214,11 @@
$(JDK_OUTPUTDIR)/modules/jdk.hotspot.agent/_the.sa.services
$(TOUCH) $@
+# if $(AGENT_DIR) exist, import SA
@xranby
xranby / gldemo.rb
Last active August 29, 2015 14:27
Initialized fine now
Dir.glob('*.jar').each {|jar| require jar }
java_import 'com.jogamp.opengl.GLCapabilities',
'com.jogamp.opengl.GLDrawableFactory',
'com.jogamp.opengl.GLProfile',
'com.jogamp.opengl.GL4',
'com.jogamp.nativewindow.util.Rectangle',
'com.jogamp.newt.opengl.GLWindow',
'com.jogamp.opengl.util.FPSAnimator',
'com.jogamp.opengl.GLEventListener',
@xranby
xranby / JOGLQuadES1.java
Last active September 23, 2015 15:23
This program displays a simple 3D rendering of a polygon using JOGL. Please note though that this code is a demonstration of the use of JOGL and as such makes use of immediate mode drawing commands; this serves to show how the conventional C style API is used through JOGL, but it is strongly recommended to make use of modern OpenGL techniques.
import com.jogamp.opengl.*;
import com.jogamp.opengl.fixedfunc.*;
import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.util.ImmModeSink;
import com.jogamp.newt.opengl.GLWindow;
/**
* Self-contained example (within a single class only to keep it simple)
* displaying a rotating quad
*/
public class JOGLQuadES1 implements GLEventListener {
@xranby
xranby / JOGLQuadES2.java
Created September 25, 2015 11:33
JOGLQuadES2.java
import com.jogamp.opengl.*;
import com.jogamp.opengl.fixedfunc.*;
import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.util.ImmModeSink;
import com.jogamp.opengl.util.PMVMatrix;
import com.jogamp.opengl.util.glsl.ShaderState;
import com.jogamp.opengl.util.glsl.fixedfunc.FixedFuncUtil;
import com.jogamp.opengl.util.glsl.fixedfunc.ShaderSelectionMode;
import com.jogamp.newt.opengl.GLWindow;
/**
@xranby
xranby / JOGLQuad.java
Created September 25, 2015 12:13
JOGLQuad.java
import com.jogamp.opengl.*;
import com.jogamp.opengl.fixedfunc.*;
import com.jogamp.opengl.util.Animator;
import com.jogamp.newt.opengl.GLWindow;
/**
* Self-contained example (within a single class only to keep it simple)
* displaying a rotating quad
*/
public class JOGLQuad implements GLEventListener {
@xranby
xranby / gl2.newt.TestGearsNewtAWTWrapper
Created October 5, 2015 22:53
gl2.newt.TestGearsNewtAWTWrapper
Fedora 22
gnome
OpenJDK 8
junit test test01
java.lang.RuntimeException: Waited 5000ms for: <2401f4c3, 7637f22>[count 1, qsz 0, owner <main-AWTAnimator#00>] - <main>
at jogamp.common.util.locks.RecursiveLockImpl01Unfairish.lock(RecursiveLockImpl01Unfairish.java:198)
at com.jogamp.nativewindow.awt.JAWTWindow.lockSurface(JAWTWindow.java:655)
at jogamp.opengl.GLDrawableImpl.lockSurface(GLDrawableImpl.java:307)
/*
# This code is a NEWT JogAmp JOGL 2 port of:
# https://sites.google.com/site/justinscsstuff/jogl-tutorial-3
#
# Get the latest JogAmp JOGL 2
wget http://jogamp.org/deployment/jogamp-current/archive/jogamp-all-platforms.7z
7z x jogamp-all-platforms.7z
cd jogamp-all-platforms
# Compile this demo.
# JNAJack - jjack using JNA!
# http://www.raspberrypi.org/phpBB3/viewtopic.php?p=187217#p187217
# http://code.google.com/p/java-audio-utils/
sudo apt-get install libjna-java jackd2
wget http://java-audio-utils.googlecode.com/files/JNAJack%20build120912.zip
unzip JNAJack\ build120912.zip
cd JNAJack
# http://code.google.com/p/java-audio-utils/wiki/GettingStarted_JNAJack
# java -Xincgc -cp jna.jar:org-jaudiolibs-jnajack.jar org.jaudiolibs.jnajack.examples.SineAudioSource
java -jamvm -cp org-jaudiolibs-jnajack.jar:/usr/share/java/jna.jar org.jaudiolibs.jnajack.examples.SineAudioSource
#include <Servo.h>
Servo myServo; // create a servo object
void setup() {
// ställ in utgångar (lamporna)
pinMode(5, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(7, INPUT);