Skip to content

Instantly share code, notes, and snippets.

View lewkoo's full-sized avatar

Levko Ivanchuk lewkoo

View GitHub Profile
@lewkoo
lewkoo / NaiveGradient.cpp
Created January 20, 2014 23:52
Naive gradient creation with OpenFrameworks
//set the image size
int imageWidth = 960;
int imageHeight = 540; // change these to any integers
//instanciate a gradient variable
ofImage gradient = ofImage();
gradient.allocate(960,540,OF_IMAGE_COLOR);
@lewkoo
lewkoo / main.cpp
Created January 24, 2014 21:07
OpenFrameworks simple main method
#include "ofMain.h"
#include "testApp.h"
#include "ofAppGlutWindow.h"
//========================================================================
int main( ){
ofAppGlutWindow window;
ofSetupOpenGL(&window, 960, 540, OF_WINDOW); // <-------- setup the GL context
@lewkoo
lewkoo / testApp.hpp
Last active January 4, 2016 10:09
testFile.hpp
#pragma once
#include "ofMain.h"
class testApp : public ofBaseApp{
public:
void setup();
void update();
void draw();
@lewkoo
lewkoo / testApp.cpp
Created January 24, 2014 21:19
testApp inicialization
#include "testApp.h"
//--------------------------------------------------------------
void testApp::setup(){
ofSetLogLevel(OF_LOG_VERBOSE);
ofBackground(34, 34, 34);
ofSetVerticalSync(false);
ofEnableAlphaBlending();
@lewkoo
lewkoo / add_20.frag
Last active January 4, 2016 10:19
Fragment shader
#version 120
void main(){
//this is the fragment shader
//this is where the pixel level drawing happens
//gl_FragCoord gives us the x and y of the current pixel its drawing
gl_FragColor.r = gl_Color.r + 20;
gl_FragColor.g = gl_Color.g + 20;
@lewkoo
lewkoo / testApp.cpp
Created January 25, 2014 17:41
Shader usage
void testApp::draw()
{
if(doShader)
shader.begin();
gradient.draw(0,0,960,540);
if(doShader)
shader.end();
#version 120
void main() {
vec4 color;
float xCor = gl_FragCoord.x;
vec4 white = vec4(1);
vec4 black = vec4(0);
float x = smoothstep(0, 960.0, xCor);
@lewkoo
lewkoo / ofApp.cpp
Created February 27, 2014 03:18
ofApp.cpp of a very simple Android shader example code
#include "ofApp.h"
//--------------------------------------------------------------
void ofApp::setup(){
ofSetLogLevel(OF_LOG_VERBOSE);
ofBackground(34, 34, 34);
ofSetVerticalSync(false);
ofEnableAlphaBlending();
@lewkoo
lewkoo / ofApp.h
Created February 27, 2014 03:19
ofApp.h of a very simple Android shader code
#ifndef _TEST_APP
#define _TEST_APP
#include "ofMain.h"
#include "ofxAndroid.h"
class ofApp : public ofxAndroidApp{
public:
@lewkoo
lewkoo / main.cpp
Created February 27, 2014 03:19
main.cpp of a very simple Android shader example
#include "ofMain.h"
#include "ofApp.h"
// comment out the line below if you want to use a fixed pipeline opengl renderer,
// otherwise leave this line uncommented if you want to use a programmable pipeline opengl renderer.
#define USE_PROGRAMMABLE_RENDERER
#ifdef USE_PROGRAMMABLE_RENDERER
#include "ofGLProgrammableRenderer.h"
#endif