opengl-es

How can I modify the shader in the iPhone OpenGL ES template to produce this effect?

大兔子大兔子 提交于 2019-12-12 20:04:44
问题 I'm trying to modify the fragment shader which is part of the standard iPhone/XCode OpenGL ES template. I want to make it so that every other row of pixels is transparent. I have this code so far: varying lowp vec4 colorVarying; void main() { gl_FragColor = vec4(colorVarying.x, colorVarying.y, colorVarying.z, floor(mod(gl_FragCoord.y, 2.0))); } But when I compile and run I still get the same square moving up and down with no other effects. Here is my vertex shader (my keyboard just broke so

glFramebufferTexture2D fails on iPhone for certain texture sizes

时光总嘲笑我的痴心妄想 提交于 2019-12-12 19:16:27
问题 When I try to attach a texture to a framebuffer, glCheckFramebufferStatus reports GL_FRAMEBUFFER_UNSUPPORTED for certain texture sizes. I've tested on both a 2nd and 4th generation iPod Touch. The sizes of texture that fail are not identical between the two models. Here are some interesting results: 2nd generation - 8x8 failed, 16x8 failed, but 8x16 succeeded! 4th generation - 8x8 succeeded, 8x16 succeeded, but 16x8 failed! Here's some code I used to test attaching textures of different sizes

How do you use an fbx file in OpenGL on iOS?

試著忘記壹切 提交于 2019-12-12 19:13:47
问题 Is there a library that is commonly used? If all else fails, I'll just write something myself for importing the files, they don't seem too complicated, but I was wondering if there was an easier way, like an open source project or something. 回答1: Just use the FBX SDK provided by Autodesk. It supports iOS since a few releases now. 来源: https://stackoverflow.com/questions/11578305/how-do-you-use-an-fbx-file-in-opengl-on-ios

gluUnProject always returns zero

久未见 提交于 2019-12-12 19:09:17
问题 I need gluUnProject to convert screen coordinates to world coordinates and right now I just about have it working. When my app runs it accurately tells me the coordinates on screen which I know are stored in my renderer thread and then pumps out screen coordinates. Unfortunately the screen coordinates seem to have no effect of world coordinates and the world coordinates remain at zero. Here is my gluUnProject method public void vector3 (GL11 gl){ int[] viewport = new int[4]; float[] modelview

glFenceSync alternative in OpenGL ES 2.0

懵懂的女人 提交于 2019-12-12 18:54:07
问题 I see that glFenceSync does not exist in OpenGL ES 2.0, it was added only in OpenGL ES 3.0. Does OpenGL ES 2.0 offer any alternative of syncing between CPU and GPU, aside from the brutal force glFinish ? 回答1: In glext.h . GL_API GLsync glFenceSyncAPPLE(GLenum condition, GLbitfield flags) __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_6_0); I am pretty sure this is what you want. Anyway available only on iOS 6.0 or later. 回答2: You have different calls in OpenGL ES 2.0 that give some insight into

iPhone OpenGL - How to gradient fade out a texture?

白昼怎懂夜的黑 提交于 2019-12-12 18:45:01
问题 I want to customize the reflection from the FlowCover (Cover Flow remake) sample code. Now, the reflection (a texture) is only transparent but I want it to have a gradient so that the texture fades to be completely transparent. How would you achieve this effect with OpenGL? This is the code that handles the textures. glPushMatrix(); glBindTexture(GL_TEXTURE_2D,fcr.texture); glTranslatef(trans, 0, 0); glScalef(sc,sc,1.0); glMultMatrixf(m); glDrawArrays(GL_TRIANGLE_STRIP,0,4); // reflect

Android Game Leaking memory because of GLThread reference

倖福魔咒の 提交于 2019-12-12 17:22:19
问题 Right now I'm developing a game in Android (OpenGL ES 1.1) and I'm seeing that whenever I create a new SurfaceView (GLView) its thread is created. That's ok. The problem comes when I want to finish the Activity that holds the SurfaceView (and go back to the menu). It seems that the activities are not released because each GLThread is referencing it. This may finish with an OOM error. Some MAT pictures: The first picture: the MarkitActivity represents each single instance of the Activity that

How to use jPCT with Vuforia SDK?

冷暖自知 提交于 2019-12-12 16:23:42
问题 Can someone give an overview of mixing Jpct and Qualcomm Vuforia SDK? Is it a good idea to use Java rendering engine with Vuforia? 回答1: Basically, the whole roll of QCAR is to compute the transformation matrix of a deformed predefined target image. It gives you two important 4x4 matrices which you can use with OpenGL to superimpose your graphics. ModelView matrix Projection matrix if you are familiar with OpenGL, these two are enough for rendering purpose. But if you want to use a rendering

Problems displaying full-screen CAEAGLLayer on Retina iPad

不羁岁月 提交于 2019-12-12 16:10:25
问题 I've run into some problems getting a UIView with a large CAEAGLLayer to display properly. If the frame is above a certain size (apparently 768 in either dimension with a contentScaleFactor of 2.0), it redraws with a distorted image of previous versions of the buffer. It's pretty easy to reproduce in Apple's GLPaint example. PaintingView.m has a hardcoded contentScaleFactor of 1.0, but if you change it to 2.0: self.contentScaleFactor = 2.0; and run it on a Retina iPad (not the simulator), you

What are the valid types for a WebGL vertex shader attribute?

柔情痞子 提交于 2019-12-12 15:56:27
问题 The following attribute seems fine: attribute vec4 coord; The following attribute complains that an attribute "cannot be bool or int": attribute int ty; The following attribute complains of a "syntax error": attribute uint ty; These results seem quite arbitrary. I can't find a list of the valid types for vertex shader attributes. What are the rules for whether an attribute type is valid in WebGL? 回答1: OpenGL ES Shading Language 1.00 specification, page 36, section 4.3.3: "Attribute": The