opengl-es

What Clever Solutions are There for Including Resources in a Static Lib?

二次信任 提交于 2019-12-06 15:49:47
I have a static library Xcode 4 project that includes a home-brewed rendering engine, and I re-use this engine in multiple apps. This engine uses OpenGL ES 2.0, and by extension, shaders. As shaders got more complicated, I moved away from storing them as NSStrings in a source file, and now store them as standalone text files with the .vert and .frag extensions. This works fine for apps that include the rendering engine in their own source; the shaders are simply added to the app's "Copy Bundle Resources" build phase, and loaded at runtime into NSStrings and compiled, linked, etc. This strategy

glPushMatrix and OpenGL ES

时光总嘲笑我的痴心妄想 提交于 2019-12-06 15:49:30
问题 I have a question regarding [glPushMatrix], together with the matrix transformations, and OpenGL ES. The GLSL guide says that under OpenGL ES, the matrices have to be computed: However, when developing applications in modern versions of OpenGL and OpenGL ES or in WebGL, the model matrix has to be computed. and In some versions of OpenGL (ES), a built-in uniform variable gl_ModelViewMatrix is available in the vertex shader As I understood, gl_ModelViewMatrix is not available under all OpenGL

iPhone post-processing with a single FBO with Opengl ES 2.0?

a 夏天 提交于 2019-12-06 15:35:57
问题 I am trying to implement post-processing (blur, bloom, etc.) on the iPhone using OpenGL ES 2.0. I am running into some issues. When rendering during my second rendering step, I end up drawing a completely black quad to the screen instead of the scene (it appears that the texture data is missing) so I am wondering if the cause is using a single FBO. Is it incorrect to use a single FBO in the following fashion? For the first pass (regular scene rendering), I attach a texture as COLOR_ATTACHMENT

glError 0x0501 when loading a large texture with OpenGL ES on the iPhone4

大憨熊 提交于 2019-12-06 15:35:24
I got this error when I try to load a PVR image on device. It works in iPhone 5s, 5, 4s and iPad well, but in 4 it doesn't work. My PVR image size is: width = 4096 and height = 2048 . Cocos2d: cocos2d: TexturePVR: Error uploading compressed texture level: 0 . glError: 0x0501 Cocos2d: cocos2d: Couldn't load PVR image /var/mobile/Applications/7CF6C347-8B63-4C1E-857A-41F48C8ACBEF/Race.app/Images/BackGround/bg1.pvr.ccz Cocos2d: cocos2d: Couldn't add PVRImage:Images/BackGround/bg1.pvr.ccz in CCTextureCache I got this form this link : Supported sizes are: iPhone 3gs / iPhone 4 / iPad 1 / iPod 3 / 4

Opengl Augmented Reality in Android from solvepnp

安稳与你 提交于 2019-12-06 15:32:05
I am trying to project a 3D surface in opengl on top of a camera view in Android. I am using opencv function solvepnp in native code to get the rotation and translation vectors of the device camera. I use these vectors to calculate the modelView matrix and modelViewProjection matrix as given in the following link: http://spottrlabs.blogspot.com/2012/07/opencv-and-opengl-not-always-friends.html Finally, I pass these matrices to the java code in a float array but when I use these matrices in my renderer I don't get the surface projection on the screen. I am sure that my 3D surface is generated

Android OpenGL rendering bug without glClear?

冷暖自知 提交于 2019-12-06 15:29:00
问题 I'm developing a drawing application where the user can select a range of brushes and paint on the screen. I'm using textures as brushes and I'm drawing vertexes as points with PointSpriteOES enabled as displayed below. gl.glEnable(GL10.GL_TEXTURE_2D); gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glEnable(GL11.GL_POINT_SPRITE_OES); gl.glTexEnvf(GL11.GL_POINT_SPRITE_OES, GL11.GL_COORD_REPLACE_OES, GL10.GL_TRUE); The application worked just as desired, but I needed to optimize it for

How do I build a command line tool that links against the iPhone Simulator SDK?

笑着哭i 提交于 2019-12-06 15:28:44
Why the hell would I want to do that? The OpenGL Shader Builder is a great development tool, but it compiles shaders using desktop OpenGL, which allows some things that ES does not. I figure if I can create a tool that links against the OpenGLES.framework in the iPhone Simulator SDK, I can get some error reporting without having to build/install/run my application. By inspecting the command lines appearing in the Xcode build window, I got as far as this (in Makefile format, for clarity. Seriously!): ARCH=i386 PLATFORM=/Developer/Platforms/iPhoneSimulator.platform/Developer GCC=$(PLATFORM)/usr

Updating OpenGL ES Touch Detection (Ray Tracing) for iPad Retina?

北城余情 提交于 2019-12-06 15:12:20
问题 I have the below code which I am using for ray tracing. The code works successfully on non-retina iPads, however does not function on the retina iPads. The touch is detected, however the converted point is off to the left and below where it should be. Can anyone suggest how I can update the below to accommodate the retina screen ? - (void)handleTap: (UITapGestureRecognizer *)recognizer { CGPoint tapLoc = [recognizer locationInView:self.view]; bool testResult; GLint viewport[4]; glGetIntegerv

Loading 3D objects and textures for OpenGL ES rendering

半腔热情 提交于 2019-12-06 15:11:07
I have some 3D objects stored in 3D editor application specific (Blender/Solid/3DS) file format exported to OBJ+MTL files with optional textures in PNG/JPG files. I would like to load these objects in OpenGL ES application on mobile phone (today for Android and in the near future for iOS too). And I don't want to write my own OBJ+MTL (or any other 3D format) parser. So I would like to use some 3D engine with support for loading 3D models (from OBJ+MTL or exported to 3D engine specific header/resource files from within my 3D editor) to achieve this. I have some experience with Min3D framework,

Creating a bitmap of a drawn square in android opengl es 2.0

旧时模样 提交于 2019-12-06 15:04:19
问题 I have drawn a square using opengl es 2.0 and now i want to create a bitmap of that drawn square. Can anyone please guide me on how to do that? Please let me know if my question is not clear. Thanks 回答1: It is done using glReadPixels(). This is slow, but is the only method available with OpenGL ES 2.0 on Android. In Java: Bitmap buttonBitmap = Bitmap.createBitmap(mWidth, mHeight, Bitmap.Config.ARGB_8888); ByteBuffer byteBuffer = ByteBuffer.allocateDirect(mWidth * mHeight * 4); GLES20