depth-testing

What are good reasons to enable 2D projection with cocos2d-iphone?

﹥>﹥吖頭↗ 提交于 2019-12-30 09:58:12
问题 In cocos2d-iphone the default projection type is "3D" projection. But you can also set the projection to "2D" like so: [[CCDirector sharedDirector] setProjection:CCDirectorProjection2D]; Behind the scenes the 3D projection uses perspective projection whereas 2D projection is the OpenGL orthographic projection. The technical details about these two projection modes can be reviewed here, that's not what I'm interested in. What are the benefits and drawbacks of 2D projection for cocos2d users?

Meaning and usage of the factor parameter in glPolygonOffset

不打扰是莪最后的温柔 提交于 2019-12-09 15:40:07
问题 I am having difficulty understanding the meaning of the first parameter in glPolygonOffset function. void glPolygonOffset(GLfloat factor, GLfloat units); The official documentation says that factor Specifies a scale factor that is used to create a variable depth offset for each polygon. and that each fragment's depth value will be offset after it is interpolated from the depth values of the appropriate vertices. The value of the offset is factor × DZ + r × units , where DZ is a measurement of

How does WebGL set values in the depth buffer?

拜拜、爱过 提交于 2019-12-06 06:24:59
问题 In OpenGL, depth buffer values are calculated based on the near and far clipping planes of the scene. (Reference: Getting the true z value from the depth buffer) How does this work in WebGL? My understanding is that WebGL is unaware of my scene's far and near clipping planes. The near and far clipping planes are used to calculate my projection matrix, but I never tell WebGL what they are explicitly so it can't use them to calculate depth buffer values. How does WebGL set values in the depth

What are good reasons to enable 2D projection with cocos2d-iphone?

人盡茶涼 提交于 2019-12-01 06:12:33
In cocos2d-iphone the default projection type is "3D" projection. But you can also set the projection to "2D" like so: [[CCDirector sharedDirector] setProjection:CCDirectorProjection2D]; Behind the scenes the 3D projection uses perspective projection whereas 2D projection is the OpenGL orthographic projection. The technical details about these two projection modes can be reviewed here , that's not what I'm interested in. What are the benefits and drawbacks of 2D projection for cocos2d users? What are good reasons to switch to 2D projection? Personally I've used 2D projection to be able to use

Can't get depth testing to work in OpenGL

这一生的挚爱 提交于 2019-11-29 10:44:37
I use SFML to create the window. In this screenshot the cube should be behind the pyramid but it just doesn't work. Here is the minimal code I used: #include <OpenGL/gl.h> #include <OpenGL/glu.h> #include <SFML/Graphics.hpp> #include "ResourcePath.hpp" void resize(); void drawScene(); void initGL(); float rtri = 0; float rquad = 0; float z = -10.0f; int main (int argc, const char * argv[]) { // Create the main window sf::RenderWindow *window = new sf::RenderWindow(); window->Create( sf::VideoMode( 800, 600, 32 ), "Collision Detection", sf::Style::Close ); sf::Event event; bool run = true;

Can't get depth testing to work in OpenGL

假如想象 提交于 2019-11-28 03:57:18
问题 I use SFML to create the window. In this screenshot the cube should be behind the pyramid but it just doesn't work. Here is the minimal code I used: #include <OpenGL/gl.h> #include <OpenGL/glu.h> #include <SFML/Graphics.hpp> #include "ResourcePath.hpp" void resize(); void drawScene(); void initGL(); float rtri = 0; float rquad = 0; float z = -10.0f; int main (int argc, const char * argv[]) { // Create the main window sf::RenderWindow *window = new sf::RenderWindow(); window->Create( sf: