Skip to content

Instantly share code, notes, and snippets.

@RomiTT
RomiTT / JavaWithGroovy.java
Last active December 9, 2021 03:51
Java with Groovy script #java #groovy
package hello.hellospring.controller;
import groovy.lang.*;
import groovy.util.GroovyScriptEngine;
import hello.hellospring.scriptRoots.ScriptRoot1;
import hello.hellospring.util.TaxCalculator;
import org.codehaus.groovy.control.CompilerConfiguration;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
@RomiTT
RomiTT / XAML Storyboard with path data.xaml
Created October 14, 2020 09:10
XAML Storyboard with path data #XAML
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="playShape"
Storyboard.TargetProperty="Data"
Duration="0:0:0.5">
<ObjectAnimationUsingKeyFrames.KeyFrames>
<DiscreteObjectKeyFrame KeyTime="0:0:0">
<DiscreteObjectKeyFrame.Value>
<Geometry>M 0,0 0,20 14,10 14,10 L 0,0</Geometry>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
<DiscreteObjectKeyFrame KeyTime="0:0:0.5">
@RomiTT
RomiTT / gist:2b4ccc7bca41a1d58ae14a130e28939d
Created March 17, 2020 15:12 — forked from Madsy/gist:6980061
Working multi-threading two-context OpenGL example with GLFW 3.0.3 and GLEW 1.8
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <vector>
#include <cmath>
#include <cstdio>
#include <limits>
#include <chrono>
#include <thread>
#include <mutex>
@RomiTT
RomiTT / TextureArrayShader.frag
Created March 4, 2020 14:34 — forked from mantissa/TextureArrayShader.frag
GL_TEXTURE_2D_ARRAY in OpenFrameworks
#version 150
#define MAX_TEXTURES 2
uniform sampler2DArray textures;
uniform int texID;
in vec2 vTexCoord;
@RomiTT
RomiTT / dxgl.c
Created March 4, 2020 14:11 — forked from mmozeiko/dxgl.c
WGL_NV_DX_interop2 example
#define COBJMACROS
#define INITGUID
#include <intrin.h>
#include <windows.h>
#include <d3d11.h>
#include <gl/GL.h>
#include "glext.h" // https://www.opengl.org/registry/api/GL/glext.h
#include "wglext.h" // https://www.opengl.org/registry/api/GL/wglext.h
@RomiTT
RomiTT / glfw_ship.cpp
Created March 3, 2020 17:06 — forked from ad8e/glfw_ship.cpp
instructions to use skia and glfw together. (download, installation, first program). works on Linux and Windows.
/* Note: this Google copyright notice only applies to the original file, which has large sections copy-pasted here. my changes are under CC0 (public domain).
* Copyright 2015 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/*
The official instructions don't work well. These alternative instructions are intended to be the shortest path to get a minimal setup running.
void copy_texture(GLuint srcTex, GLuint destTex, int width, int height) {
GLuint fboIds[2];
glGenFramebuffers(2, fboIds);
glBindFramebuffer(GL_READ_FRAMEBUFFER, fboIds[0]);
glFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, srcTex, 0);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fboIds[1]);
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, destTex, 0);
@RomiTT
RomiTT / fragment_shader_NV12_to_RGB.frag
Created November 5, 2019 16:29 — forked from crearo/fragment_shader_NV12_to_RGB.frag
A fragment shader to convert NV12 to RGB.
/** A fragment shader to convert NV12 to RGB.
* Input textures Y - is a block of size w*h.
* texture UV is of size w*h/2.
* Remember, both U and V are individually of size w/2*h/2, but they are interleaved.
* The layout looks like this :
* ----------
* | |
* | Y | size = w*h
* | |
* |________|
libvlc_media_track_t** pp_tracks;
unsigned i_count = libvlc_media_tracks_get(m, &pp_tracks);
if (i_count > 0) {
for (unsigned i = 0; i < i_count; ++i)
{
libvlc_media_track_t* p_track = pp_tracks[i];
switch (p_track->i_type)
{
case libvlc_track_audio:
@RomiTT
RomiTT / picture_CopyPixels.c
Created August 12, 2019 15:45
vlc functions.
void picture_CopyPixels( picture_t *p_dst, const picture_t *p_src )
{
for( int i = 0; i < p_src->i_planes ; i++ )
plane_CopyPixels( p_dst->p+i, p_src->p+i );
assert( p_dst->context == NULL );
if( p_src->context != NULL )
p_dst->context = p_src->context->copy( p_src->context );
}