opengl-es

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

Render to texture problem with alpha

拟墨画扇 提交于 2019-12-22 08:55:02
问题 When I render to texture, and then draw the same image, it seems to make everything darker. To get this image: http://img24.imageshack.us/img24/8061/87993367.png I'm rendering the upper-left square with color (1, 1, 1, .8) to a texture, then rendering that texture, plus the middle square (same color) to another texture, then finally that texture plus the lower-right square (same color) to the screen. As you can see, each time I render to texture, everything gets a little darker. My render-to

OpenGL ES 1.1 Vertex Buffer Object Not Working

点点圈 提交于 2019-12-22 08:36:31
问题 I am developing an iPhone game using OpenGL ES 1.1 and need to use vertex buffer objects in order to render 500+ particles without the performance decreasing. My game was able to draw successfully using the non-VBO method, but now that I've attempted to incorporate VBOs, nothing is drawing anymore. Please help me to identify what I am doing wrong and provide a correct example. I have a class called TexturedQuad which consists of the following: // TexturedQuad.h enum { ATTRIB_POSITION, ATTRIB

Android. How to move object in the direction it is facing (using Vector3 and Quaternion)

隐身守侯 提交于 2019-12-22 08:34:48
问题 I'm using libGDX (quite new to it in fact) and Android. And I want to move 3d object in the direction it is facing (using some speed). I thinks it's a basic question but can't find a straight nswer for it. I have a Quaternion representing object rotation(direction) and I have a Vector3 representing the object position. The question is how to update the position Vector3 using info from Quaternion in order to move object in the direction represented by Quaternion. (An alternative to this is

AlphaFunctions in WebGL?

时光总嘲笑我的痴心妄想 提交于 2019-12-22 08:29:29
问题 Is it possible to achieve an transparency effect where fragments with alpha lower than 0.5 are discarded and fragments with alpha higher than 0.5 are rendered rendered opaque? From what I've read, glEnable(GL_ALPHA_TEST); glAlphaFunc(GL_GREATER, 0.5); would be what I'm looking for but unfortunately, AlphaFunction is not defined in WebGL. Is there a workaround? My problem is, that transparent fragments write into the depth buffer and thus prevent farther fragments from beeing rendered: alpha

Why does GDB debugger constantly freeze Xcode 4?

有些话、适合烂在心里 提交于 2019-12-22 08:28:21
问题 This is a really weird bug... I'm working on an iPhone project using the camera feed and running it through an OpenGL shader to apply effects to it. However, every time I simply create a new GLfloat in the code, the debugger freezes when launched... I can't copy and paste the text because the whole of XCode freezes up, but I've cobbled it together from one of the log files: GNU gdb 6.3.50-20050815 (Apple version gdb-1518) (Sat Feb 12 02:56:02 UTC 2011) Copyright 2004 Free Software Foundation,

Do OpenGL Point Sprites work in Android?

邮差的信 提交于 2019-12-22 08:27:29
问题 I'm developing on a Droid, version 2.1-update1. My supported GL extensions include GL_OES_point_sprite and GL_OES_point_size_array. I am unable to get point sprites to render. The code below throws UnsupportedOperationException from GLWrapperBase at the glTexEnvi call. If I disable textures and comment out the glTexEnvi all, it throws the same exception further down, at glPointSizePointerOES(). Are point sprites properly supported in Android? Has anyone gotten them working? Or is there an

GLPaint with white background

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-22 08:22:53
问题 I'm trying draw on a white background by reverse engineering GLPaint. I've gone through every combination of kSaturation, kLuminosity and glBlendFunc, AND just about every combination I can think of for brush texture (black on white, white on black, white on trans, alias/no alias, etc), but haven't stumbled upon the desired effect. The best I've been able to achieve is with a white-on-trans circle, with glBlendFunc (GL_ SRC_ ALPHA, GL_ ONE_ MINUS_ SRC_ ALPHA), but this still gives me a dull

How to specify color per side of a cube in OpenGL ES application?

倖福魔咒の 提交于 2019-12-22 08:03:06
问题 I have a cube define in the code below. I want to specify color for each of the 6 faces like: front face: color1 back face: color2 left face: color3 right face: color4 top face: color5 bottom face: color6 Note that in OpenGL ES we only have triangles and not quads. I am looking for working sample code that solves my problem because working sample code is worth more than a thousand words like they say about pictures. Here is the cube: float vertices[] = { -width, -height, -depth, // 0 width,