opengl-es

OpenGL ES FBO Scaling

旧城冷巷雨未停 提交于 2019-12-08 04:34:27
问题 This question is a follow up to the original question as recommended by Matic Oblak Once an FBO is setup and rendered to, how is the rendered image provided back to the default render buffer and displayed in a scaled version. -(void)setupFBO { glGenTextures(1, &tex); glBindTexture(GL_TEXTURE_2D, tex); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

opengl es: drawing a texture with fading gradient

风格不统一 提交于 2019-12-08 04:32:42
问题 I am completely new to opengl and need some help in drawing a texture with gradient applied over it. Now I am drawing a texture with the following code: glPushMatrix(); glBindTexture(GL_TEXTURE_2D,fcr.texture); glTranslatef(trans, 0, 0); glScalef(sc,sc,1.0); glColor4f(1.0,1.0,1.0,0.4); glDrawArrays(GL_TRIANGLE_STRIP,0,4); glColor4f(1,1,1,1); In the above code glColor4f(1.0,1.0,1.0,0.4); applies transparency to the drawn image. Now instead of a solid transparent color, I would like to apply a

Loading textures at random place

六月ゝ 毕业季﹏ 提交于 2019-12-08 04:28:15
问题 I'm trying to load all the game data at the same time, in my game scene's constructor. But it fails, because texture loading works only in an opengl context, like if load method called from draw frame or surfacechanged. But i think it's ugly to load textures when the drawframe first called or something similar. So is it possible somehow to separate my loading part from opengl functions? 回答1: I have exactly the same problem. My solution is using the proxy textures. It means that when you're

Is it possible to put an OpenGL ES rendering view over an UIView, while the UIView shines through like if the OpenGL ES was a PNG with transparency?

▼魔方 西西 提交于 2019-12-08 04:07:34
问题 I have no idea about it, but if that was possible (like Flash, for example), then that would be really cool. I have an view-based app where I need probably some OpenGL ES capabilities, but don't want to have fullscreen OpenGL ES. I just need it at certain small areas for drawing little charts and other stuff that may be hard to do with core graphics. 回答1: Yes, you should be able to implement this through Quartz Core using layers (see the CALayer class documentation). Indeed, you can have

Any way to make an entire Android OpenGL ES scene transparent?

大城市里の小女人 提交于 2019-12-08 04:03:49
问题 Is there any way to make an entire Android OpenGL ES scene transparent? This would be useful for widgets and wallpapers. There is one Android-specific answer here. But my understanding is that this technique creates a transparent background, upon which one could furthermore draw transparent shapes. I am looking for a way to make the entire scene transparent after it has been drawn. For instance, is there any way to change the alpha of the entire color buffer after the scene has been drawn?

Synchronized with GLThread in Android

坚强是说给别人听的谎言 提交于 2019-12-08 04:03:45
问题 I'm making a game in android using opengl-es, using multiple threads: class World{ protected static final AtomicInteger entityLock = new AtomicInteger(); private GameEntity entities[]; public World(){ // populate game world with entities // executed on main thread addEntity(new GameEntity("tank")); addEntity(new GameEntity("rifleman")); addEntity(new GameEntity("rifleman")); } void update(){ synchronized(entityLock){ for(int i = 0;i<entities.length;i++){ // move entity to new position //

Avoiding resuming app at lock screen

我与影子孤独终老i 提交于 2019-12-08 03:58:08
问题 I have a game which uses OpenGL ES for rendering. And it requires that I reload all the textures on resuming the app. When I press the homekey and exit (pause the app) and then resume it, it works fine. But when I use the power key to turn off the screen then turn on the screen, the app resumes at the lock screen itself (Slide to unlock screen). Is there anyway I can avoid this? Because the resume is not proper, if I unlock the screen after a slight delay (10 secs) the game will reload again

Creating a 16 bit luminance texture in OpenGL ES 2.0 on iOS

天大地大妈咪最大 提交于 2019-12-08 03:57:28
问题 I have 16 bit data in a file, which I am trying to load into an OpenGL luminance texture on iOS. If I rescale the 16 bit values to 8 bit manually, I am able to load and display the data as follows: glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, width, height, 0, GL_LUMINANCE,GL_UNSIGNED_BYTE, (void*)data_8bit); But can I make glTexImage2D do the conversion from 16 to 8 bit? Looking at the OpenGL 2.0 spec, the allowed values for 16 bit type are: GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_4_4_4_4

No current openGL context when returning from activity?

爱⌒轻易说出口 提交于 2019-12-08 03:49:24
问题 I am writing code that will allow the user to browse through the files on their SD card to locate images and them load them using openGL ES 2.0. This works fine when I had used just an EditText to type in the file path, but now that I have implemented a file browser that makes the exact same call with a String of the file path I get "Call to openGL API without a current context" in the LogCat. I assumed this had something to do with the loader activity being over top the GLSurfaceView so I

Implement the Fixed function Pipeline efficent in OpenGL ES 2.0?

我与影子孤独终老i 提交于 2019-12-08 03:45:12
问题 I want to use fixed function methods like glTranslate(), glRotate(), glScale() in my openGL 2.0 App. I know, that I need to implement an matrix class - and have done this. My question now is about efficiency. To be able to use something like: glLoadIdentity(); glRotatef(2.0f, 0.0f, 0.0f, 1.0f); glScalef(2.0f, 2.0f, 2.0f); I think, I need to do at least 3 matrix multiplications (assuming we have a projection and a modelview matrizes and this is for the modelview). First would be: Identity