Starting to make ray tracing hard shadow Webgl2 - webgl

i have no idea to how make ray tracing in Webgl2 to make nice hard shadow from scratch.
Can anyone help me find a simple tutorial or source?

Related

OpenGL ES 2D Drawing Performance Estimation

I've been confronted with the extremely bad drawing Performance of Quartz/Core Graphics.
I don't believe its bad in every scenario, but in my occasion, where i need to redraw something like 3000 short lines frequently, it performs super bad.
Since the Modal (of MVC) is fixed I can not change how it spits out the data (if I could, i would have followed the advice, to only draw the changes, so the lines dont have to be redrawn every frame).
So as a conclusion I am considering using opengl for that purpose and I would like to ask u (experienced) guys for an estimation of how well it could work using opengl, before starting to work into that topic, as it seems by far more difficult
than Quartz.
You almost certainly see a speed performance lift from OpenGL over Quartz, however remember that whereas Quartz uses point to point drawing, OpenGL is based on the use of vertices and vertices points (essentially co-ordinates). You may find you need to do some mid-weight parsing work on your existing data source to re-work it into this vertices point system.
Also keep in mind that drawing text on top of an OpenGL ES object is a tricky task - it can be done (ironically) by using Quartz to generate an image, and then using this image as a texture.
I'd definitely recommend using OpenGL Kit as it will make life a bit easier for you as a beginner to OpenGL. Ray Wenderlich has an excellent starting point tutorial here :
http://www.raywenderlich.com/5223/beginning-opengl-es-2-0-with-glkit-part-1

Explanation needed on Deferred lights

I have implemented a simple deferred shading engine in opengl but now im stuck on the point lights part.
I have searched evry where and i simply cant find a good explanation on how the point lights work.
First why do they have to be draw as a mesh?
Cant i simply pass the values ot the vertex shader and run a loop for all the lights that i have passed?
i mean for the direcitonal light you just have to do a simpel phong on shading on every pixel...
I guess im just looking for a nice simple explanation on how the point lights work in deferred shading, if some one could explain it to me or point me in the right direction it would be much apreciated.
thanks.

Cocos2D: How to Setup a No-frills Physics Engine for an Endless Runner

Note: I am rather new to programming, even more-so game programming, so I apologize if my question is rather broad but it's hard to find a tutorial for this topic.
Description of Project
A simple endless side-scrolling runner similar to Canabalt where the player may tap on the screen to make the character jump. The only movement allowed to the character sprite is along the y axis.
What I Have...
A scrolling parallax background.
What I Want...
A character sprite that has a bounding box
A ground sprite that has a bounding box
A way to tell when either is touching/intersecting
A means to keep them from continuing to intersect
What I've Tried...
Ray Wenderlich's Tutorial (semi-outdated, also is tile-based which I didn't like very much and seemed quite prone to buggy-ness)
There are really two parts to my question:
For a beginner to physics, is it recommended to just stick with an API like Chipmunk or Box2D?
if first question == FALSE
What is the best way to go about building my own physics engine given the above information?
Thank you in advance for any tips/advice you may share. :)
Might I suggest using Chipmunk. Like you, I too wanted to build a game with a minimalist but efficient collision detection and force manipulation system. After loads of frustration and days wasted trying to implement some basic physics, I gave up and decided to learn an engine. Chipmunk, though intimidating at first glance, is actually very simple to learn. I have been able to use it in projects for just simple, efficient collision detection, as well as full-fledged physics-simulations.
There are a couple different versions of chipmunk (chipmunk pro, studio, etc.) that are arguably even easier to use than the original. I managed to get bye with the basic chipmunk after reading through a few code examples provided within chipmunk. Additionally, SpaceManager is a wrapper for chipmunk in obj-c that allows you to ignore all the c-based functions. It provides a lot of convenient methods for building spaces, adding bodies and sprites, and manipulating objects. It can be found here: http://code.google.com/p/chipmunk-spacemanager/
Unless you are very, very well versed in many areas of physics, don't try implementing your own engine.

For an iOS painting app, does it have to use either Quartz 2D or OpenGL?

I'm trying to implement a painting app with brush texture and blending, similar to that of an oil painting. I'm finding that even though Quartz 2D has been relatively simple to pick up, I've found it hard to implement the ideas of stroke texture/blending. Naively I tried hacking the shadow, and it looks "okay," but the performance sucks. I have a feeling that if I try to use a bitmap image for drawing I will have similar performance issues, but I do not know that to be the case. Meanwhile, the only alternative I see around is OpenGL, which feels like overkill and also is pretty intimidating. I've looked at GLPaint and I can't claim to understand some parts of it. Further working against me is that my knowledge of C is extremely limited and it really feels like if I understood C better I might understand OpenGL ES for iOS better as well.
Basically, I am wondering: given my requirement of producing an "oil painting" type effect for iOS painting, am I relegated to either the poor performance of Quartz 2D or learning the gigantic and honestly scary OpenGL framework? Are there any frameworks that "wrap" OpenGL functionality for mere mortals like myself?
Or, is there some other way of achieving stroke texture and blending that I am not aware of in Quartz?
iOS 5's GLKit will wrap a lot of OpenGL functionality for you, but it's going to be difficult to find an "oil painting library" because it is quite specific. If you want to work with graphics, sooner or later you are going to have to deal with OpenGL I imagine. It seems intimidating, but if you read a good book on it you will start to understand it better.
However, make sure you exhaust your possibilties on Quartz first. Perhaps you can find the function that is taking the most time and ask another question about how to improve its efficiency.
To answer the main question though, "yes".
However it focuses mainly on game development, there is a popular framework called cocos2d that wraps around OpenGL and provides simple APIs for 2D gfx development. If you decide to go on with OpenGL ES, I found this tutorial excellent and very comprehensible, even if it is focusing on 3D.

OpenGl Star drawing

I'm really new to OpenGL, which is a really bad thing to me :|
I need to draw a star(sort of) with openGl but I'm not really sure where I should start.
The results should be something like this:
Is there an easy way to do this?
the easiest way would be to draw a texture mapped quad with a "star" texture. You can read a tutorial on texture mapping here: http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=06
That tutorial teaches how to draw a cube using textures.
You just have to draw a single face, instead of all six.
The tutorial is written in C++, but near the end you can download the source of a Delphi version.
There are other effects you might want to add later, such as transparency. You can also read about that in the NeHe site. It has a lot of useful tutorials on OpenGL. It's a great place to learn OpenGL.
If you're new to OpenGL and if you're using Delphi, then most probably what you need is GLScene. Mature, alive, very good quality of code and, of course, free.
Why not write an algorithm to generate a texture procedurally in code using a 2D GLuByte array as in the "checker.c" example in Redbook? Instead of following a perfect checkerboard pattern, figure out how to make a 2D texture of that star and map it into a quad using glTexImage2D(...).

Resources