opengl-es-2.0

Uv-Coordinates: Theoretical questions

霸气de小男生 提交于 2020-01-06 17:59:48
问题 In my previouse question I had some problems regarding texturing in OpenGL ES 2.0. With some help this problem is solved now, but some related questions have appeared: How do I know wheather uv-coordinate and vertex-coordinates fit together? I thought there is a bijection between the vertex and uv, for example (0,0) of vertex to (0,0) of uv, and (width,0) of vertex to (1,0), and (0,height) of vertex to (0,1) of uv. But since the texture appears flipped in my example, the thought might be

Extra Space in WebGL Despite Same Dimension

为君一笑 提交于 2020-01-06 16:17:24
问题 In short, I am rendering a 2D image on a quad that fills the viewport. In Firefox it looks fine, but Chrome has a 1px spacing on the right and bottom. What I did was set the dimension of the canvas and viewport to the size of the image. Am I doing anything wrong? Here's my code in case you want to see it. function initShaders() { var fragmentShader = getShader(gl, "shader-fs"); var vertexShader = getShader(gl, "shader-vs"); //create the program shaderProgram = gl.createProgram(); gl

Android OpenGL2.0 intersection between two textures

旧时模样 提交于 2020-01-06 15:54:51
问题 I'm making game in OpenGL2.0 and I want to check are two sprites have intersection but i don't need to check intersection between two rectangles.I have two sprites with texture,some part of texture is transparent,some not. I need to check intersection between sprites only on not trasnparent part. Example: http://i.stack.imgur.com/ywGN5.png 回答1: The easiest way to determine intersection between two sprites is by Bounding Box method. Object 1 Bounding Box: vec3 min1 = {Xmin, Ymin, Zmin} vec3

Android OpenGL2.0 intersection between two textures

微笑、不失礼 提交于 2020-01-06 15:54:30
问题 I'm making game in OpenGL2.0 and I want to check are two sprites have intersection but i don't need to check intersection between two rectangles.I have two sprites with texture,some part of texture is transparent,some not. I need to check intersection between sprites only on not trasnparent part. Example: http://i.stack.imgur.com/ywGN5.png 回答1: The easiest way to determine intersection between two sprites is by Bounding Box method. Object 1 Bounding Box: vec3 min1 = {Xmin, Ymin, Zmin} vec3

Android NDK glReadPixels() from offscreen buffer

谁都会走 提交于 2020-01-06 14:50:15
问题 I'm writing a game using android ndk. I'm using picking to select objects in opengl. For that i have an offscreen framebuffer object where i render into and i use glReadPixels() to get the color from the FBO. The color then encodes the id of the clicked object. The problem is glReadPixels() does not work. It just does not read any color values. Is there anything I have to do, to make it work? GLubyte pixel[4] = {0,0,0,0}; glReadPixels(x, y , 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, (void *)pixel);

Switching current GL_COLOR_ATTACMENT in FBO

a 夏天 提交于 2020-01-06 07:31:10
问题 Then we create buffer object we can specify many colour attachments from 0 to N glBindFramebuffer(GL_FRAMEBUFFER, some_buffer); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,some_texture_0, 0); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D,some_texture_1, 0); But then we draw to buffer, how to control which colour attachment we use in FBO? (default is 0), or multiple colour attachments works different way? glBindFramebuffer(GL

Font rendering (Freetype) with openGL ES 2.0 combined with other line drawing functions does not work

左心房为你撑大大i 提交于 2020-01-06 06:25:27
问题 This thread is related to https: //stackoverflow.com/questions/50955558/render-fonts-with-sdl2-opengl-es-2-0-glsl-1-0-freetype I have a problem combining font rendering and using this function as follows: // Create VBO (Vertex Buffer Object) based on the vertices provided, render the vertices on the // background buffer and eventually swap buffers to update the display. // Return index of VBO buffer GLuint drawVertices(SDL_Window *window, Vertex *vertices, GLsizei numVertices, int mode){ //

Check iOS XCode Project Files: openGL Particle Emitter for GLKit

守給你的承諾、 提交于 2020-01-06 03:50:08
问题 I am trying to port the Particle Emitter by Michael Daley to GLKView and found a XCode project where he did this on github - unfortunately heavily bound inside a nice little game. Now I tried to take only the particle emitter out of his game project to reuse it (I need it in 2D) and I made it up to a state without any compile error - but couldn't see nothing... Here is the project file. Could anybody tell me why there is no particle emitter visible? thnx! 来源: https://stackoverflow.com

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

Change GlSurfaceView renderer

假如想象 提交于 2020-01-05 17:41:42
问题 I looked all over the net in order to find out if its possible to change the renderer of a GLSurfaceView on the flight. The reason is that I want to change the OpenGl program, and initiate all the attributes and unified params from its vertex and fragment shader and I don't want the any change would require to create a brand new GLSurfaceView with a brand new Renderer. It seems like reasonable operation that should be doable. 回答1: Note: I haven't implemented the following. GLSurfaceView