opengl-es-2.0

Multi-pass shaders in OpenGL ES 2.0

大兔子大兔子 提交于 2019-12-06 04:45:33
问题 First - Does subroutines require GLSL 4.0+? So it unavailable in GLSL version of OpenGL ES 2.0? I quite understand what multi-pass shaders are. Well what is my picture: Draw group of something (e.g. sprites) to FBO using some shader. Think of FBO as big texture for big screen sized quad and use another shader, which, for example, turn texture colors to grayscale. Draw FBO textured quad to screen with grayscaled colors. Or is this called else? So multi-pass = use another shader output to

What's the “offset” parameter in GLES20.glVertexAttribPointer/glDrawElements, and where does ptr/indices come from?

江枫思渺然 提交于 2019-12-06 04:06:12
问题 I'm playing around with OpenGL ES 2.0 in Android, and looking through the docs for GLES20 I came across the following methods: public static void glDrawElements( int mode, int count, int type, Buffer indices) public static void glDrawElements( int mode, int count, int type, int offset) public static void glVertexAttribPointer( int indx, int size, int type, boolean normalized, int stride, Buffer ptr) public static void glVertexAttribPointer( int indx, int size, int type, boolean normalized,

How to get/set the width and height of the default framebuffer?

丶灬走出姿态 提交于 2019-12-06 04:04:33
问题 I want to know the dimension of my default frame buffer. I read setting view port to a particular value does not affect/set the dimensions of frame buffer. Are there any GL calls for this? 回答1: You can't set the size of the default framebuffer with OpenGL calls. It is the size of the window, which is controlled by the window system interface (e.g. EGL on Android). If you want to control it, this has to happen as part of the initial window/surface/context setup, where the details are platform

How do I support OpenGL ES GL10, GL11, and GL20 in Libgdx?

主宰稳场 提交于 2019-12-06 03:41:40
问题 I am writing a 3d game that is using GL10, but I'd like the application to support GL11 or GL20 if available. What is the best design for supporting all 3? Or is this a fool's errand and I should just focus on supporting one version? My current idea is to split my render() function into renderGL10, renderGL11, renderGL20 and call the appropriate render function based on the available GL instance. Inside each render function is the proper way to render for the GL version; there will likely be

Hud with shaders (opengl-es 2.0)

邮差的信 提交于 2019-12-06 03:18:09
How to draw a HUD using shaders on opengl es 2.0? I have a shader which draws a textured quad on screen, it uses MVP matrix. The quad has it own vertices which are independent of view position and so on (cause of MVP matrix) Matrix.frustumM(mProjMatrix, 0, -ratio, ratio, -1, 1, 3f, 17); Matrix.setLookAtM(mVMatrix, 0, 0, 0, -5, 0f, 0f, 0f, 0f, 1.0f, 0.0f); I'd like to show the same quad on the top right corner (like a button or something else, HUD). As I understand, i need create an ortho matrix instead of "frustumM", but what should i do later? How vertex shader should use vertices of quad? Ok

Is this a practical and enough performant shader for doing blur on mobile device

◇◆丶佛笑我妖孽 提交于 2019-12-06 03:15:16
I am trying to implement Blur effect in my game on mobile devices using GLSL shader. I don't have any former experience with writing shaders. And I don't understand if my shader is enough good. Actually I have copyied the GLSL code from a tutorial and I don't know it this tutorial is for vivid demo or also can be used in practice. Here is the code of two pass blur shader that uses Gaussian weights ( http://www.cocos2d-x.org/wiki/User_Tutorial-RenderTexture_Plus_Blur ): #ifdef GL_ES precision mediump float; #endif varying vec4 v_fragmentColor; varying vec2 v_texCoord; uniform vec2 pixelSize;

2D Texture gets distorted when making a sub-pixel translation

我与影子孤独终老i 提交于 2019-12-06 02:28:57
I would like to know a theoretical reasoning why is this even possible: how translation of the geometry is related to the texture mapping. I can only notice this effect when making a sub-pixel translation, texture looks fine if translated by entire pixel(s). I am using orthographic projection, GL_CLAMP_TO_EDGE , GL_NEAREST , fragment shader is highp . Texture coordinates is a subregion of the atlas, but I can see the distortion even if the entire atlas is mapped. Using OpenGL ES (Android and iOS), but please before retagging could anyone explain that this is not an issue in OpenGL. Things I've

Most Efficient way of Multi-Texturing - iOS, OpenGL ES2, optimization

喜你入骨 提交于 2019-12-06 01:53:51
问题 I'm trying to find the most efficient way of handling multi-texturing in OpenGL ES2 on iOS. By 'efficient' I mean the fastest rendering even on older iOS devices (iPhone 4 and up) - but also balancing convenience. I've considered (and tried) several different methods. But have run into a couple of problems and questions. Method 1 - My base and normal values are rgb with NO ALPHA. For these objects I don't need transparency. My emission and specular information are each only one channel. To

How can Opengl Es be use for gpgpu implementation

可紊 提交于 2019-12-06 01:51:15
问题 I want to use Opengl Es for gpgpu implementation of an image processing code. I want to know can I use Opengl Es for this purpose. If I can than which version of Opengl Es will be more appropriate for this purpose (Opengl Es 1.1 or 2.0). 回答1: OpenGL ES is a graphics technology for embedded systems, and therefor not quite as powerful as it's bigger brother. OpenGL ES was not designed with doing gpgpu processing in mind, but some algorithms, especially those that work on images and require per

GL_APPLE_shader_framebuffer_fetch gl_lastFragData

旧街凉风 提交于 2019-12-06 01:49:37
问题 Apple introduced a new shader extension called GL_APPLE_shader_framebuffer_fetch, which allows fully programmable blending. There is also a wwdc video explaining the functionallity. It's the video 513 of wwdc 2012. Sadly this extension doesn’t work for me. F-Shader: #extension GL_APPLE_shader_framebuffer_fetch : require varying lowp vec4 colorVarying; void main(void) { gl_FragColor = gl_lastFragData[0] + vec4(colorVarying.x, colorVarying.y, colorVarying.z, 1.0); } Debug output: extension ‘GL