opengl-es

GLSL shader that scroll texture

那年仲夏 提交于 2019-12-18 13:36:07
问题 How to scrolling a texture on a plane? So I have a plane with a texture, can I use a shader to scroll left from right (infinite) the texture on it? 回答1: Setup the texture wrapping mode using glTexParameteri(TextureID, L_TEXTURE_WRAP_S, GL_REPEAT) Add the float uniform named Time to your texturing shader Use something like texture2D(sampler, u + Time, v) while fetching texture sample. Update the Time uniform using some timer in your code. Here's a GLSL shader: /*VERTEX_PROGRAM*/ in vec4 in

OpenGL texture atlas bleeding

依然范特西╮ 提交于 2019-12-18 13:36:01
问题 I'm trying to draw a basic 2d ground mesh made up of smaller tiles from a texture atlas (note the 1 pixel transparent border): I render the tiles as texture quads using the following code: glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, m_texture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glVertexPointer(2, GL_SHORT

How many maximum triangles can be drawn on ipad using opengl es in 1 frame?

两盒软妹~` 提交于 2019-12-18 13:32:35
问题 How many maximum triangles can be drawn on ipad in a single frame. Also, is there a limit to the number of gl calls used to draw those triangles? 回答1: The only limit on total triangles that you'll run into on the iPad is in terms of memory size and how quickly you wish for this to render. The more vertices you send, the more memory your application will use, and the slower it will render. For example, in my benchmarks I was able to push over 1,800,000 triangles per second on an iPad 1 using

gpus_ReturnGuiltyForHardwareRestart crash

非 Y 不嫁゛ 提交于 2019-12-18 13:15:14
问题 Application crashes in presentFrameBuffer (while running in foreground, no interruption occurring). It's not crashing in the first frame, it draws for a while then it suddenly crashes. I don't have exact steps to reproduce, but seems related to drawing something specific, still I have no openGL error reported trough the application, including one error check right before the presentFrameBuffer. If I add glFinish before the presentFrameBuffer will crash in the glFinish. Application is crashing

Android: When is OpenGL context destroyed?

南楼画角 提交于 2019-12-18 12:57:11
问题 On android, the GLSurfaceView documentation says this: A GLSurfaceView must be notified when the activity is paused and resumed. GLSurfaceView clients are required to call onPause() when the activity pauses and onResume() when the activity resumes. These calls allow GLSurfaceView to pause and resume the rendering thread, and also allow GLSurfaceView to release and recreate the OpenGL display. So I'm supposed to do something like this in my activity: public void onPause() { myGlSurfaceView

How do I draw 1000+ particles (w/ unique rotation, scale, and alpha) in iPhone OpenGL ES particle system without slowing down the game?

主宰稳场 提交于 2019-12-18 12:44:39
问题 I am developing a game for iPhone using OpenGL ES 1.1. In this game, I have blood particles which emit from characters when they are shot, so there can be 1000+ blood particles on the screen at any one time. The problem is that when I have over 500 particles to render, the game's frame rate drops immensely. Currently, each particle renders itself using glDrawArrays(..) , and I know this is the cause for the slow down. All particles share the same texture atlas. So what is the best option to

Detect user's touches over an OpenGL square [duplicate]

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-18 12:37:36
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: How do I determine what is touched in 3D space from the screen? I'm developing an Android application. I'm also working with OpenGL graphics. I have a square drawn on the screen and I want to let user move it when he touches over it. In other words, user should be able to move square when he puts his finger on the square. If he touches outside the square nothing happens. How can I detect when user touches over

Android TextureView / Drawing / Painting Performance

流过昼夜 提交于 2019-12-18 12:07:54
问题 I am attempting to make a drawing/painting app using TextureView on Android. I want to support a drawing surface of up to 4096x4096 pixels, which seems reasonable for my minimum target device (which I use for testing) which is a Google Nexus 7 2013 which has a nice quad core CPU and 2GB memory. One of my requirements is that my view must be inside of a view that allows it to be zoomed in and out and panned, which is all custom code I have written (think UIScrollView from iOS). I've tried

Alternatives to creating an openGL texture from a captured video frame to overlay an openGL view over video? (iPhone)

和自甴很熟 提交于 2019-12-18 11:44:41
问题 This is mostly relevant for augmented reality type applications. Apple provides information on how to capture video frames (and save them as images if need be) with AVCaptureSession here: http://developer.apple.com/library/ios/#qa/qa2010/qa1702.html I know that it is possible to create an openGL texture out a captured video frame and then use that as a background in the openGL view over which to overlay other graphics. I am wondering if there are any alternatives to this method? The method

how to record screen video as like Talking Tomcat application does in iphone?

馋奶兔 提交于 2019-12-18 11:43:05
问题 hey i m trying the record the gameplay of my game so that i can upload its video to youtube from device itself...m trying to do same thing as Talking tomcat app for iphone..recording the video then playing it ,etc... i m using glReadPixels() for reading framebuffer data and then writing it to video with the help of AVAssetWriter in AVFoundation framwork. But reading the data on each drawing decreases the FPS from around 30-35 to 2-3 only while using glReadPixels. i think Talking tomcat is