GPGPU labor VI. Rekurzív algoritmusok labirintus.

Slides:



Advertisements
Similar presentations
Programming with OpenGL - Getting started - Hanyang University Han Jae-Hyek.
Advertisements

Computer Graphics - Graphics Programming -
Department of nskinfo i-education
Robot Arm //Função callback de redesenho da janela de visualização void Display(void) { glClear(GL_COLOR_BUFFER_BIT); glPushMatrix(); glTranslatef(-1.0,
Presented by: Stacy C. Lovell. How do we perceive color? Our eyes contain only 3 types of photosentitive cells tuned to three frequencies Red, Green,
Hardware Virtual Texturing
POST-PROCESSING SET09115 Intro Graphics Programming.
GPGPU labor IV. Scatter és gather. Kezdeti teendők Tantárgy honlapja, Scatter és gather A labor kiindulási alapjának letöltése (lab4_base.zip), kitömörítés.
GPGPU labor XIII. Folyadék szimuláció. Kezdeti teendők Tantárgy honlapja, Folyadék szimuláció A labor kiindulási alapjának letöltése (lab13_base.zip),
GPGPU labor VIII. OpenCL bevezetés. Kezdeti teendők Tantárgy honlapja, OpenCL bevezetés II. A labor kiindulási alapjának letöltése (lab8_base.zip), kitömörítés.
GPGPU labor IV. Scatter és gather. Kezdeti teendők Tantárgy honlapja, Scatter és gather A labor kiindulási alapjának letöltése (lab4_base.zip), kitömörítés.
1Computer Graphics Building Models John Shearer Culture Lab – space 2
Week 4 Lecture 1: OpenGL 3.x & 4.x. 2 Objectives Changes in OpenGL 3.x 4.x Changes in GLSL 1.3/4/5 4.x.
Coordinate System.
Tesselation Shaders. Tesselation  dictionary definition of tesselate is the forming of a mosaic.
Procedural Textures. Noise in glman  glman automatically creates 2D and 3D textures (with default sizes 64x64 and 64x64x64) named  Noise2  Noise3 
OPEN GL. Install GLUT Download package di sini Dari devcpp, buka Tools->PackageManager-
CCSprite *sprite = [CCSprite [sprite runAction: [CCRepeatForever actionWithAction: [CCSequence actions: [CCEaseIn.
Line and Curve Drawing Algorithms. Line Drawing x0x0 y0y0 x end y end.
Chapter 2: Graphics Programming
Computer Graphics CSCE 441
EECS 700: Computer Modeling, Simulation, and Visualization Dr. Shontz Chapter 2: Shader Fundamentals (continued)
1 Building Models. 2 Objectives Introduce simple data structures for building polygonal models ­Vertex lists ­Edge lists OpenGL vertex arrays.
OpenGL Buffers and Tests Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Friday, February 8, 2002.
1 Buffers and Processing Fragments 2011 Autumn Animação e Visualização Tridimensional 2011/2012.
OPENGL Return of the Survival Guide. Buffers (0,0) OpenGL holds the buffers in a coordinate system such that the origin is the lower left corner.
University of Sulaimani - School of Science - Computer Dept.
#include int line_width = 1; void Display( void ) { glEnable( GL_LINE_STIPPLE ); glClearColor (0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT);
MAT 594CM S2010Fundamentals of Spatial ComputingAngus Forbes Overview Today: - Make sure everyone is set up with an OpenGL environment - OpenGL basics:
Draw a Simple Object. Example 1/4 #include “ glut.h ” void display(); void reshape(GLsizei w, GLsizei h); void main(int argc, char** argv){ glutInit(&argc,
GLSL I Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University of New Mexico.
Mohan Sridharan Based on slides created by Edward Angel GLSL I 1 CS4395: Computer Graphics.
GAM532 DPS932 – Week 1 Rendering Pipeline and Shaders.
Computer Graphics Bing-Yu Chen National Taiwan University.
Michael Robertson Yuta Takayama. WebGL is OpenGL on a web browser. OpenGL is a low-level 3D graphics API Basically, WebGL is a 3D graphics API that generates.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
OpenGL 3.0 Texture Arrays Presentation: Olivia Terrell, Dec. 4, 2008.
Geometry Shaders. Visualizing Normal Vectors  textbook calls this a “hedgehog plot” but (I think) that this is a misuse of the term  a hedgehog plot.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Geometric Objects and Transformations. Coordinate systems rial.html.
CIS 565 Fall 2011 Qing Sun
Programming with OpenGL Part 2: Complete Programs Ed Angel Professor of Emeritus of Computer Science University of New Mexico.
Programming with OpenGL Part 2: Complete Programs Ed Angel Professor of Emeritus of Computer Science University of New Mexico.
OpenGL Shading Language (Advanced Computer Graphics) Ernest Tatum.
Programming for Artists ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 11 Fall 2010.
1 Figures are extracted from Angel's book (ISBN x) The Human Visual System vs The Pinhole camera Human Visual System Visible Spectrum Pinhole.
1 Graphics CSCI 343, Fall 2015 Lecture 4 More on WebGL.
Interactive Computer Graphics CS 418 MP1: Dancing I TA: Zhicheng Yan Sushma S Kini Mary Pietrowicz Slides Taken from: “An Interactive Introduction to OpenGL.
Introduction to OpenGL  OpenGL is a graphics API  Software library  Layer between programmer and graphics hardware (and software)  OpenGL can fit in.
CH8 Frame Buffer Object 1. Introduction Name OpenGL :Frame Buffer Object DirectX:Render Target Usage Render to Texture 2.
Draw a Simple Object. Pixel pipeline Vertex pipeline Course Map Transformation & Lighting Primitive assembly Viewport culling & clipping Texture blending.
OpenGL Shading Language (GLSL)
OpenGL Shading Language (GLSL)
Geometry Shader (GLSL)
Vertex Buffer Objects and Shader Attributes. For Further Reading Angel 7 th Ed: –Most parts of Chapter 2. Beginning WebGL: –Chapter 1: vertex Buffer Objects,
Week 3 Lecture 4: Part 2: GLSL I Based on Interactive Computer Graphics (Angel) - Chapter 9.
CS552: Computer Graphics Lecture 6: Viewing in 2D.
Accumulation-Based Effects Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Wednesday, February 4, 2004.
Wilf Comp Ambient Occlusion + Order Independent Transparency POST CONCLUSIONS.
OpenGL: Introduction #include main() { OpenWindow() ; glClearColor(0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT); glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0,
Int fact (int n) { If (n == 0) return 1; else return n * fact (n – 1); } 5 void main () { Int Sum; : Sum = fact (5); : } Factorial Program Using Recursion.
GLSL I.  Fixed vs. Programmable  HW fixed function pipeline ▪ Faster ▪ Limited  New programmable hardware ▪ Many effects become possible. ▪ Global.
Introduction to Graphics Programming. Graphics API.
COMP 175 | COMPUTER GRAPHICS Remco Chang1/XX13 – GLSL Lecture 13: OpenGL Shading Language (GLSL) COMP 175: Computer Graphics April 12, 2016.
Computer Graphics (Fall 2003) COMS 4160, Lecture 5: OpenGL 1 Ravi Ramamoorthi Many slides courtesy Greg Humphreys.
Lecture 8: Discussion of papers OpenGL programming Lecturer: Simon Winberg Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
GLSL I Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University of New Mexico.
Introduction to Computer Graphics with WebGL
Chapter X Output Merger.
CS 480/680 Fall 2011 Dr. Frederick C Harris, Jr. Computer Graphics
Presentation transcript:

GPGPU labor VI. Rekurzív algoritmusok labirintus

Kezdeti teendők Tantárgy honlapja, rekurzív algoritmusok A labor kiindulási alapjának letöltése (lab6_base.zip), kitömörítés a D:\GPGPU\ könyvtárba D:\GPGPU\labs\lab6_glsl\lab6_glsl\lab6_glsl.s ln indítása Project tulajdonságai – Configuration Properties – Debugging – Working Directory = $(ProjectDir)\..\..\bin

Próba

Adat buffer Globális Framebuffer* dataBuffer; Shader* generateShader; int labyrinthSize = 64; bool recalcLabyrinth = true; float noiseSeed = (float) rand() / (float) RAND_MAX; float noiseStart = 0.5; float noiseScale = 0.5; Init dataBuffer = new Framebuffer(labyrinthSize, labyrinthSize, 2, true, false); generateShader = new Shader("passthrough.vert", "generate.frag"); glutReshapeWindow(labyrinthSize * windowScale, labyrinthSize * windowScale);

Display glClearColor(0.17f, 0.4f, 0.6f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); if(recalcLabyrinth){ int level = dataBuffer->getLevels() - 1; dataBuffer->setRenderTarget(level); GLenum ca = GL_COLOR_ATTACHMENT0; glDrawBuffers(1, &ca); glClearColor(1,0,1,0); glClear(GL_COLOR_BUFFER_BIT); ca = GL_COLOR_ATTACHMENT1; glDrawBuffers(1, &ca); glClearColor(0.5,0.5,0.5,0.5); glClear(GL_COLOR_BUFFER_BIT); float scale = noiseStart; for(level = level - 1; level >= 0; level--){ dataBuffer->setRenderTarget(level); generateShader->enable(); generateShader->bindUniformInt("level", level); generateShader->bindUniformFloat("noiseScale", scale); generateShader->bindUniformFloat("noiseSeed", noiseSeed * 16.0); generateShader->bindUniformTexture("inputTex1", dataBuffer->getColorBuffer(0),0); generateShader->bindUniformTexture("inputTex2", dataBuffer->getColorBuffer(1),1); generateShader->bindUniformTexture("noiseTex", noiseTexture->getTextureHandle(),2); fullscreenQuad->render(generateShader); generateShader->disable(); scale *= noiseScale; } dataBuffer->disableRenderTarget(); recalcLabyrinth = false; }

Display folyt: glViewport(0,0,windowWidth, windowHeight); simpleShader->enable(); simpleShader->bindUniformTexture("inputTex", dataBuffer->getColorBuffer(1),0); fullscreenQuad->render(simpleShader); simpleShader->disable(); glutSwapBuffers();

Keyboard case 'q': noiseScale *= 1.01; recalcLabyrinth = true; std::cout<<"noiseScale: "<<noiseScale<<" noiseScaleStart: "<<noiseStart<<std::endl; break; case 'a': noiseScale *= 0.99; recalcLabyrinth = true; std::cout<<"noiseScale: "<<noiseScale<<" noiseScaleStart: "<<noiseStart<<std::endl; break; case 'w': noiseStart *= 1.01; recalcLabyrinth = true; std::cout<<"noiseScale: "<<noiseScale<<" noiseScaleStart: "<<noiseStart<<std::endl; break; case 's': noiseStart *= 0.99; recalcLabyrinth = true; std::cout<<"noiseScale: "<<noiseScale<<" noiseScaleStart: "<<noiseStart<<std::endl; break;

generate.frag #version 130 out vec4 outcolor[2]; in vec2 fTexCoord; uniform sampler2D inputTex1; uniform sampler2D inputTex2; uniform sampler2D noiseTex; uniform int level; uniform float noiseScale; uniform float noiseSeed; void main() { ivec2 coord = ivec2(gl_FragCoord.xy); vec4 R = textureLod(inputTex2, fTexCoord, level + 1); vec4 rand = texelFetch(noiseTex, ivec2(mod(coord + ivec2(noiseSeed, 0), ivec2(16))), 0); outcolor[1] = R + noiseScale * (rand - 0.5); }

Próba

Generate.frag outcolor[1] = R + noiseScale * (rand - 0.5); ivec2 coordBase = coord / 2; ivec2 coordRel = ivec2(mod(vec2(coord), vec2(2))); int index = coordRel.x + coordRel.y * 2; vec4 V; vec4 P = texelFetch(inputTex1, coordBase, level + 1); V = P; //szülő cella öröklése outcolor[0] = V;

Display: simpleShader->bindUniformTexture("inputTex", dataBuffer->getColorBuffer(1),0); helyett simpleShader->bindUniformTexture("inputTex", dataBuffer->getColorBuffer(0),0);

Próba Nem elég informatív!!

Labirintus vizualizációja Globális Shader* visualizeShader; Framebuffer* visualizeTex; Init: visualizeTex = new Framebuffer( dataBuffer->getWidth() * 2 + 1, dataBuffer->getHeight() * 2 + 1, 1, false, false); visualizeShader = new Shader("passthrough.vert", "visualize.frag");

Display visualizeTex->setRenderTarget(); visualizeShader->enable(); visualizeShader->bindUniformTexture("inputTex",dataBuffer- >getColorBuffer(0),0); fullscreenQuad->render(visualizeShader); visualizeShader->disable(); visualizeTex->disableRenderTarget(); glViewport(0,0,windowWidth, windowHeight); simpleShader->enable(); simpleShader->bindUniformTexture("inputTex", visualizeTex ->getColorBuffer(0),0); fullscreenQuad->render(simpleShader); simpleShader->disable(); glutSwapBuffers();

visualize.frag #version 130 out vec4 outcolor; in vec2 fTexCoord; uniform sampler2D inputTex; void main() { outcolor = vec4(0); ivec2 coord = ivec2(gl_FragCoord.xy); if(coord.x == 0){ if(texelFetch(inputTex, coord / 2, 0).z == 1 && mod(coord.y, 2) == 1) outcolor = vec4(1); } else if(coord.y == 0){ if(texelFetch(inputTex, coord / 2, 0).w == 1 && mod(coord.x, 2) == 1) outcolor = vec4(1); } else{ coord = coord - ivec2(1); ivec2 coordBase = coord / 2; ivec2 coordRel = ivec2(mod(vec2(coord), vec2(2))); vec4 Vp = texelFetch(inputTex, coordBase, 0); if(coordRel.x == 0 && coordRel.y == 0) outcolor = vec4(1); else if(coordRel.x == 1 && coordRel.y == 0 && Vp.x == 1) outcolor = vec4(1); else if(coordRel.x == 0 && coordRel.y == 1 && Vp.y == 1) outcolor = vec4(1); }

Próba

Csak az átjárók felét tartsuk meg! generate.frag vec4 M[4] = vec4[4](vec4(1,1,0,0), vec4(0,1,1,0), vec4(1,0,0,1), vec4(0,0,1,1)); vec4 D[4] = vec4[4](vec4(1,1,0,1), vec4(0,1,1,0), vec4(1,1,1,1), vec4(1,0,1,1)); vec4 inv(vec4 v){return vec4(1.0) - v;} vec4 uni(vec4 v1, vec4 v2){ return min(vec4(1.0), v1 + v2);}

generate.frag V = P helyett V = P * D[index];

Próba

Belső falakat tüntessük el! generate.frag V = P * D[index]; V = uni(V, M[index]);

Próba

Cella felosztás generate.frag vec4 W1; // fuggoleges v. vizszintes vec4 W2; // bal/lenn - jobb/fenn if(R.x < 0.25){ // right W1 = vec4(1,0,1,0); W2 = vec4(M[index].x == 1); } else if(R.x < 0.5) { // top W1 = vec4(0,1,0,1); W2 = vec4(M[index].y == 1); } else if(R.x < 0.75){ // left W1 = vec4(1,0,1,0); W2 = vec4(M[index].z == 1); } else{ // bottom W1 = vec4(0,1,0,1); W2 = vec4(M[index].w == 1); } V = V * uni(uni(W1, W2), inv(M[index]));

Próba Labirintus kész!

Legrövidebb út keresés Globális Shader* searchShader; Framebuffer* shortestPath; GLuint streamoutBufffer[2]; GLuint outputQuery; bool startPointChanged = true; bool endpointChanged = true; float startX = 0; float startY = labyrinthSize -1; float endX = labyrinthSize - 1; float endY = labyrinthSize - 1;

Init shortestPath = new Framebuffer(labyrinthSize, labyrinthSize, 1, false, true); glGenBuffers(2,streamoutBufffer); glBindBuffer(GL_ARRAY_BUFFER_ARB,streamoutBufffer[0]); glBufferData(GL_ARRAY_BUFFER_ARB, labyrinthSize*labyrinthSize*4*sizeof(float)*2,0,GL_DYNAMIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER_ARB,streamoutBufffer[1]); glBufferData(GL_ARRAY_BUFFER_ARB, labyrinthSize*labyrinthSize*4*sizeof(float)*2,0,GL_DYNAMIC_DRAW); searchShader = new Shader("search.vert", "search.frag", "search.geom"); glGenQueries(1, &outputQuery);

void recursion( float startX, float startY, float startZ, float startW) { glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER,0,streamoutBufffer[0]); glBeginTransformFeedback(GL_POINTS); glBeginQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, outputQuery); glPointSize(1); glBegin(GL_POINTS); glVertex4f(startX, startY, startZ, startW); glEnd(); glEndQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN); glEndTransformFeedback(); GLint outPointCount = 0; GLint succ = 0; while(!succ) glGetQueryObjectiv(outputQuery, GL_QUERY_RESULT_AVAILABLE, &succ); glGetQueryObjectiv(outputQuery, GL_QUERY_RESULT, &outPointCount); //std::cout << "points written: " << outPointCount << std::endl; succ = 0;

glEnableClientState(GL_VERTEX_ARRAY); int bb = 0; while(outPointCount > 0) { glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER,0,streamoutBufffer[(bb+1)%2]); glBeginTransformFeedback(GL_POINTS); glBeginQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, outputQuery); glBindBufferARB(GL_ARRAY_BUFFER_ARB, streamoutBufffer[bb]); glVertexPointer(4,GL_FLOAT,0,NULL); glDrawArrays(GL_POINTS, 0, outPointCount); glEndTransformFeedback(); glEndQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN); while(!succ) glGetQueryObjectiv(outputQuery, GL_QUERY_RESULT_AVAILABLE, &succ); glGetQueryObjectiv(outputQuery, GL_QUERY_RESULT, &outPointCount); succ = 0; bb = (bb + 1) % 2; } glDisableClientState(GL_VERTEX_ARRAY); }

Display if(recalcLabyrinth) {.. startPointChanged = true; } if(startPointChanged) { endpointChanged = true; shortestPath->setRenderTarget(); glClearColor(0,0,0,0); glClear(GL_COLOR_BUFFER_BIT); searchShader->enable(); searchShader->bindUniformTexture("inputTex1", dataBuffer->getColorBuffer(0), 0); searchShader->bindUniformTexture("inputTex2", shortestPath->getColorBuffer(0), 1); recursion(startX, startY, 0, 5); searchShader->disable(); shortestPath->disableRenderTarget(); startPointChanged = false; }... simpleShader->bindUniformTexture("inputTex", shortestPath->getColorBuffer(0),0);

Mouse if(GLUT_LEFT_BUTTON == button && GLUT_UP == state) { startX = x/windowScale; startY = y/windowScale; startPointChanged = true; } else if(GLUT_RIGHT_BUTTON == button && GLUT_UP == state) { endX = x/windowScale; endY = y/windowScale; endpointChanged = true; }

simple.frag void main() { outcolor = texture(inputTex, fTexCoord); outcolor = outcolor.bbbb / 400; }

search.vert #version 130 in vec4 position; //out vec4 celldata; void main(void) { gl_Position = gl_Vertex; }

search.geom #version 130 #extension GL_EXT_geometry_shader4 : enable uniform sampler2D inputTex1; //neighbour information uniform sampler2D inputTex2; //celldata texture (shortest path + path dir) out vec4 celldata; void main(void){ vec2 windowSize = textureSize(inputTex2, 0); vec4 vertexdata = gl_PositionIn[0]; //read neighbour information vec4 neighInf = texelFetch(inputTex1, ivec2(vertexdata.xy), 0); vec4 storedCelldata = texelFetch(inputTex2, ivec2(vertexdata.xy), 0); if(storedCelldata.z > vertexdata.z || storedCelldata.w == 0){ celldata = vertexdata; vec2 wCoord = vertexdata.xy / windowSize * ; gl_Position = vec4(wCoord,0,1); EmitVertex(); }...

