Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Joey P

Member Since 29 Jun 2012
Offline Last Active Jul 08 2012 04:28 AM

Posts I've Made

In Topic: Rajawali Engine - anyone used it?

06 July 2012 - 08:35 PM

Pretty sure that's what he means -- so instead of parsing an ASCII OBJ file at runtime and filling in your VBO, you simply memcpy your binary file straight into your VBO without any parsing or processing required at load time.

Yes, this is much preferred, do you know of any tutorials with source for doing this?

In Topic: I can't understand matrices

06 July 2012 - 07:36 PM

The matrices convert points in world coordinates to points in screen coordinates.

The projection matrix takes vertices in 3d geometry and projects them onto your 2d screen. Every frame each vertex is multiplied by the projection matrix to determine its 2d coordinates on screen.

Before this however, the model view matrix is used to convert vertices from object coordinates into world coordinates relative to your view. So if you are rendering a cube for example and you define the center of the cube to be point 0,0,0 in object coordinates, and one of the corners is 1,1,-1, and then it is positioned 12 units in front of your camera, and 5 units up, the model view matrix determines the coordinate of the vertex relative to your camera position, ie what the vertex would be if your camera was 0,0,0.

You can work with the model matrix and view matrix separately, which I prefer, but some versions of OpenGL (like OpenGL ES 1.0) don't allow this. In the end you'll pass only the combined MVP matrix to your shader.

The glPerspective and glFrustrum methods are used to determine the view matrix for you. Use glPerspective if you want to specify a horizontal and vertical FOV.

The "planes" you're talking about are near and far clipping planes, they just determine how far and close you should be able to see objects. So if you specify a far clipping plane of 100, you won't be able to see any objects more than 100 units from the camera (ever wonder why old games use fog?) The farther you set the far clipping plane, the farther away you'll be able to render objects, but if you set it too far out OpenGL will have a harder time determining which objects should be in front of eachother.

In Topic: Help! My directional light gets rotated along with my meshes :(

01 July 2012 - 08:32 PM

Thanks, that helped, although it's still doing some slightly goofy things... I'll just have to start stepping through code

In Topic: Help! My directional light gets rotated along with my meshes :(

01 July 2012 - 06:12 PM

First I would suggest writing these in a normal text editor and reading the shader in instead of how you have it. That is pretty ghetto.

Yes, I was going to be getting to that eventually. This is still just a test app / for learning.

Second:
v_Color[0] = a_Color[0] * diffuse; \n"
+ " v_Color[1] = a_Color[1] * diffuse; \n"
+ " v_Color[2] = a_Color[2] * diffuse; \n"
+ " v_Color[3] = a_Color[3];

v_Color = a_Color*diffuse; //write this instead!

But I don't want the alpha channel attenuated. If I did it that way I'd be able to see through the meshes.

Third, If you are passing in the sun vector, is it changing? Try:
vec3 nSunVector = normalize(vec3(1,1,1));

The sun vector changes very slowly over time but at the moment I'm just passing in constants for testing so it isn't that...

My problem is, I'm lighting the surfaces in world space before doing the rotations and transforming them, I know what I'm doing wrong, I just can't figure out how to do it right...

In Topic: [Open GL ES 2.0] Set camera position with SetLookAtM() giving goofy results

30 June 2012 - 03:50 PM

Sounds like you expect the look vector to be the direction you want to view in but it is in fact the point you want to look at. I don't know if that's the case or not since I don't know the particular function you use, but that is how gluLookAt, and most other look at-functions i have seen, works.


Oh snap, you are right, I am passing in my direction vector into the values of lookX, lookY, and lookZ. And I'm passing in my position vector to the values eyeX, eyeY and eyeZ.

So I just changed it to
[source lang="java"]Matrix.setLookAtM(mViewMatrix, 0, eyeX, eyeY, eyeZ, eyeX + lookX, eyeY + lookY, eyeZ + lookZ, upX, upY, upZ);[/source]

And it works now :D

PARTNERS