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.

Similar Threads

  1. Rotation of object
    By mamata patil in forum OpenGL: Linux
    Replies: 2
    Last Post: 05-27-2018, 04:40 AM
  2. Rotation of an object by rotation matrix
    By MrFoil in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 03-02-2015, 04:41 PM
  3. Object Rotation
    By Vincent22 in forum OpenGL: GLSL
    Replies: 4
    Last Post: 11-11-2011, 08:04 AM
  4. Replies: 6
    Last Post: 05-20-2004, 11:56 PM
  5. Specific way to implement hiden object culling
    By Montserrat in forum OpenGL: General
    Replies: 14
    Last Post: 03-13-2002, 05:22 AM

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