fragment-shader

OpenGL gluLookat not working with shaders on

一世执手 提交于 2020-02-05 13:57:08
问题 When i want to use gluLookat and have the shaders on it doesnt move the "camera" when i turn the shaders off it works correctly. Is there something missing in my shaders, i cant figure out what. void display(void) { glClear(GL_COLOR_BUFFER_BIT); glClearColor(0.8, 0.8, 0.8, 0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(0.5,0,1,0.5,0,0,0,1,0); glColor3f(0, 0, 0); glDrawArrays(GL_TRIANGLES, 0, 6); glDrawArrays(GL_LINES, 6, 6); glDrawArrays(GL_TRIANGLES, 12,6); glDrawArrays(GL_LINES

OpenGL ES deprecated in iOS 12 and SKShader

落爺英雄遲暮 提交于 2020-01-24 08:52:09
问题 I am very new to the concept and use of shaders in SpriteKit. I found this tutorial on how to render a Mandelbrot fractal with a custom shader file - Fractal.fsh - attached to a Color Sprite's Custom Shader property. https://www.weheartswift.com/fractals-Xcode-6/ It works fine and I thought to my self that learning about OpenGL ES and custom shaders in SpriteKit would be a fun exercise. According to Apple though, OpenGL ES is deprecated as of iOS 12. https://developer.apple.com/library

OpenGL Implementing MultiPass

徘徊边缘 提交于 2020-01-21 14:22:10
问题 I am having trouble porting some code I have successfully implemented in Shadertoy to desktop OpenGL, the problem is that I need to create a FrameBufferObject FBO so that I can do offscreen computations that will be later passed on to the main glsl fragment shader, the thing is that this buffer needs to reference itself as a texture to get the previous values for it to be able to run a simulation. I have successfully created the FBO: // Framebuffer configuration. unsigned int frameBufferOne;

OpenGL ES glFragColor depend on if condition on Fragment shader in iOS

本秂侑毒 提交于 2020-01-17 06:12:52
问题 I'm writing an app on iOS allows drawing free style (using finger) and drawing image on screen. I use OpenGL ES to implement. I have 2 functions, one is drawing free style, one is drawing texture --- Code drawing free style - (void)drawFreeStyle:(NSMutableArray *)pointArray { //Prepare vertex data ..... // Load data to the Vertex Buffer Object glBindBuffer(GL_ARRAY_BUFFER, vboId); glBufferData(GL_ARRAY_BUFFER, vertexCount*2*sizeof(GLfloat), vertexBuffer, GL_DYNAMIC_DRAW);

Specifying OpenGL Desktop instead of ES for Qt5

[亡魂溺海] 提交于 2020-01-16 05:35:33
问题 I am finally trying to wrap my head around shaders, using a tutorial I found. I decided to start with Qt5 (Windows) since I'm familiar with it and can focus on learning GLSL itself to start with. The only difference between what I'm doing and the tutorial is that I'm working with a QOpenGLWidget rather than a QOpenGLWindow (I just have a form with one widget on it, nothing special). To get started with a fragment shader, in Qt I added a new desktop (not ES) fragment shader to my project, and

Twisted normals with the Three.js normal shader - r.58

∥☆過路亽.° 提交于 2020-01-16 01:11:14
问题 I'm attempting to use the Three.js r.58 normal shader to make a displacement map. I have it displacing correctly, but the lighting doesn't seem to be respecting the post-displacement normals, even when I use computeTangents(). When I turn off the displacement, I see that the default normals are definitely funny. Here's a top view of a sphere, lit from the side (the white dot marks a pointLight): And here's a demo page: http://meetar.github.io/three.js-normal-map-0/index0.html What's causing

SDL OpenGL in C++, Texture Shader missing the texture

坚强是说给别人听的谎言 提交于 2020-01-16 00:42:38
问题 I am trying to create my first OpenGL Shader but are experiencing difficulties when trying to add a texture to a Cube object. Is anyone sharp eyed enough to spot the error? The code might have lots of errors, and I am grateful if anyone points them out, but I am most interested in why my rotating cube is gray and not colorful. (I have skipped all error handling to keep source code size low, sorry about that) * *EDIT Found out I missed some UV settings, still gray cube though ... #include

Three.js - Vertex Shader UV variable return only 0,0

喜你入骨 提交于 2020-01-15 09:19:28
问题 I loaded an object with OBJLoader. I want to use a Shader Material with a texture. I pass my texture to the uniforms parameters of the material. I pass the UV variable from the vertex shader to the fragment shader. But when I use the uv coordinate for mapping my texture I get always 0,0 or at least this is what it looks like. The whole object is coloured with the bottom left pixel of the texture. Here are my shaders: <script type='x-shader/x-vertex' id='vertex-shader'> uniform float u_time;

Three.js - Vertex Shader UV variable return only 0,0

匆匆过客 提交于 2020-01-15 09:19:07
问题 I loaded an object with OBJLoader. I want to use a Shader Material with a texture. I pass my texture to the uniforms parameters of the material. I pass the UV variable from the vertex shader to the fragment shader. But when I use the uv coordinate for mapping my texture I get always 0,0 or at least this is what it looks like. The whole object is coloured with the bottom left pixel of the texture. Here are my shaders: <script type='x-shader/x-vertex' id='vertex-shader'> uniform float u_time;

GLSL ES fragment shader produces very different results on different devices

删除回忆录丶 提交于 2020-01-14 18:45:53
问题 I am developing a game for Android using OpenGL ES 2.0 and have a problem with a fragment shader for drawing stars in the background. I've got the following code: precision mediump float; varying vec2 transformed_position; float rand(vec2 co) { return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); } void main(void) { float distance = 10.0; float quantization_strength = 4.0; vec3 background_color = vec3(0.09, 0.0, 0.288); vec2 zero = vec2(0.0, 0.0); vec2 distance_vec = vec2