opengl-es-2.0

Blank screen while using glGenBuffers in openGL

。_饼干妹妹 提交于 2019-12-02 23:10:01
问题 #include <stdio.h> #include <stdlib.h> #include <GL/glew.h> #include <GL/glut.h> void changeSize(int w, int h) { if(h == 0) h = 1; float ratio = w / h; glMatrixMode(GL_PROJECTION); glLoadIdentity(); glViewport(0, 0, w, h); gluPerspective(40,ratio,1.5,20); glMatrixMode(GL_MODELVIEW); } void renderScene(void) { glClear(GL_COLOR_BUFFER_BIT ); glLoadIdentity(); glTranslatef(0.0,0.0,-5.0); glDrawArrays(GL_TRIANGLES,0,3); glutSwapBuffers(); } void init() { GLfloat verts[] = { 0.0, 1.0, -1.0, -1.0,

Android EGL/OpenGL ES Frame Rate Stuttering

杀马特。学长 韩版系。学妹 提交于 2019-12-02 23:08:20
TL;DR Even when doing no drawing at all, it seems impossible to maintain a 60Hz update rate on an OpenGL ES rendering thread on an Android device. Mysterious spikes frequently crop up (demonstrated in the code at bottom), and every effort that I've made to figure out why or how has lead to a dead end. Timing in more complicated examples with a custom rendering thread has consistently shown eglSwapBuffers() to be the culprit, frequently coming in over 17ms-32ms. Help? More Details This is particularly damning because the rendering requirements for our project is screen-aligned elements smoothly

How to load and display .obj file in Android with OpenGL-ES 2

谁说我不能喝 提交于 2019-12-02 22:40:48
I am trying to load an .obj file into my Android application and display it using OpenGL 2. You can find the file here: EDIT: I removed the file , you can use any .obj file that contains the values mentiones below for testing. There are a lot of similar questions on stackoverflow but I did not find a simple solution that does not require some large library. The file only contains the following value types: g v vt vn f I tried libgdx, which worked ok, but it is a bit overkill for what I need. I tried the oObjLoader https://github.com/seanrowens/oObjLoader without the LWJGL. The parsing seems to

glOrtho OpenGL es 2.0 variant how fix blank screen?

点点圈 提交于 2019-12-02 21:48:18
问题 I try to remake a OpenGL ES 2.0 example for Android http://developer.android.com/resources/tutorials/opengl/opengl-es20.html to Android NDK OpenGL ES 2.0 example. I succeded in all except making a orthographic/perspective projection So i draw a triangle typedef matrix float matrix[16]; matrix MVP_MATRIX; /* MODEL*VIEW*PROJECTION MATRIX */ matrix PROJECTION_MATRIX; matrix MODEL_MATRIX; matrix VIEW_MATRIX; s_shader shader; /* just struct for holding shader program data (attribytes,uniforms,

What are the differences between OpenGL ES 2.0 and OpenGL ES 3.0

时光总嘲笑我的痴心妄想 提交于 2019-12-02 20:15:01
I want to know what is the differences between OpenGL ES 2.0 and OpenGL ES 3.0 . What is the main advantage of OpenGL ES 3.0 ? I think it would be best to read section "Version 3.0 and Before -> New Features" on the official specs And it is backward compatible with ES 2.0. Straight from Wikipedia : The OpenGL ES 3.0 specification was publicly released in August 2012. OpenGL ES 3.0 is backwards compatible with OpenGL ES 2.0, enabling applications to incrementally add new visual features to applications. New functionality in the OpenGL ES 3.0 specification includes: multiple enhancements to the

iOS OpenGL ES 2.0: Offscreen render and save the result to an UIImage

懵懂的女人 提交于 2019-12-02 19:47:32
I'm using OpenGL ES to render some special effects, I don't want to show this to user, I just want to save the result as an UIImage, can anybody please help me? this is the code I'm using, I can get an image which contains the red clear color I use, but no geometry drawing shown. #import "RendererGL.h" #import <GLKit/GLKit.h> #import <UIKit/UIKit.h> #import <OpenGLES/EAGL.h> #import <OpenGLES/EAGLDrawable.h> #import <OpenGLES/ES2/glext.h> #import <QuartzCore/QuartzCore.h> static NSInteger WIDTH_IN_PIXEL = 400; static NSInteger HEIGHT_IN_PIXEL = 300; typedef struct { GLKVector3 positionCoords;

Errors showing for OES OpenGL statements in Xcode 6 for iOS8

雨燕双飞 提交于 2019-12-02 19:25:45
Xcode 6 iOS SDK 8.0 in Yosemite is giving me errors for OpenGL ES2 code which compiles fine under Xcode 5 GLuint depthStencilRenderbuffer; glBindRenderbufferOES(GL_RENDERBUFFER_OES, depthStencilRenderbuffer); glRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_DEPTH24_STENCIL8_OES, self.view.bounds.size.width, self.view.bounds.size.height); Generates errors: line 2: Conflicting types for 'glBindRenderBufferOES' Use of undeclared identifier 'GL_RENDERBUFFER_OES' line 3: implicit declaration of contain 'glBindRenderBufferOES' is invalid in C99 Edit: OK, I can get things working again by

Draw a 2D Image using OpenGL ES 2.0

人盡茶涼 提交于 2019-12-02 17:34:43
I've been struggling to draw a 2D image from jpg/png files using openGL ES 2.0 for Android. Everywhere I look the tutorials are for texturing 3D images so its been rough figuring out how to draw a regular 2D Sprite. I got a square to draw and rotate but once it came to texturing I must have messed up somewhere because I keep getting an error saying DrawElements isn't bound to any data but if I comment out any code to do with texturing it works fine. Any help would be greatly appreciated. Here is my Code for my Sprite class and Renderer Class: public class Sprite { //Reference to Activity

Differences between GLSL and GLSL ES 2

让人想犯罪 __ 提交于 2019-12-02 17:30:59
Two questions really... Is GLSL ES 2 a totally separate language, or a special version of GLSL? What are the differences between them, in terms of "standard library" functions, syntax and capabilities? I am writing shaders for an application targeted at Windows, Mac and iPad and I would prefer not to have to add more versions of each shader - well simpler shaders anyway. Is GLSL ES 2 a totally separate language, or a special version of GLSL? Every version of GLSL is ultimately a "totally separate language;" some aren't even backwards compatible with previous versions. However, the ES variation

Render multiple objects with OpenGL ES 2.0

孤人 提交于 2019-12-02 16:15:17
I am trying to learn OpenGL ES 2.0 to do some iPhone game development. I have read through multiple tutorials and some of the OpenGL ES 2.0 spec. All of the examples I have seen have created a single mesh, loaded it into a vertex buffer and then rendered it (with the expected translation, rotation, gradient, etc.) My question is this: how do you render multiple objects in your scene that have different meshes and are moving independently? If I have a car and a motorcycle for example, can I create 2 vertex buffers and keep the mesh data for both around for each render call, and then just send