Opengl Es Matrix Help


habib15

Still Fresh
Joined
Mar 17, 2008
Messages
47
I am having trouble with my transformation Matrix operations. I basically want to just display a cube in a display with a translation and projection matrix applied to it. I think I have something wrong with my Matrix operations code so I would like it if someone could post output matrices at each step so I can verify which areas in my code are affected.

1) Load Identity Matrix in Model view and Projection matrix

2)Create Projection matrix with 60deg field of view, aspect=640/480, nearz=1, farz=20

3) Translate Model view to (0,0,-2)

4)Apply Projection matrix to Model view matrix

And if anyone want to go the extra mile it would be great to have a picture posted of what the cube should look like projected in this kind of window.

Thanks in advance for your help
 
CODE

glMatrixMode(GL_PROJECTION);
glLoadIdentity();

glFrustumf(-.5f, .5f, -.5f * 480.f / 640.f, .5f * 480.f / 640.f, 1.f, 20.f);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

glTranslatef(0.f, 0.f, -2.f);



what you'll see from the above transformation setup is a cube face-on with your view plane (ie. screen), assuming your cube is defined as spanning [-1, 1] along each axis. last but not least, beware of your culling, lest you don't see anything.
 
Never mind...
My problem was not properly binding my vertices to the right attribute location for the vertex shader.
Wow don't do that one because your object will display but it will look all deformed or out of place making you think your matrices are wrong.

Sorry for the unnecessary thread but isn't that how it always goes, as soon as you ask for help you figure it out yourself.

Darkblu thanks for the help too.
 
Kevin_H said:
Never mind...
My problem was not properly binding my vertices to the right attribute location for the vertex shader.
Wow don't do that one because your object will display but it will look all deformed or out of place making you think your matrices are wrong.
heh. just wait till you get to skinning techniques with mis-assigned bones. then it becomes really disturbing.
 
Last edited by a moderator:
I have a new question now, I hope some one will see this.

Is there anyway to implement glBitmap in opengl es? I would basically like to just throw a bitmap up on the screen at a x,y coordinate without having to create a texture mapped quad.

Ultimately I would like to use this to create freetype font rendering capabilities. I want to be able to use the freetype library to generate texture mapped fonts, simple bitmap fonts (ie. Write "Hello World" in Arial at (x,y)), and 3D extruded fonts. There are tutorials to implement texture mapped, so I'm pretty confident I can get that working but there is not much out there for opengl es for the later 2.

Any Ideas?

Thanks

Kevin
 
Kevin_H said:
Is there anyway to implement glBitmap in opengl es? I would basically like to just throw a bitmap up on the screen at a x,y coordinate without having to create a texture mapped quad.

No, but drawing a textured quad is easy enough and you should be able to achieve the same result without much trouble.
 
Last edited by a moderator:
Last edited by a moderator:
It can be, but don't forget that DrawTex only lets you draw a single rectangle at a time which might be inefficient, and that it's not available in OpenGL ES 2.0.
 
Back
Top