Results 1 to 2 of 2

Thread: Picking/ particle effect

  1. #1
    Newbie Newbie
    Join Date
    Mar 2017
    Posts
    1

    Picking/ particle effect

    I have a bunch of spheres that i drew in open gl. I am trying to make it to where when the user clicks on one with the mouse it explodes. I am guessing i would use both picking and the particle effect for this?

    Any sources online that could help with the code would be great.

  2. #2
    Senior Member Regular Contributor
    Join Date
    May 2016
    Posts
    477
    Quote Originally Posted by drew21 View Post
    I have a bunch of spheres that i drew in open gl. I am trying to make it to where when the user clicks on one with the mouse it explodes. I am guessing i would use both picking and the particle effect for this?

    Any sources online that could help with the code would be great.
    it depends on how detailed (= complex) you want it to be:
    "explosion" effects can be done using a bunch of textures, which you have to render to a primitive on the screen sequentially, or you use a "geometry shader" in which you transform each face of a (lets say) sphere away from the sphere center, in addition to that you rotate each face randomly (to make it appear "real")
    https://learnopengl.com/#!Advanced-O...eometry-Shader

    particles can be simulated on the gpu using either "transform feedback" or "compute shader", otherwise you can do the particle simulation offline (on the cpu) which will be much slower
    (a transform feedback example is described in the book "OpenGL Programming Guide 8th Edition")
    https://www.google.com/#q=transform+...ck+particles&*
    https://sites.google.com/site/john87...pute-shader/tu

    to determine the 3D position where to do the explosion effect, you can do "raycasting" or "picking", but there has to be a face under the cursor (otherwise you can only determine 2D position, without the depth)

Similar Threads

  1. Particle effect positioned with a projectionmatrix
    By rhunter in forum OpenGL: GLSL
    Replies: 11
    Last Post: 01-10-2012, 06:40 AM
  2. Z-buffer picking, gluUnProject picking not working
    By Icetigris in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 07-29-2008, 10:38 AM
  3. Problem building a heat effect using a particle engine (with screenshots)
    By Alessandro_dup1 in forum OpenGL: Advanced Coding
    Replies: 42
    Last Post: 05-04-2004, 05:23 PM
  4. Particle FX
    By eror in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 04-05-2004, 03:03 AM
  5. Cool spark/particle effect demo
    By Punchey in forum OpenGL: Advanced Coding
    Replies: 29
    Last Post: 02-16-2001, 03:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean