opengl-es-2.0

OpenGL ES 2.0 Multiple shader programs - texture rendering not working anymore

风流意气都作罢 提交于 2019-12-22 09:58:09
问题 My app draws a mixture of point sprites and standard quad textures. Until recently, I was using a single shader program for this - however a branch in the fragment shader (to decide whether to use point sprite coords/colors) was seriously throttling the performance of my rendering. My fragment shader originally looked like this: precision highp float; uniform sampler2D u_textureSprite; uniform bool u_isSprite; varying vec4 v_color; varying vec2 v_textureCoord; void main() { vec4 textureColor

Is this a practical and enough performant shader for doing blur on mobile device

我是研究僧i 提交于 2019-12-22 09:58:07
问题 I am trying to implement Blur effect in my game on mobile devices using GLSL shader. I don't have any former experience with writing shaders. And I don't understand if my shader is enough good. Actually I have copyied the GLSL code from a tutorial and I don't know it this tutorial is for vivid demo or also can be used in practice. Here is the code of two pass blur shader that uses Gaussian weights (http://www.cocos2d-x.org/wiki/User_Tutorial-RenderTexture_Plus_Blur): #ifdef GL_ES precision

Android OpenGLES 2 ray picking from touch coordinates, unprojecting calculation slightly off

巧了我就是萌 提交于 2019-12-22 08:35:14
问题 I am trying to implement object picking based on touch coordinates via an intersecting ray test. I am having trouble finding information on converting the touch coordinates to the coordinate system used in the world in order to construct this ray. My understanding so far is that the matrix that is applied to each vertex in the scene is: projectionMatrix * viewMatrix * modelMatrix Here is my process for reversing that process in a an attempt to find the ray's endpoint in the scene as well as

OpenGL ES 1.1 to 2.0 a major change?

白昼怎懂夜的黑 提交于 2019-12-22 06:44:44
问题 I'm creating an iPhone app with cocos2d and I'm trying to make use of the following OpenGL ES 1.1 code. However, I'm not good with OpenGL and my app makes use of OpenGL ES 2.0 so I need to convert it. Thus I was wondering, how difficult would it be to convert the following code from ES 1.1 to ES 2.0? Is there some source that could tell me which methods need replacing etc? -(void) draw { glDisableClientState(GL_COLOR_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisable(GL_TEXTURE

Opengl es 2.0 draw bitmap overlay on video

六眼飞鱼酱① 提交于 2019-12-22 05:14:42
问题 I am trying to draw a bitmap as an overlay on every frame of the video. I found an example on how to decode and encode a video and it is working. This example has a TextureRenderer class with a drawFrame function that I need to modify in order to add the bitmap. I am newbie to opengl but I learnt that I need to create a texture with the bitmap and bind it. I tried that in the following code but it is throwing an exception. /* * Copyright (C) 2013 The Android Open Source Project * * Licensed

OpenGLES 2.0: gl_VertexID equivalent?

て烟熏妆下的殇ゞ 提交于 2019-12-22 05:10:13
问题 I'm trying to create a grid of points by calculating vertex positions dynamically, based on their index in the array of vertices sent to the shader. Is there an equivalent of the gl_VertexID variable that I can call from within my shader? Or another way of accessing their position in the array without having to send more data to the GPU? Thank, Josh. Here's my vertex shader: attribute vec4 vertexPosition; uniform mat4 modelViewProjectionMatrix; vec4 temp; uniform float width; void main() {

OpenGLES 2.0: gl_VertexID equivalent?

前提是你 提交于 2019-12-22 05:10:07
问题 I'm trying to create a grid of points by calculating vertex positions dynamically, based on their index in the array of vertices sent to the shader. Is there an equivalent of the gl_VertexID variable that I can call from within my shader? Or another way of accessing their position in the array without having to send more data to the GPU? Thank, Josh. Here's my vertex shader: attribute vec4 vertexPosition; uniform mat4 modelViewProjectionMatrix; vec4 temp; uniform float width; void main() {

'Permission Denied' error while installing apk on device

旧城冷巷雨未停 提交于 2019-12-22 04:29:10
问题 When I use Eclipse to deploy an Opengl ES app to device I get following error [2011-09-19 15:56:40 - SimpleCube] Failed to install SimpleCube.apk on device 'S5830bfcc8426': Permission denied [2011-09-19 15:56:40 - SimpleCube] com.android.ddmlib.SyncException: Permission denied [2011-09-19 15:56:40 - SimpleCube] Launch canceled! It used to work before. But now I flashed my phone with GingerReal 1.2 ROM and when I try to run the app it gives out this error. I have enabled 'Unknown Sources' and

Android OpenGL ES display image fullscreen with aspect ratio

↘锁芯ラ 提交于 2019-12-22 00:51:03
问题 I want to display an image fullscreen in my OpenGL app without losing its aspect ratio. I know that I can draw an image as a texture onto a "cube" or 2d plane. But I'm not sure if this is really the best way when I just simply want to show a 2d image. Espcially because I want this image to be fullscreen without losing its aspect ratio. I know this is easy with an ImageView. But I need this in my OpenGL ES application. But I have no clue how to do this. Anyone any idea? 回答1: Since the aspect

GLSL shader for texture 'smoke' effect

落花浮王杯 提交于 2019-12-21 23:12:22
问题 I've looked around and haven't found anything relevant. I'm tyring to create a shader to give a texture smoke effect animation like here: Not asking for a complete/full solution (although that would be awesome) but any pointers towards where I can get started to achieve this effect. Would i need to have the vertices for the drawing or is this possible if I have the texture only? 回答1: In the example pictured it appears as if they have the vertices. Possibly the "drawing" of the flower shape