opengl-es

OpenGL ES deprecated in iOS 12 and SKShader

落爺英雄遲暮 提交于 2020-01-24 08:52:09
问题 I am very new to the concept and use of shaders in SpriteKit. I found this tutorial on how to render a Mandelbrot fractal with a custom shader file - Fractal.fsh - attached to a Color Sprite's Custom Shader property. https://www.weheartswift.com/fractals-Xcode-6/ It works fine and I thought to my self that learning about OpenGL ES and custom shaders in SpriteKit would be a fun exercise. According to Apple though, OpenGL ES is deprecated as of iOS 12. https://developer.apple.com/library

OpenGL ES 1.1 reporting 0x0500 error

只愿长相守 提交于 2020-01-24 07:28:45
问题 A simple question, does the error code 0x0500 mean anything besides there was an error? 回答1: It means "GL_INVALID_ENUM" -- somewhere you passed an invalid GLenum. This is defined in the gl.h header file. Indeed--it's not very helpful. EDIT: My strategy in dealing with these errors it to surround OpenGL calls with a macro that asserts everything is ok (glGetError() GL_NO_ERROR). These get compiled out for performance tests. 来源: https://stackoverflow.com/questions/3704828/opengl-es-1-1

GLKViewControllerDelegate getting blocked

放肆的年华 提交于 2020-01-24 02:53:07
问题 I have a GLKViewController to handle some OpenGL drawing. I have the glkView:drawInRect and update method both implemented and have the preferredFramesPerSecond property set to 30 (the default). The problem is that the delegate methods stop firing when the user interacts with other part of the app. The two cases that I have seen this happen on is when the user scrolls a UITableView or interacts with a MKMapView. Is there a way to make sure these delegates always fire, regardless of what the

iPhone - OpenGL ES 1.1 - Alpha Blend make texture wrong color

本小妞迷上赌 提交于 2020-01-23 16:48:08
问题 I'm newbie in OpenGL ES 1.1 for iPhone. Today, I tried to draw png texture on black background (the texture includes the alpha chanel) but the result is diference from source png file. The Result on iPhone & Simulator: Turn the light off: It's should be (Brighter & more blur): Source Texture file: This is the source code I use: //Setup: glEnable(GL_ALPHA_TEST); glEnable(GL_BLEND); glAlphaFunc(GL_GREATER,0.01); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_LIGHTING); glEnable

iPhone - OpenGL ES 1.1 - Alpha Blend make texture wrong color

China☆狼群 提交于 2020-01-23 16:46:20
问题 I'm newbie in OpenGL ES 1.1 for iPhone. Today, I tried to draw png texture on black background (the texture includes the alpha chanel) but the result is diference from source png file. The Result on iPhone & Simulator: Turn the light off: It's should be (Brighter & more blur): Source Texture file: This is the source code I use: //Setup: glEnable(GL_ALPHA_TEST); glEnable(GL_BLEND); glAlphaFunc(GL_GREATER,0.01); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_LIGHTING); glEnable

iPhone - OpenGL ES 1.1 - Alpha Blend make texture wrong color

痴心易碎 提交于 2020-01-23 16:46:06
问题 I'm newbie in OpenGL ES 1.1 for iPhone. Today, I tried to draw png texture on black background (the texture includes the alpha chanel) but the result is diference from source png file. The Result on iPhone & Simulator: Turn the light off: It's should be (Brighter & more blur): Source Texture file: This is the source code I use: //Setup: glEnable(GL_ALPHA_TEST); glEnable(GL_BLEND); glAlphaFunc(GL_GREATER,0.01); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_LIGHTING); glEnable

Sprite quads & depth testing correctly in OpenGL ES 2

孤者浪人 提交于 2020-01-23 11:08:09
问题 I am trying to render 2D (flat) sprites in a 3D environment using OpenGL ES 2. The way I create each sprite is pretty standard: I create a quad consisting of two triangles, and I map the texture onto that. Everything works fine, except I noticed something strange: when depth testing is turned on (which it should be in 3D mode), the corners of my sprites are painted using the background color. The easiest way to show this is by illustration: When I turn off depth testing (on the left) it looks

Render camera preview on a Texture with target GL_TEXTURE_2D

梦想的初衷 提交于 2020-01-23 08:04:50
问题 I'm trying to render the camera preview on an OpenGL Texture with target GL_TEXTURE_2D . I'm very well aware of SurfaceTexture but I cannot use it because it only works with GL_TEXTURE_EXTERNAL_OES . In the documentation of SurfaceTexture, it's written : Each time the texture is bound it must be bound to the GL_TEXTURE_EXTERNAL_OES target rather than the GL_TEXTURE_2D target I cannot use GL_TEXTURE_EXTERNAL_OES because, I'll have to make a lot of changes in my existing code. Is there a way to

White edges appearing at edge of cube

痞子三分冷 提交于 2020-01-23 03:55:06
问题 When I render a cube and texture it I end up with white edges along the cube. I've checked the vertex and texture coordinates and they look fine to me. My texture is a power of 2. It is a texture map containing 4x4 textures in which each texture is 16x16 pixels. Does anyone have any suggestions? 回答1: I guess you are experiencing texture bleeding. You can solve it by either using GL_CLAMP on your textures or adjusting slightly your UV coordinates to 0.0005 and 0.0095 (for instance) instead of

Classes store data members in sequential memory?

断了今生、忘了曾经 提交于 2020-01-21 12:19:18
问题 The short version of this question: Does a pointer to the first data member of a class result in a pointer to all its data members? Discussion: I'm reading some sample code, and this is interesting. When a particular function (in this case the glUniformMatrix4fv C function from OpenGL) takes as a parameter an array, this is passed in the common C way of using a pointer to the address of the array's first element, as follows: glUniformMatrix4fv(glvariable, 1, 0, &newmatrix[0]); // referring to