opengl-es

iPhone OpenGL ES 2.0 - Pixel Perfect Textures

半腔热情 提交于 2019-12-28 11:58:52
问题 How can I get my textures to align with the screen pixels for pixel perfect graphics in OpenGL ES 2.0? This is critical for a project I'm working on which uses pixel art graphics. Any help on this would be great! 回答1: See my answer here: OpenGL Texture Coordinates in Pixel Space This has been asked a few times, but I don't have the links at hand, so a quick and rough explanation. Let's say the texture is 8 pixels wide: | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | ^ ^ ^ ^ ^ ^ ^ ^ ^ 0.0 | | | | | | | 1.0

iPhone OpenGL ES 2.0 - Pixel Perfect Textures

对着背影说爱祢 提交于 2019-12-28 11:58:14
问题 How can I get my textures to align with the screen pixels for pixel perfect graphics in OpenGL ES 2.0? This is critical for a project I'm working on which uses pixel art graphics. Any help on this would be great! 回答1: See my answer here: OpenGL Texture Coordinates in Pixel Space This has been asked a few times, but I don't have the links at hand, so a quick and rough explanation. Let's say the texture is 8 pixels wide: | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | ^ ^ ^ ^ ^ ^ ^ ^ ^ 0.0 | | | | | | | 1.0

How do I convert a vec4 rgba value to a float?

北城余情 提交于 2019-12-28 04:10:05
问题 I packed some float data in a texture as an unsigned_byte, my only option in webgl. Now I would like unpack it in the vertex shader. When I sample a pixel I get a vec4 which is really one of my floats. How do I convert from the vec4 to a float? 回答1: The following code is specifically for the iPhone 4 GPU using OpenGL ES 2.0. I have no experience with WebGL so I cant claim to know how the code will work in that context. Furthermore the main problem here is that highp float is not 32 bits but

Is it possible to rotate an object around its own axis and not around the base coordinate's axis?

北城以北 提交于 2019-12-28 03:32:12
问题 I am following the OpenGL es rotation examples from google to rotate a simple square (not a cube) on my Android App, for example this code: gl.glRotatef(xrot, 1.0f, 0.0f, 0.0f); //X gl.glRotatef(yrot, 0.0f, 1.0f, 0.0f); //Y gl.glRotatef(zrot, 0.0f, 0.0f, 1.0f); //Z It works fine if you only rotate around one axis. But if you rotate around one axis, and after that, you rotate around another axis, the rotation is not fair. I mean that the rotation is done around the axes of base (global)

Learning OpenGL ES 1.x [closed]

て烟熏妆下的殇ゞ 提交于 2019-12-27 19:13:21
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 3 years ago . What is the quickest way to come up to speed on OpenGL ES 1.x? Let's assume I know nothing about OpenGL (which is not entirely true, but it's been a while since I last used OpenGL). I am most interested in learning this for iPhone-related development, but I'm interested in

Drawing a sphere in OpenGL ES

半城伤御伤魂 提交于 2019-12-27 11:14:13
问题 I want to draw a sphere, I know how to do it in OpenGL using calls such as glBegin() & glEnd(). But there is nothing in ES. Suggestions/Tutorial links? 回答1: Since you've tagged this with OpenGL ES 2.0, let me suggest an alternative approach for creating smooth spheres, and that's to draw them as raytraced impostors. Rather than calculate the many vertices you'll need to replicate a smooth sphere, you can take advantage of the fact that a sphere looks pretty much the same from any angle. To do

How to implement a scrolling texture in WebGL?

懵懂的女人 提交于 2019-12-25 20:05:25
问题 I have gone through this as a example on how to render a normal texture to a canvas using WebGL and successfully implemented it. Now I am trying to implement a scrolling image where I am getting line by line pixel data from another machine in the same network via Ajax Polling or Websockets and have to render the same using WebGL to canvas. So, now I know we can easily render 60 frames per second which means if I get 50 lines of pixel data per second from another computer in the network ,I

How to implement a scrolling texture in WebGL?

不羁岁月 提交于 2019-12-25 20:03:31
问题 I have gone through this as a example on how to render a normal texture to a canvas using WebGL and successfully implemented it. Now I am trying to implement a scrolling image where I am getting line by line pixel data from another machine in the same network via Ajax Polling or Websockets and have to render the same using WebGL to canvas. So, now I know we can easily render 60 frames per second which means if I get 50 lines of pixel data per second from another computer in the network ,I

Explanation of working principle of openGL [closed]

十年热恋 提交于 2019-12-25 18:39:47
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . I'm trying to understand how coding in openGL works. I found this code on the internet and I want to understand it clearly. For my vertex shader I have: Vertex uniform vec3 fvLightPosition; varying vec2 Texcoord; varying vec2 Texcoordcut; varying vec3 ViewDirection; varying vec3

OpenGL ES stencil operations

只愿长相守 提交于 2019-12-25 18:16:44
问题 In reference to the problem diskussed in article OpenGL clipping a new question arises. I am implementing the clipping for a node based 2D scene graph. Whenever the clipping boxes are axis aligned I am using the glScissor like proposed in OpenGL clipping. I have sucessfully implemented node clipping of boxes that are axis aligned. It turns out that each node has to intersect it's clipping rectangle with the ones of it's ancestors that use clipping. (That is necessary in case of siblings that