opengl-es-2.0

How to draw anti aliased lines in OpenGL ES 2.0?

丶灬走出姿态 提交于 2019-12-03 10:58:38
问题 I am trying to draw some contours that I have stored as vertex arrays: typedef struct { float* vertices; int nrPoints; }VertexCurve; list<VertexCurve> CurveList; I am using some samples from an opengl es 2.0 book : http://opengles-book.com/ The drawing method looks like this: void Draw ( ESContext *esContext ) { UserData *userData = (UserData*)esContext->userData; // Set the viewport glViewport ( 0, 0, esContext->width, esContext->height ); // Clear the color buffer glClear ( GL_COLOR_BUFFER

Sphere in OpenGL es 2.0 iOS [duplicate]

╄→尐↘猪︶ㄣ 提交于 2019-12-03 10:13:31
This question already has an answer here : Drawing a sphere in OpenGL ES (1 answer) Possible Duplicate: Drawing a sphere in OpenGL ES I have been browsing around for quite some time now, and have yet to find an adequate answer. I started learning Opengl es 2.0 (Because I need to for a project in university) and have recently accomplished drawing a circle. WOOPIE! I have looked at a great deal of similar questions, but it is either outdated or I too complex for me to grasp. Can anyone point me in the proper direction of how to draw a solid sphere with opengl ES 2.0 on iOS? I'm not sure how far

GLKView set drawable properties

人盡茶涼 提交于 2019-12-03 09:25:50
I'm trying to port Apples GLPaint example to use GLKit. Using a UIView, its possible to return the CAEAGLLayer of the view and set the drawableProperties to include kEAGLDrawablePropertyRetainedBacking. This has the effect of retaining the drawable contents after presenting the render buffer, as expected. Removing this property results in flickering after the draw call with part of the drawable content seemingly being drawn to different buffers. The problem is this is exactly the issue I am now having in my GLKView, but there doesn't seem to be a way to set the drawable properties. Returning a

iOS based OpenGL ES programming

拟墨画扇 提交于 2019-12-03 09:02:43
I need to find resources for learning openGL ES for the iPhone. I've already watched Brad Larson's awesome videos and I'm downloading the advanced videos from apple now. I know a lot about iOS programming but am clueless on OpenGL, so resources that don't assume I already know openGL. I want to learn a majority of the OpenGL capabilities, but my major goal is to be able to manipulate an image based on the touch locations. More specifically I want to create a water ripple effect that follows the users finger. I know there are many equations on StackFlow that implement this, but I'm lost when it

eglCreateWindowSurface fails with java.lang.IllegalArgumentException

匆匆过客 提交于 2019-12-03 08:30:24
When trying to press the back button quickly during launching some Activities with GLSurfaceView , eglCreateWindowSurface fails with java.lang.IllegalArgumentException . I got the following errors: 10-08 18:05:36.490: E/GLSurfaceView(3440): eglCreateWindowSurface 10-08 18:05:36.490: E/GLSurfaceView(3440): java.lang.IllegalArgumentException: Make sure the SurfaceView or associated SurfaceHolder has a valid Surface 10-08 18:05:36.490: E/GLSurfaceView(3440): at com.google.android.gles_jni.EGLImpl._eglCreateWindowSurface(Native Method) 10-08 18:05:36.490: E/GLSurfaceView(3440): at com.google

opengl overlay on camera view

…衆ロ難τιáo~ 提交于 2019-12-03 08:10:14
I still haven't found a proper way to show an opengl overlay oon top of camera preview, There's a hack, where you call setContentView(GLSurfaceView) addContentView(MyCameraSurfaceView) but it doesn't work properly - i.e. when you switch to anouther activity and go back, the opengl layer isnt displayed over camera preview. there are a lot of tutorials and samples which use the above method, but it simply doesn't work as expected does anyone know how they do it in layar It looks like I've found the solution to my problem - its setZOrderMediaOverlay function, heres my code: private void initViews

OpenGL ES 2.0 fragment shader to blur is slow and low quality

不羁岁月 提交于 2019-12-03 07:52:40
问题 I am trying to write a blur shader for the iPad. I have it working but I am not very happy with the results. I get very choppy frame rates and the blur looks like crap when blur amount is high. Any ideas on how to improve things? Some sample output: uniform sampler2D texture; varying mediump vec2 fragTexCoord; varying mediump vec3 eyespaceNormal; varying highp float blurAmount; void main(void) { highp vec2 gaussFilter[7]; gaussFilter[0] = vec2(-3.0, 0.015625); gaussFilter[1] = vec2(-2.0, 0

OpenGL ES 2.0 : Seeking VBO Performance/Optimisation Tips For Many Moving Vertices

杀马特。学长 韩版系。学妹 提交于 2019-12-03 07:24:06
In my ongoing attempt to convert to OpenGL ES 2.0 from ES 1.x I'm currently converting some code to use Vertex Buffer Objects ('VBOs') rather than the existing unbuffered glDrawArrays calls. I've set up the VBOs and got them working, but have hit a design dilemma and would be grateful the advice of someone more experienced with OpenGL ES 2.0. I want to draw a bunch of polygonal sprites which move often. This is because they're dynamic Box2D bodies, if you're familiar with Box2D. These polygon bodies are each generated by use of GL_TRIANGLE_FAN, which is somewhat critical since GL_POLYGON is

How to create multiple stop gradient fragment shader?

◇◆丶佛笑我妖孽 提交于 2019-12-03 07:19:42
I'm trying to create an OpenGL ES 2.0 fragment shader that outputs multiple stop gradient along one axis. It should interpolate between multiple colors at points defined in percents. I've achieved this by using if s the fragment shader, like this: float y = gl_FragCoord.y; float step1 = resolution.y * 0.20; float step2 = resolution.y * 0.50; if (y < step1) { color = white; } else if (y < step2) { float x = smoothstep(step1, step2, y); color = mix(white, red, x); } else { float x = smoothstep(step2, resolution.y, y); color = mix(red, green, x); } They say that branching in fragment shader can

Errors showing for OES OpenGL statements in Xcode 6 for iOS8

守給你的承諾、 提交于 2019-12-03 06:50:58
问题 Xcode 6 iOS SDK 8.0 in Yosemite is giving me errors for OpenGL ES2 code which compiles fine under Xcode 5 GLuint depthStencilRenderbuffer; glBindRenderbufferOES(GL_RENDERBUFFER_OES, depthStencilRenderbuffer); glRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_DEPTH24_STENCIL8_OES, self.view.bounds.size.width, self.view.bounds.size.height); Generates errors: line 2: Conflicting types for 'glBindRenderBufferOES' Use of undeclared identifier 'GL_RENDERBUFFER_OES' line 3: implicit declaration of