Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 30 Nov 2009
Offline Last Active Apr 26 2016 10:05 AM

Topics I've Started

multiple vertex arrays and one shader program

18 November 2015 - 05:47 PM

Hello community,


I'm experimenting a bit with vertex arrays, buffers and shaders. Because there was an option in glGenVertexArrays() that i can generate more than 1 vertex array, so i thought why not using 1 vertex array for 1 object, 3 vertex arrays for 3 objects etc.


My plan:


  • Objects
    • arrays which stores vertexes, normals and colors
    • vertex array object generated with glGenVertexArray() and bound with glBindVertexArray()
    • vertex buffer, normal buffer and color buffer generated, bound and stored with glBufferData()
    • array for transformation matrix
    • shader program to be used (compiled, attached and linked in Renderer)
    • render function which binds vertex array and uses shader program of this object
  • Renderer
    • basic GL (glClearColor()) settings when rendering in window
    • array for viewing and projection matrix
    • vertex and fragment shader compiled
    • shader program attached with vertex and fragment shader
    • render loop which renders Objects

Programming everything in one go (like you see in any OpenGL 3.3+ Tutorial) works fine (beautiful cube), but I don't see any objects in the window with the same verteces, normals colors and shaders. Is it possible that I need to bind a vertex array so that i can link a shader program?



Triangle-AABB intersection test

30 August 2015 - 03:53 PM

I want to implement octrees where I store a (limited) number of triangles in each octree node. One triangle can exist in multiple nodes.


Before i can add it I need to figure out if the triangle intersects/overlays with the sub cube of the node. It is only necessary that a part of the triangle is inside that cube. Here are my querys I already implemented:


A triangle is (partly) inside an AABB if

  • at least one of the three corner points is inside AABB
  • at least one of the three edges intersects with at least one of six AABB planes

Now there is a third possibilty where a triangle intersects with the AABB, and that is if only the surface goes through one of the six planes. I know that 2 intersecting planes can form a line, but then I don't know how this might help me.


Do you have any ideas how to estimate the third possibility?


lg Chris


PS: follow me on my blog where I explain computer graphics in pure C++ (no OpenGL or DirectX)


One or multiple octrees

24 August 2015 - 08:14 AM

Hey guys,


I want to implement octrees in my hard coded raycasting/raytracing algorithm (no OpenGL or DirectX). I'm also able to load Wavefront OBJ files. But with more and more triangle meshes involved rendering takes longer and longer.


I think octrees are a good data structure for storing surfaces. I don't know which form of octrees is better.

  • one octree for the whole rendering scene
  • multiple octrees, one for each object

What's your opinion?


PS: Visit my blog where I explain computer graphics

Link: http://computergraphicsguide.blogspot.com/

Computer Graphics Guide

31 July 2015 - 11:06 AM

Hi everyone,


I'm writing a blog about computer graphics. I'm finally done with 2D and started with 3D.



  • nice graphics about theory and formulas
  • links to different sources
  • link to my repository to run program of topic
  • repository is pure C++ code and a Makefile, no graphic library (like OpenGL or DirectX) included

Graphic libraries run too many calculations in the background unseen by programmers or debuggers, that's why I offer my framework for more explanations.


Link: http://computergraphicsguide.blogspot.com/

I/O File new line problem

11 January 2013 - 05:02 AM

I'm working on a program to (en-)cipher files. With some experiments concerning I/O on Windows and Linux (later on Mac OS) I recognized a difference in file length. I heard that Windows uses 2 Bytes "\r\n" for new line while UNIX systems uses just 1 Byte "\n". I fear that my file (en-)ciphering program wouldn't be platform independent. Is there a way to avoid this?


Main problem: Person A uses Windows and cipher a file which he sends this file to Person B who uses UNIX.