opengl-es-2.0

Draw a straight line using OpenGL ES in iPhone?

99封情书 提交于 2019-12-03 14:11:11
问题 Finally i tried to draw a line using OpenGL ES framework in XCode 4.2 for iPhone simple game app.I studied something about GLKView and GLKViewController to draw a line in iPhone. Here is my sample code that was i tried in my project, @synthesize context = _context; @synthesize effect = _effect; - (void)viewDidLoad { [super viewDidLoad]; self.context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; if (!self.context) { NSLog(@"Failed to create ES context"); } GLKView *view =

How to get an EGL display/context to a specific GLSurfaceView

独自空忆成欢 提交于 2019-12-03 13:56:58
问题 This is a follow up to my original Question, which was probably too broad (whereas this one is probably too specific but maybe I can apply Newton's Method). My specific situation is: OpenGL ES 2.0, on Android, using only Java (no JNI/Native code). I am trying to understand how EGL and Android's GLES implimentation work together (or don't). I am having trouble because the EGL interface(API) does not seem well suited to Android's Java centric, Activity based OS. As a specific example: I have

Floating point textures in OpenGL ES 2.0 on iOS without clamping them to [0, 1]

心不动则不痛 提交于 2019-12-03 13:53:18
I need gl_FragColor to "paint" floating point values, which also can be negative (x < 0) and > 1.0. I then want to use the color attachement of the FBO this values where rendered to and use it as a texture in another FBO. Now I have read on http://www.khronos.org/opengles/sdk/docs/man/ (under glTexImage2D) that all values are clamped to a range of [0, 1] and also I didn't find a glClampColor instruction. Is there a possibility to find a workaround here or does somebody have an idea which could help me with my problem? :) SOLVED It is possible and the values are not clamped to [0, 1] at all,

OpenGL ES 2.0 Equivalent for ES 1.0 Circles Using GL_POINT_SMOOTH?

心不动则不痛 提交于 2019-12-03 13:34:03
问题 OpenGL ES 2.0 doesn't have the GL_POINT_SMOOTH definition which ES 1.0 does. This means code I was using to draw circles no longer works: glEnable(GL_POINT_SMOOTH); glPointSize(radius*2); glDrawArrays(GL_POINTS,0,nPoints); Is there an equivalent in ES 2.0, perhaps something to go in the vertex shader, or must I use polygons for each circle? 回答1: You can use point sprites to emulate this. Just enable point sprites and you get a special variable gl_PointCoord that you can read in the fragment

GPU Profiling and callbacks in OpenGL ES

☆樱花仙子☆ 提交于 2019-12-03 13:29:18
问题 Is there a way to add callbacks in OpenGL ES similar to what DirectX has? I'm trying to profile the GPU performance, so I'm trying to figure out how long it took to execute certain parts of the GPU. Ideally, I "push" a marker/callback, then call a bunch of GL draw calls, then push another marker, and then find out how many milliseconds passed inbetween those two markers a frame later. (Any other ways to profile GPU performance would be helpful too.) 回答1: GPU maker provides nice profiler for

OpenGL-ES 2.0 VS OpenGL-ES 1.1, which is faster?

送分小仙女□ 提交于 2019-12-03 12:56:21
I've written an app using OpenGL-ES 1.1, but am wondering if there are speed gains to be found by switching to 2.0. Has anyone done any tests with large polygon count models? I only want to render triangles that have different colors, nothing fancy. However, I am wanting to render about 1 million triangles for my comparison test. OpenGL ES 1.1 and 2.0 provide two very different ways of doing 3-D graphics, so I don't know that direct performance comparisons make much sense. You're probably going to see identical performance using both if you create 2.0 shaders that just simulate OpenGL ES 1.1's

Android OpenGL ES Support Everywhere?

耗尽温柔 提交于 2019-12-03 12:54:09
I need to get an idea of how many potential installs I'll be loosing if I choose to do my drawing in OpenGL instead of android's native 2D graphics APIs in android.graphics.* The android documentation seems to imply that the OpenGL ES API is supported basically on all phones: http://developer.android.com/guide/topics/graphics/opengl.html OpenGL ES 2.0 is supported by most Android devices Now, does that imply that even cheap commodity devices will have OpenGL ES 2.0 support? Will the cheaper phones perhaps have software rendering, or will it always be hardware rendering? I take it that the

Low performance when execute eglSwapBuffer and eglMakeCurrent

余生颓废 提交于 2019-12-03 12:44:53
问题 I'm developing an Android Unity Plugin that allows user to record his/her gameplay Overview of my solution: Using OpenGl FrameBufferObject (FBO) to make Unity render offscreen to this FBO Get the offscreen texture of this FBO then using for 2 purposes: Render to video surface Redraw to device screen Execute flow per frame: bind my FBO render scene to FBO (Unity code) unbind my FBO set up video surface configure surface size (execute first time only) save egl state make video surface current

GLSL reusable/shared functions, shared constants (OpenGL ES 2.0)?

拥有回忆 提交于 2019-12-03 12:03:52
Short: Can I define a function that every shader can use? Or I have to define it per shader? The whole story: I want to create numerous shaders intended to colorize the input fragments with predefined gradient ramps (something like this - http://www.thinkboxsoftware.com/storage/krakatoa-support-images/krakatoa15_kcm_densitybyage_gradientrampmap.png ). I want to define a gradient ramp constant for each shader (an array of vec4 color samples, where the alpha value holds the gradient position, see Pos in the picture above) And I need a function that can return a color sample from the given

OpenGL ES 2.0 vs OpenGL 3 - Similarities and Differences

天涯浪子 提交于 2019-12-03 12:00:52
问题 From what I've read, it appears that OpenGL ES 2.0 isn't anything like OpenGL 2.1, which is what I assumed from before. What I'm curious to know is whether or not OpenGL 3 is comparable to OpenGL ES 2.0. In other words, given that I'm about to make a game engine for both desktop and Android, are there any differences I should be aware of in particular regarding OpenGL 3.x+ and OpenGL ES 2.0? This can also include OpenGL 4.x versions as well. For example, if I start reading this book, am I