opengl-es

Android, OpenGLES, CmdLine tool, getting MainDisplay resolution

匆匆过客 提交于 2019-12-20 03:13:46
问题 Environment Windows (x64) Host Android 5.0 USB connected to the Windows machine Samsung Galaxy 5 VisualGDB OpenGL (v1.4) ADB CmdLine tool => Native C++ (No Java) Use-case Implement an ADB commandline tool that extract the main display resolution ( this is part of the tools functionality ) The following code print gibberish data , How can I get the main display resolution using Native C++ code running as an ADB command line tool ? Code snippet HRESULT GetMainDisplayResolution(OUT SIZE& sz) {

Is it ever reasonable to do computations outside of main in an OpenGL shader?

耗尽温柔 提交于 2019-12-20 02:52:52
问题 I have some vertex shader code somewhat like the following (this is a bit of simplified example): attribute vec2 aPosition; attribute vec4 aColor; varying lowp vec4 vColor; uniform vec4 uViewport; mat4 viewportScale = mat4(2.0 / uViewport.z, 0, 0, 0, 0, -2.0 / uViewport.w, 0,0, 0, 0,1,0, -1,+1,0,1); void main() { vec2 pos = aPosition; gl_Position = viewportScale * vec4(pos, 0, 1); vColor = vec4(aColor.rgb*aColor.a, aColor.a); } In particular, the viewportScale matrix is calculated from the

How do I texture a cylinder in OpenGL created with triangle_strip?

孤人 提交于 2019-12-20 02:49:10
问题 Here's the cylinder I have created: void drawCylinder(float r, float g, float b) { setMaterialColors(r, g, b); glColor4f(r, g, b, 1.0); /* top triangle */ double i, resolution = 0.1; double height = 1, radius = 0.5; glPushMatrix(); glTranslatef(0, -0.5, 0); glBegin(GL_TRIANGLE_FAN); glVertex3f(0, height, 0); /* center */ for (i = 0; i <= 2 * PI; i += resolution) glVertex3f(radius * cos(i), height, radius * sin(i)); glEnd(); /* bottom triangle: note: for is in reverse order */ glBegin(GL

How i can make that a polygon fill the 80% of the width of the screen?

戏子无情 提交于 2019-12-20 01:45:33
问题 I have a simple square (polygon), and i want that it fills the 80% of the width of the screen In other words, i want to position the square on the center on the center of the screen, but with a width of the 80% of the total width of the screen How can i do it? I can't find examples/tutorials about this thanks THis is the code for my square: public class Square { //Buffer de vertices private FloatBuffer vertexBuffer; //Buffer de coordenadas de texturas private FloatBuffer textureBuffer; /

Missing OpenGL drivers on Android emulator

♀尐吖头ヾ 提交于 2019-12-20 01:34:52
问题 I am trying to set up an Android emulator to do some playing around with OpenGL ES on it, but I am stymied by the fact that, every time I run my program on it, it unceremoniously grenades itself. The problem (at least the first nasty red error line in the log) is a missing package called libhgl.so. This is the OpenGL driver file required for running OpenGL ES on Android devices, but for some reason, my emulator doesn't have it. Does anyone know where I can get drivers for the emulator, or how

Three.js as background of website possible?

你离开我真会死。 提交于 2019-12-19 21:46:24
问题 I've been looking at using three.js for a fun experiment on a site. I would like to use a current experiment (for which I already have the code for) and use it as a background for my site. Anybody know how to do this? I saw it done here: http://janjorissen.be/ Three JS API: https://github.com/mrdoob/three.js/wiki/API-Reference 回答1: usually i use iframe for that. Thus you dont have conflict with the base page. <style> iframe { z-index : -9999; position: absolute; top : 0; left : 0; width : 100

OpenGL ES: How to tint texture with color

天涯浪子 提交于 2019-12-19 19:52:22
问题 I have texture with alpha. And I want to tint it with some color, so it will be colored depending on color alpha value, but overal opacity will be defined only by texture alpha. This is similar to multi-texturing but with color instead of second texture. How to do it? (Updated) I have tried to set up texture combiner. Color is tinted fine, but there is problem with alpha - it doesn't take value from texture (like mask). My code at this moment: glActiveTexture (GL_TEXTURE0); // do we need

Are most games on the IPhone done with OpenGL ES?

心已入冬 提交于 2019-12-19 19:51:41
问题 I was just wondering if most games on the iPhone are done in OpenGL ES as opposed to using Quartz and Core Animation. Are Quartz and Core Animation mostly used for just creating slick interfaces? Or if there is a point with games where OpenGL probably has to be used over using other tools? 回答1: For efficiency reasons OpenGL ES is you best choice for games, unless your writing a "simple" board game or card game (like Solitaire). In this case Core Animation would be a good fit. 回答2: You should

Repeated textures are severely distorted/shaking when rotating camera

社会主义新天地 提交于 2019-12-19 18:57:34
问题 I originally asked this question on gamedev, but none of the answers helped to solve problem, and I still have no clue what is the real cause. I didn't see anything about re-posting questions across SE in FAQs, so I can only hope this is okay. Moreover, in the retrospect the question is probably more related to graphics programming in general than just game development. Edit 1 begins The behaviour of the original post applies only to Windows XP and Windows 7, browsers Firefox and Chrome. On

OpenGL ES 1.1 or 2.0 on iPhone

血红的双手。 提交于 2019-12-19 17:13:50
问题 I understand that an upgrade to the iPhone OS upgraded the OpenGL ES version support from 1.1 to 2.0. What I haven't been able to find is whether effort should be made to use 1.1 for backwards compatibility with older devices. Xcode seems to suggest I using 2.0, since it only seems to include that version. Should I use 2.0 and not look back? Are there devices which can only use 1.1? Thanks. 回答1: OpenGL ES 2.0 requires hardware support (via an enhanced graphics processor). The first GPU to