opengl-es

Hiccups in OpenGL ES. What is the correct implementation?

I'm using OpenGL ES to make a game on the iPhone. Unfortunately, I see small (and irregular) hiccups. I use a timer with a sleep, calling the draw function every 60th of a second, in order to garantee a solid frame rate. I've tried to change the moment in time my timer awakens from its sleep, giving the draw function more time to exec...

OpenGL to OpenGL-ES - Changing color of triangles in a strip

When using glBegin() and glEnd() in opengl you are able to set and change the color between each glVertex3f(). How can you recreate this behavior when using a vertex array and glDrawArrays(). Here it is in regular opengl. for(angle = 0.0f; angle < (2.0f*GL_PI); angle += (GL_PI/8.0f)) { // Calculate x and y position of the next v...

When to use OpenGl on the iPhone.

When is it appropriate to use openGl-es on the iPhone versus other toolkits? I have been learning to use it and suddenly feel it might be overkill for what I have in mind. Is it a good choice for something like a blackjack game? ...

glError: 0x0501 when loading a large texture with OpenGL ES on the iPhone?

Here's the code I use to load a texture. image is a CGImageRef. After loading the image with this code, I eventually draw the image with glDrawArrays(). size_t imageW = CGImageGetWidth(image); size_t imageH = CGImageGetHeight(image); size_t picSize = pow2roundup((imageW > imageH) ? imageW : imageH); GLubyte *textureData = (GLubyte ...

512x512 Texture causing huge GPU stress on iPhone, despite tiling

I'm testing my simple OpenGL ES implementation (a 2D game) on the iPhone and I notice a high render utilization while using the profiler. These are the facts: I'm displaying only one preloaded large texture (512x512 pixels) at 60fps and the render utilization is around 40%. My texture is blended using GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALP...

glClearColor() pushing the iPhone at 27% render utilization

As a result of the search for an answer of this question, I ran into a rather uncomfortable finding. It seems that rendering only glClearColor() at 60 fps pushes the iPhone at 27% render utilization. That means that doing hardly anything at all - only refreshing the screen - makes the iPhone use more than a quarter of its render capaci...

Opengl ES - Incorrect Rendering on the z axis?

I have a model of a snowman that I am loading from a .obj file. Everything works well except that when I use glRotatef() to rotate the model the head of the snowman will always render in front of the body. The nose of the snowman will also always render behind the head. This creates the effect that the snowman changes direction as he is ...

how to make iphone apps like ibeer, imilk, ibug, ibeer

Hi! I was visiting this website with cool animated apps. I was wondering how's the easiest way of building a app like those. I almost bet it uses some kind of OpenGL ES. Is it a good case of cocos2d usage? ...

Copy arbitrarily sized block of pixels into OpenGL ES texture... somehow?

I'm writing a drawing application, and the drawing canvas is an OpenGL texture. When you draw onto the canvas, it determines which region of the canvas texture has been changed, and copies that pixel data out (using glReadPixels) before applying the changes you made. To undo, I want to simply revert to the previous texture state using t...

iPhone : Texture bigger than 64x64?

Hi, I took the example of GLPaint... I'm trying to put a background into the "PaintingView", so you could draw over the background and finally save the image as a file..... I'm lost. I'm loading the PNG (512x512) and try to "paint with it" at the very beginning of the program, but it's painted as 64x64 instead of 512x512... I tried be...

Animating a texture across a surface in OpenGL

I'm working with the iPhone OpenGLES implementation and I wish to endlessly scroll a texture across a simple surface (two triangles making up a rectangle). This should be straightforward, but it's not something I've done before and I must be missing something. I can rotate the texture fine, but translate does not work at all. Do I hav...

Why does scaling object down cause object to be lighter in OpenGL ES?

Why does scaling (uniformly) object down cause object to be lighter in OpenGL ES 1.x? It would be more sense to be that it would darker because aren't the normals being scaled down also making the object darker? But for some reason the object becomes lighter. When I scale up, the object becomes darker. In my opinion this should be the o...

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?

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 ...

Help me start out with OpenGL

Till today I am working with Basic UIKIT application but now onwards I need to work in OpenGL. Problem is I have not any idea about OpenGL and am confused lot about how to start and from where to start. I need to create an application which is same as "iBeer" (see movie in YouTube). So I am having lots of confusion about how do I crea...

GLPaint save image

I'm trying to develop a complex painting application on the iPhone. I'm currently drawing using Quartz (e.g. CGContext...). Unfortunately the Quartz overhead is just too slow for the type of drawing I'm doing, and I'm porting to OpenGL calls using the GLPaint example as a reference point. Is there a way to get a UIImage/CGImage from t...

Is OpenGL required for my iPhone game?

On an iPhone: If I am writing a game that has multiple levels, with multiple animations (image sequences), jpg and png (transparent), some full screen and some not, some looped and some played once only. What is the best way of doing it? Each level might have up to 10MB of images. Add on to this music, and video (cut scenes). All 2D gra...

How can glDrawElements() cause a EXC_BAD_ACCESS while drawing with texture?

I am getting a EXC_BAD_ACCESS on the the glDrawElements() in this code, but only when the bottom block of code is present. I am thinking it must be something conceptual that I am missing because I am not finding any nil pointers or other things that can typically cause this error. glScalef(6, 6, 6); glEnableClientState(GL_VERTEX_ARRAY);...

Getting the size of the OpenGL window in Android

Hi, I'm trying to draw a square in OpenGL ES (Android), 2D and covering the whole screen. At the moment I'm just using trial and error but am sure there has got to be a better way to get the size of the screen. Below is how I'm currently initializing square: float[] square = new float[] { -0.1f, -0.1f, 0.0f, 0.1f, -0.1f, ...

How can I get rid of artifacts in my OpenGL ES iPhone app?

I'm using the Texture2D class from the CrashLanding sample code. I'm getting strange artifacts around my images in both the simulator and the phone. The artifacts are little gray borders around the textures. The borders are inconsistent and do not surround the entire texture. I'm using pngs. ...

EAGLView orientation changes and strange buffering

I'm writing an app that offloads some heavy drawing into an EAGLView, and it does some lightweight stuff in UIKit on top. It seems that the GL render during an orientation change is cached somewhere, and I can't figure out how to get access to it. Specifically: After an orientation change, calling glClear(GL_COLOR_BUFFER_BIT) isn't e...