search.geom //emit neighbours if connected //right if(neighInf.r == 1) { celldata = vertexdata; celldata.x += 1; celldata.z += 1; celldata.w = 3; storedCelldata = texelFetch(inputTex2, ivec2(celldata.xy), 0); if((storedCelldata.z > celldata.z || storedCelldata.w == 0) && celldata.x < windowSize.x) { vec2 wCoord = celldata.xy / windowSize * ; gl_Position = vec4(wCoord,0,1); EmitVertex(); }... Többi irányra is EndPrimitive(); }

search.frag #version 130 out vec4 outcolor; in vec4 celldata; void main() { outcolor = celldata; }

Próba

Bejárás Globális Shader* walkPathShader; Init walkPathShader = new Shader("search.vert", "red.frag", "walkpath.geom");

Bejárás if(endpointChanged) { labyrinthTex->setRenderTarget(); visualizeShader->enable(); visualizeShader->bindUniformTexture("inputTex",buffer- >getColorBuffer(0),0); fullscreenQuad->render(visualizeShader); visualizeShader->disable(); walkPathShader->enable(); walkPathShader->bindUniformTexture("inputTex1", shortestPath- >getColorBuffer(0), 0);

Display visualizeTex->setRenderTarget(); visualizeShader->enable(); visualizeShader->bindUniformTexture("inputTex",dataBuffer->getColorBuffer(0),0); fullscreenQuad->render(visualizeShader); visualizeShader->disable(); visualizeTex->disableRenderTarget(); Helyett....

if(endpointChanged) { visualizeTex->setRenderTarget(); visualizeShader->enable(); visualizeShader->bindUniformTexture("inputTex", dataBuffer->getColorBuffer(0),0); fullscreenQuad->render(visualizeShader); visualizeShader->disable(); walkPathShader->enable(); walkPathShader->bindUniformTexture("inputTex1", shortestPath->getColorBuffer(0), 0); recursion(endX, endY, 0, 5); walkPathShader->disable();...

glBegin(GL_POINTS); glColor3f(0,0,1); glVertex3f((float)(startX * 2 + 1) / (float)(2 * labyrinthSize) * 2.0f - 1.0f, (float)(startY * 2 + 1) / (float)(2 * labyrinthSize) * 2.0f - 1.0f, 0); glColor3f(0,1,0); glVertex3f((float)(endX * 2 + 1) / (float)(2 * labyrinthSize) * 2.0f - 1.0f, (float)(endY * 2 + 1) / (float)(2 * labyrinthSize) * 2.0f - 1.0f, 0); glEnd(); visualizeTex->disableRenderTarget(); endpointChanged = false; }

Display glViewport(0,0,windowWidth, windowHeight); simpleShader->enable(); simpleShader->bindUniformTexture("inputTex", visualizeTex->getColorBuffer(0),0); fullscreenQuad->render(simpleShader); simpleShader->disable();

simple.frag void main() { outcolor = texture(inputTex, fTexCoord); outcolor = outcolor.bbbb / 400; }

walkpath.geom #version 130 #extension GL_EXT_geometry_shader4 : enable uniform sampler2D inputTex1; //cell information out vec4 celldata; void main(void) { vec2 windowSize = textureSize(inputTex1, 0); vec4 vertexdata = gl_PositionIn[0]; vec4 storedCelldata = texelFetch(inputTex1, ivec2(vertexdata.xy), 0); if(storedCelldata.z == 0) return;...

if(storedCelldata.w == 1) // right { celldata = vertexdata; celldata.x += 1; vec2 wCoord = (celldata.xy * 2 + 1) / (windowSize * 2 + 1) * ; gl_Position = vec4(wCoord,0,1); EmitVertex(); }...többi irányra is EndPrimitive(); }

red.frag #version 130 out vec4 outcolor; in vec4 celldata; void main() { outcolor = vec4(1,0,0,1); }

Próba

Vége