opengl-es-2.0

Activating/using GL_TEXTURE1 at OpenGL ES 2.0 for Android

好久不见. 提交于 2019-12-02 15:59:07
问题 I'm trying to use the GL_TEXTURE1 texture unit to draw a simple shape. I know how to draw it using the standard GL_TEXTURE0, but when changing it something is not working. I thought that from my code below, I just had to change the following: glActiveTexture(GL_TEXTURE1); glUniform1i(uTextureLocation, 1); What I'm missing? Code: public class RendererClass implements Renderer { Context context; FloatBuffer verticesInBuffer; int aPositionLocation; int aTextureLocation; int uTextureLocation; int

Simple GLSL convolution shader is atrociously slow

孤人 提交于 2019-12-02 15:56:15
I'm trying to implement a 2D outline shader in OpenGL ES2.0 for iOS. It is insanely slow. As in 5fps slow. I've tracked it down to the texture2D() calls. However, without those any convolution shader is undoable. I've tried using lowp instead of mediump, but with that everything is just black, although it does give another 5fps, but it's still unusable. Here is my fragment shader. varying mediump vec4 colorVarying; varying mediump vec2 texCoord; uniform bool enableTexture; uniform sampler2D texture; uniform mediump float k; void main() { const mediump float step_w = 3.0/128.0; const mediump

OpenGL ES 2.0 Multiple Programs or Multiple Shaders or what? How does it work?

扶醉桌前 提交于 2019-12-02 15:04:41
The Problem (TL;DR) My problem, fundamentally, is that I do not know how OpenGL ES 2.0 expects me to write and use multiple shaders; or if it is even advisable/expected that a person will do so. The fundamental question here is: if I have an apple, a glowing rock and a fuzzy mesh, all in the same 3D world, all best drawn with different shader programs but using the same mvpMatrix then how would I go about using all of them in the same OpenGL render such that they all use their most appropriate shaders that I have written? What Have I done So I have written a basic OpenGL ES 2.0 program for my

Many objects with different textures in OpenGL ES 2.0

此生再无相见时 提交于 2019-12-02 14:31:05
问题 I'm new to OpenGL ES 2.0 with it's programmable pipeline and I'm porting application that renders many objects all with different textures. So this will require calling glDrawArrays for each object and changing textures between calls? Or there's another way to draw multiple objects with different textures with single glDrawArrays call? I'm asking because I noticed that doing many calls to glDrawArrays is MUCH slower when tried to use them instead of glBegin/glEnd with 'desktop' OpenGL. I'm

GLSurfaceView not appearing over MapView

你离开我真会死。 提交于 2019-12-02 12:12:47
问题 My goal is to use OpenGL ES 2.0 with Google Maps. I would like to create an app that follows the user as they are traveling from point A to point B. I realize that this can be done using Google Maps addPolyline to draw a line, but I want to use OpenGL instead in order to show overlap of paths. I'm currently receiving an error which is due to incorrectly setting up the GLSurfaceView. My code in the GoogleMapsTracker class is as follows: private MapView mapView; private GoogleMap map; private

Android openGL ES 2.0 scene scrolling

对着背影说爱祢 提交于 2019-12-02 11:44:15
I'm working on a simple game for android using openGL es 2.0. Game will be in 2D, something like old supermario, where player can move left-right/up-down but no depth. Level will be larger than screen, so graphics will have to scroll. Here is where the problem comes. I don't know where/when to stop scrolling. Example. Lets say that background is 100x100 sized square with texture. Lets say that on screen there is only 1/4 of the background visible at any time. When I then move screen to the right, I would like it to stop scrolling when right edge of background comes at the edge of the screen.

OpenGL ES 2 on Android: how to use VBOs

泪湿孤枕 提交于 2019-12-02 08:21:59
this question is similar to something I asked here Android OpenGL ES 2: Introduction to VBOs however I tried multiple aproaches since then and I still haven't succeeded, so I think posting another question where I offer aditional details would be a better aproach. I am new to OpenGL ES 2 on Android (I have never worked with another OpenGL, I just need to draw something for an app I am developing for Android) and I would very much like to understand how to use VBOs. I tried to modify this OpenGL ES 2 for Android tutorial to use VBOs when drawing the triangle. I tried to use this step by step

How to draw a star in iOS OpenGL ES 2.0

怎甘沉沦 提交于 2019-12-02 08:14:17
This question has been asked before but the quite a few years ago in my searches. The answer was always to use texture mapping but what I really want to do is represent the star as a single vertex - you may think I'm copping out with a simplistic method but in fact, a single point source of light actually looks pretty good and realistic. But I want to process that point of light with something like a gaussian blur too give it a little more body when zooming in or for brighter stars. I was going to texture map a gaussian blur image but if I understand things correctly I would then have to draw

Fastest way to draw sprites in opengles 2.0 on android

筅森魡賤 提交于 2019-12-02 07:22:17
问题 So Im trying to figure out how to draw a single textured quad many times. My issue is that since these are create and deleted and every one of them has a unique position and rotation. Im not sure a vbo is the best solution as I've heard modifying buffers is extremely slow on android and it seems I would need to create a new one each frame since different quads might disappear randomly (collide with an enemy). If I simply do a draw call for each one I get 20fps around 100, which is unusable.

glTexGen in OpenGL ES 2.0

China☆狼群 提交于 2019-12-02 06:54:21
问题 I have been trying for several hours to implement a GLSL replacement for glTexGen with GL_OBJECT_LINEAR. For OpenGL ES 2.0. In Ogl GLSL there is the gl_TextureMatrix that makes this easier, but thats not available on OpenGL ES 2.0 / OpenGL ES Shader Language 1.0 Several sites have mentioned that this should be "easy" to do in a GLSL vert shader. But I just can not get it to work. My hunch is that I'm not setting the planes up correctly, or I'm missing something in my understanding. I've pored