Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Rotation of a specific 3d object / GLSL

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2012

    Rotation of a specific 3d object / GLSL

    Hey Guys,

    I am trying to do my first simple house opengl project and add the rotation functionality to the door. I did construct the door as a cube. My house includes couples of cubes and I only want rotate the door. I am trying to do this via shader but got stuck in a problem.

    I could pass the whole vertex arrays to vertex shader and therefore rotate the whole house. But, it is not exactly what I am looking for. In fact, I am required to rotate the door. I am trying to find a way to separate the door cube vertex arrays in shader itself and apply rotation on the specific set of vertex arrays and not the whole.

    long for some cool advice

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Vertex shaders only know about a vertex not the whole object - remember what a gpu is - it is a set of parallel process each of which can execute completely independant of the others. So to rotate some vertices and not others, each vertex will have to identify what it belongs to - you can do this but it is a waste of gpu memory. Instead have 2 element (index) buffers and a common vertex buffer. One index buffer only indexes triangles for the door - the other indexs the door and house. Then bind different index buffers depending on what you want to render.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts