vertex-shader

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;

Can't draw triangle using Opengl

前提是你 提交于 2020-01-11 14:21:10
问题 in this code i want to draw a simple triangle on a blue background using openGL however when i compile and run the code only a window with the blue background appears (without the white triangle that is supposed to be drawn), iam using Xcode my code #include <iostream> #include <string> #include <GLUT/glut.h> #include <OpenGL/gl3.h> #include <fstream> using namespace std; // VAO & VBO objects GLuint VBO; GLuint VAO; void display(); // vertex Data (position) float vertex[] = {-1.0, 0.0 , 1.0,

Why GLES20.glGetAttribLocation returns different values for different devices?

拜拜、爱过 提交于 2020-01-06 03:41:57
问题 I'm trying using OpenGL2.0 and create multiple cubes in 3D space, for android devices. The code it runs perfectly in some devices, but not in others, and i don't know why... (All devices have OpenGL 2.0 supported, and have recent android versions [5.0 or 6.0]) I only know that the problem is in a -1 return value (see down) int vertexShader = loadGLShader(GLES20.GL_VERTEX_SHADER, R.raw.vertex); int gridShader = loadGLShader(GLES20.GL_FRAGMENT_SHADER, R.raw.grid_fragment); int passthroughShader

Get old style OpenGL code work in GLSL

℡╲_俬逩灬. 提交于 2020-01-05 16:48:23
问题 I am trying to draw this pattern in OpenGL : To get this, I created the pattern like : vector< vector<DataPoint> > datas; float Intensitytemp=0; float xPos=0, yPos=0, angleInRadians=0; for (float theta = 0.0f; theta < 4096; theta += 1.f) { vector<DataPoint> temp; angleInRadians = 2 * M_PI*theta / 4096; for (float r = 0; r < 4096; r += 1.f) { xPos = cos(angleInRadians)*r / 4096; yPos = sin(angleInRadians)*r / 4096; Intensitytemp = ((float)((int)r % 256)) / 255; DataPoint dt; dt.x = xPos; dt.y

How to draw a star in iOS OpenGL ES 2.0

大兔子大兔子 提交于 2019-12-31 07:18:21
问题 This question has been asked before but the quite a few years ago in my searches. The answer was always to use texture mapping but what I really want to do is represent the star as a single vertex - you may think I'm copping out with a simplistic method but in fact, a single point source of light actually looks pretty good and realistic. But I want to process that point of light with something like a gaussian blur too give it a little more body when zooming in or for brighter stars. I was

Silhouette-Outlined shader

一个人想着一个人 提交于 2019-12-25 11:59:30
问题 I'm trying to implement GLSL shader which would highlight the outer edges of rendered 3D mesh. The problem is that I do not have access to the OpenGL client side code so this must be done only in GLSL shaders. My first attempt was to use/adopt this shader from Unity and do it in OpenGL GLSL . Here how it should look: And here is what I got: I'm not sure If I compute the stuff correctly but as you can see the output is nowhere near my expectations. Here is the ogre material material Chassis {

Metal vertex shader draw points of a Texture

牧云@^-^@ 提交于 2019-12-24 11:01:30
问题 I want to execute Metal (or OpenGLES 3.0) shader that draws Points primitive with blending. To do that, I need to pass all the pixel coordinates of the texture to Vertex shader as vertices which computes the position of the vertex to be passed to fragment shader. The fragment shader simply outputs the color for the point with blending enabled. My problem is if there is an efficient was to pass coordinates of vertices to the vertex shader, since there would be too many vertices for 1920x1080

glsify - error 'You may need an appropriate loader to handle this file type'?

无人久伴 提交于 2019-12-24 07:29:30
问题 Ok Im following https://tympanus.net/codrops/2019/01/17/interactive-particles-with-three-js/ just trying to get his custom shader to work. I brought in the .frag and .vert files (included in the link) and copied how his setup. When I run I get the error Module parse failed: Unexpected token (3:10) You may need an appropriate loader to handle this file type. Here: const material = new THREE.RawShaderMaterial({ uniforms, vertexShader: glslify(require('./vendor/shaders/particle.vert')), //HERE!!

Dynamically sized arrays in OpenGL ES vertex shader; used for blend shapes/morph targets

≡放荡痞女 提交于 2019-12-23 22:54:10
问题 I'm about to do an Opengl ES implementation of blend shapes/morph targets and I'm not quite sure about the best way for me to do this. The problems I am facing is that I want the interpolation of the vertex data to occur on the GPU but I also want the number of blend shapes to be arbitrary. To clarify, I do not want my vertex shader to look like this: Glitchy Facial Morph Target Animation in OpenGL (C++). The problem with this implementation is that the number of meshes to blend between is