Jump to content

  • Log In with Google      Sign In   
  • Create Account


LordSputnik

Member Since 18 Jul 2008
Offline Last Active Aug 29 2012 06:52 AM
-----

Posts I've Made

In Topic: Embedded Help!

21 August 2012 - 03:09 PM

One used spaces, one used tabs:

[source lang="cpp"] This is a tabbed line. And another. This line has two spaces. And this line.[/source]


The spaces appear to get removed from the code when it's pasted, the tabs don't.

In Topic: Normalized Device Co-ordinates to World Space

18 August 2012 - 02:02 AM

Very sorry, I did mean world space - it was late and I was sleepy!

The only thing I can think it could be is the cml::transform_point function I'm using - I've assumed that this multiplies the input point by the matrix as gluUnProject does, but that might not be right. I'll try making a 4x1 matrix containing the values plus the 1 at the bottom, and use straightforward matrix multiplication.

In Topic: glVertexPointer, glNormalPointer, and glTexCoordPointer deprecated? Correct use?

17 August 2012 - 04:15 PM

As far as I know there's no way of mixing int and float data. You, can certainly use two different arrays though. You can't however just use 0 and 1 as your array handles - you need to use glGetAttribLocation with the name of your attribute variable in the shader to be able to upload the data.

For example:

In vertex shader (GLSL):
attribute vec4 position;
attribute ivec4 some_other_attrib;

//do some stuff in main

In C/C++:
GLint pos_id = glGetAttribLocation(shader_program_id,"position");
GLint other_id = glGetAttribLocation(shader_program_id,"some_other_attrib");

glBindBuffer(GL_ARRAY_BUFFER, positionVBO);
glEnableVertexAttribArray(pos_id);
glVertexAttribPointer(pos_id, VERTEX_STRIDE, GL_FLOAT, GL_FALSE, 0, 0);

glBindBuffer(GL_ARRAY_BUFFER, intVBO);
glEnableVertexAttribArray(other_id);
glVertexAttribPointer(other_id, VERTEX_STRIDE, GL_INT, ..., 0);

If you can, try not to ever use the fixed function pipeline anymore. Shaders are supported on all modern cards and have been for ages, and allow you to do a lot more than FFP. If a card doesn't support vertex and fragment shaders, well, that's the end user's fault for not upgrading their machine in 8 years.

Note: I've used similar code to this in a project recently, but I only really learnt it for that, so if something's wrong, someone correct me! ;)

In Topic: Calculating Tangent and Bitangent

09 September 2010 - 05:20 AM

Anyone have any ideas? :S *bump*

In Topic: Problem with getting pixel pos from depth

30 August 2010 - 03:19 AM

This may help you:

topic_id=579762

Sput

PARTNERS