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.
- Viewing Profile: Posts: LordSputnik
Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics
Community Stats
- Group Members
- Active Posts 97
- Profile Views 473
- Member Title Member
- Age 19 years old
- Birthday August 19, 1993
-
Gender
Male
132
Neutral
User Tools
Contacts
LordSputnik hasn't added any contacts yet.
Latest Visitors
No latest visitors to show
Posts I've Made
In Topic: Embedded Help!
21 August 2012 - 03:09 PM
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.
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):
In C/C++:
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! ;)
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! ;)
- Home
- » Viewing Profile: Posts: LordSputnik

Find content