Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 26 Oct 2011
Offline Last Active Yesterday, 06:42 AM

Topics I've Started

bounding box culling with just model view projection matrix

02 October 2013 - 03:02 AM



i'm trying to implement culling in my project. for various reasons at the point that i can make a draw decision and want to test if i should cull the geometry i have the following available to me


1. a bounding box of the geometry in question

2. the model view projection matrix that will be sent to the shader.


i really have no other information in which to base a decision on.



my current algorithm is similiar to (pseudocode)

for(int i = 0 ; i < 7 ; i++)
    testCorner[i] = boxCorner[i] * mvpMatrix;
    testCorner[i].x /= testCorner[i].w;
    testCorner[i].y /= testCorner[i].w;
    testCorner[i].z /= testCorner[i].w;

bool clipMe = true;
for(int i = 0 ; (i < 7) && (clipMe == true) ; i++)
    if(testCorner[i].z > 0.0)
        if(testCorner[i].x > -1 && testCorner[i].x < 1)
            clipMe = false;
        if(testCorner[i].y > -1 && testCorner[i].y < 1)
            clipMe = false;

However i find that sometimes a piece of geometry that should not get clipped will get clipped. Has anyone else used a method similiar to this before? Anyone can point me toward what i'm doing wrong?


very much appreciated.

glUniform and 1 large buffer

23 June 2013 - 07:06 PM

Directx 11 has a very nice (from my pov) way to deal with shader parameters via the constant buffer.  it seems to me that it would be really cool if i could do the same thing in opengl

ie. just pass for example 200 bytes of float data and have it fill a struct that is 200 bytes long in the shader. ok... i get it the data im transfering to the shader might not be 200 bytes for that GPU etc etc etc.


however setting (for example) 30 uniform values for every uniform in the shader seems slow. is there an extention that would behave similiar to directx?


thanks for reading 

HW accel Matrices on android (NDK)

08 June 2013 - 11:34 PM

on windows/directx i have XMMATRIX. on ios i have GLKit and GLKMATRIX. i can't seem to find a hardware accelerated matrix library (for example on armv7 uses NEON extension for matrix multiply) for android that i can use on the C++/NDK side. anyone have any recommendations?


thanks a bunch.

ES 2.0 glShaderBinary/glShaderSource

28 May 2013 - 10:50 PM

Ok, it just dawned onto me now that glShaderSource may not be supported on a platform (from what i've seen it always is) it also seems glShaderBinary is optional, also openGL doesn't have a way for you to generate your shader binary offline.


I would like to be a defensive programmer here however...

it seems i have to rely on glShaderSource being supported on a system. am i correct here?


if god forbid glShaderSource and glShaderBinary are unsupported on a ES 2.0 chip, how exactly am i suppose to generate a shader and/or load it onto the card?



render texture smaller then screen

02 May 2013 - 02:09 AM

currently using direct x 11

i'm trying to generate a render texture smaller then the screen size, and then stretch it across the entire screen.


my problem is that the texture is only taking up the equivalent amount of space on the screen.

I.E. is i make my render texture 1/2 the width, height of the screen, then when i render it to the screen it will appear in 1/4 the screen.

my pixel/vertex shader are in screen coordinates.


does anyone have a clue what might be going on? or an example for making render textures smaller then the screen? my render texture works perfectly if the render texture size is the same as the screen size.