opengl-es

OpenGL ES (IPhone) alpha blending looks weird

别说谁变了你拦得住时间么 提交于 2020-01-20 02:27:05
问题 I'm writing a game for IPhone in Opengl ES, and I'm experiencing a problem with alpha blending: I'm using glBlendFunc(Gl.GL_SRC_ALPHA, Gl.GL_ONE_MINUS_SRC_ALPHA) to achieve alpha blending and trying to compose a scene with several "layers" so I can move them separately instead of having a static image. I created a preview in photoshop and then tried to achieve the same result in the iphone, but a black halo is shown when I blend a texture with semi-transparent regions. I attached an image. In

What is the easiest way to draw line using OpenGL-ES (android)

独自空忆成欢 提交于 2020-01-19 06:47:15
问题 If I have custom renderer in opengl-es prepared: public void onDrawFrame(GL10 gl) { gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); // here i want to draw line from [0, 0, 0] to [1, 0, 0] } What is the easiest and shortest way to draw line? In ordinary OpenGL it is: glBegin(GL_LINES); glVertex3f(0, 0, 0); glVertex3f(1, 0, 0); glEnd(); But how can i get the same effect with OpenGL ES? 回答1: I am new to new to OpenGL ES 2.0 but I created a line class. public class Line { private

What is the easiest way to draw line using OpenGL-ES (android)

南笙酒味 提交于 2020-01-19 06:46:51
问题 If I have custom renderer in opengl-es prepared: public void onDrawFrame(GL10 gl) { gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); // here i want to draw line from [0, 0, 0] to [1, 0, 0] } What is the easiest and shortest way to draw line? In ordinary OpenGL it is: glBegin(GL_LINES); glVertex3f(0, 0, 0); glVertex3f(1, 0, 0); glEnd(); But how can i get the same effect with OpenGL ES? 回答1: I am new to new to OpenGL ES 2.0 but I created a line class. public class Line { private

What is the easiest way to draw line using OpenGL-ES (android)

六月ゝ 毕业季﹏ 提交于 2020-01-19 06:45:08
问题 If I have custom renderer in opengl-es prepared: public void onDrawFrame(GL10 gl) { gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); // here i want to draw line from [0, 0, 0] to [1, 0, 0] } What is the easiest and shortest way to draw line? In ordinary OpenGL it is: glBegin(GL_LINES); glVertex3f(0, 0, 0); glVertex3f(1, 0, 0); glEnd(); But how can i get the same effect with OpenGL ES? 回答1: I am new to new to OpenGL ES 2.0 but I created a line class. public class Line { private

Android OpenGL-ES gradient background

我的未来我决定 提交于 2020-01-17 12:46:32
问题 I would like to have a gradient background in OpenGL I found these two links, but I cannot reproduce it: OpenGL gradient fill on iPhone looks striped OpenGL gradient banding on Android I tried the following of the first link: // Begin Render //IntBuffer redBits = null, greenBits = null, blueBits = null; //gl.glGetIntegerv (GL10.GL_RED_BITS, redBits); // ==> 8 //gl.glGetIntegerv (GL10.GL_GREEN_BITS, greenBits); // ==> 8 //gl.glGetIntegerv (GL10.GL_BLUE_BITS, blueBits); // ==> 8 gl.glDisable

Android OpenGL-ES gradient background

不羁的心 提交于 2020-01-17 12:41:07
问题 I would like to have a gradient background in OpenGL I found these two links, but I cannot reproduce it: OpenGL gradient fill on iPhone looks striped OpenGL gradient banding on Android I tried the following of the first link: // Begin Render //IntBuffer redBits = null, greenBits = null, blueBits = null; //gl.glGetIntegerv (GL10.GL_RED_BITS, redBits); // ==> 8 //gl.glGetIntegerv (GL10.GL_GREEN_BITS, greenBits); // ==> 8 //gl.glGetIntegerv (GL10.GL_BLUE_BITS, blueBits); // ==> 8 gl.glDisable

OpenGL ES glFragColor depend on if condition on Fragment shader in iOS

本秂侑毒 提交于 2020-01-17 06:12:52
问题 I'm writing an app on iOS allows drawing free style (using finger) and drawing image on screen. I use OpenGL ES to implement. I have 2 functions, one is drawing free style, one is drawing texture --- Code drawing free style - (void)drawFreeStyle:(NSMutableArray *)pointArray { //Prepare vertex data ..... // Load data to the Vertex Buffer Object glBindBuffer(GL_ARRAY_BUFFER, vboId); glBufferData(GL_ARRAY_BUFFER, vertexCount*2*sizeof(GLfloat), vertexBuffer, GL_DYNAMIC_DRAW);

Issue when rendering a torus in webGL

青春壹個敷衍的年華 提交于 2020-01-17 04:57:31
问题 I'm writing a program that is supposed to draw 3D parametric shapes in webgl. The code I have currently seems to work (mostly) for a sphere, but when I switch out the equations used to find x, y, and z, for a torus, only the top half of the torus is being rendered (in the x-y plane). All of the parametric equations I have (for a sphere, a torus, and a cylinder) work when just the 2d canvas context is used without any webgl; however, when webgl is used, there seems to be a problem. In addition

What does in opengl exactly means 'gl_FragDepth = 0.0'?

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-16 17:18:08
问题 I'm saving the depth value via fragmend shader in the color buffer of the main framebuffer (in 'opengl es' there is no way to read the depth buffer via glReadPixels()). Additionally I need the maximum precision of 32-bit, that's why I use the rgba of the colorbuffer. But I realized that using also the alpha channel the results are not always correct, maybe because of some post fragmend operations. The following works: set fragColor.a = 1 (but then I'm loosing one channel) or set gl_FragDepth

Why is glTexImage2D returning GL_INVALID_OPERATION on iOS?

爷,独闯天下 提交于 2020-01-16 16:48:57
问题 I'm making the following call on iOS using OpenGL ES 3: glTexImage2D(GL_TEXTURE_2D, // target 0, // level GL_RGBA, // internalformat 1024, // width 692, // height 0, // border GL_RGBA, // format GL_UNSIGNED_BYTE, // type NULL); // data However, it is returning GL_INVALID_OPERATION . There are a slew of reasons that GL_INVALID_OPERATION might be returned. However, I can't spot any that are relevant to my situation. The weird thing is if I just ignore the error, things seem to work anyway.