Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


ic0de

Member Since 11 Nov 2010
Offline Last Active Dec 12 2014 08:07 PM

#5011858 Blender and Directx10 c++

Posted by ic0de on 17 December 2012 - 06:05 PM

Or apparently learn the poorly documented Assimp API?


Really? poorly documented? I found their documentation very useful. All you have to do is load the data using a single call to assimp and then you have a fairly transparent structure that holds all your data. Like so:
Assimp::Importer importer;
const aiScene* scene = importer.ReadFile("file.obj", flags);

Then you can grab vertex positions from that same structure like so:
xpos = scene->mMeshes[0]->mVertices[i].x;
ypos = scene->mMeshes[0]->mVertices[i].y;
zpos = scene->mMeshes[0]->mVertices[i].z;



#5011854 Why is ray tracing slow?

Posted by ic0de on 17 December 2012 - 05:46 PM

Correct me if I'm wrong, but isn't it hundreds of times faster to do raytracing operations through the GPU? I haven't gone that low level yet with graphics stuff, but from other stuff I've seen that utilizes GPU, it seems like it'd be the optimal choice.


This is true however even GPU raytraycing is too slow for realtime. I have seen raytracers that can run on the gpu fast enough for games but to get it to run this fast its nerfed to a point where you can easily get better looking graphics using conventional rendering.


#5010979 Communications via Textures

Posted by ic0de on 15 December 2012 - 10:47 AM

Just to be clear, the texture_location, normal_texture_location and height_texture_loc are the locations of 'sampler2D' uniforms, right?


thats it exactly


#5010966 Communications via Textures

Posted by ic0de on 15 December 2012 - 09:44 AM

Thanks. So when I do that, how do I access each individual texture from a GLSL fragment shader?


you will have two uniform sampler2Ds in your fragment program and you will access each with the stander texture2D function the only difference is that you will have two uniforms instead of one. You will send textures to your shader like so:
//Sample code used for normal mapping
glActiveTexture(GL_TEXTURE0);
glUniform1i(texture_location, 0);
glBindTexture(GL_TEXTURE_2D, dTex);


glActiveTexture(GL_TEXTURE1);
glUniform1i(normal_texture_location, 1);
glBindTexture(GL_TEXTURE_2D, dNorm);

glActiveTexture(GL_TEXTURE2);
glUniform1i(height_texture_loc, 2);
glBindTexture(GL_TEXTURE_2D, dHeight);

and use them like so

//simple multiplicative blending example
varying vec2 texCoord;

uniform sampler2D texture1;
uniform sampler2D texture2;
uniform sampler2D texture3;

void main()
{
vec4 sample1 = texture2D(texture1, texCoord);
vec4 sample2 = texture2D(texture2, texCoord);
vec4 sample3 = texture2D(texture3, texCoord);

gl_FragColor = sample1 * sample2 * sample3;
}



#5009310 dramatic fps drop when using transparent texture

Posted by ic0de on 10 December 2012 - 10:22 PM

Why are you using GL_POLYGON? you seem to be using just quads replacing GL_POLYGON with GL_QUADS should be faster. Also get rid of those extra glbegin/glend's in between each face.


#5008931 Is Audio Data Represented By Notes MIDI-Only?

Posted by ic0de on 09 December 2012 - 06:52 PM

I use SDL I can write into the audio buffer and generate tones. Probably not worth to move your game into SDL unless your game is already using SDL for other stuff.


#5008272 Is Audio Data Represented By Notes MIDI-Only?

Posted by ic0de on 07 December 2012 - 05:34 PM

If you are programming this in a high level language like C++ or Java, you can use the included classes for sound file playback. If you want to synthesize the sound in real time there are a few audio libraries out there that can do that too. It would really help to know what language/IDE you are using.


considering he tagged winapi one can infer that he's on windows and is probably using c or c++


#5008267 help for creating a 3D landscape like this one (OpenGL+Java)

Posted by ic0de on 07 December 2012 - 05:16 PM

Do you want to load just a basic mesh and display it or do you want to do something cool and construct it from a heightmap or something? How are you using opengl in java is it JOGL or lwjgl or something else? If your using the heightmap way what you want to do is load a grayscale image in a way that you can address each pixel and ill give you some psuedocode:

int vertindex;
for(int x = 0; x < image.w; x++)
{
	 for(int y = 0; y < image.h; y++)
	 {
		  vertices[vertindex*3] = x; //vertex x-coordinate
		  vertices[1 + vertindex*3] = y; //vertex y-coordinate
		  vertices[2 + vertindex*3] = image.pixels[x][y]; //vertex z-coordinate
		  vertindex += 1;
	 }
}
glEnableClientState(GL_VERTEX_ARRAY);
unsigned int vBuffer;
glGenBuffers(1, &vBuffer);
glBindBuffer(GL_ARRAY_BUFFER, vBuffer);
glBufferData(GL_ARRAY_BUFFER, vertindex  * 3 * sizeof(float), vertices, GL_STATIC_DRAW);
glVertexPointer(3, GL_FLOAT, 0, 0);
glDrawArrays(GL_LINES, 0, vertindex);

That's basically how you do it in psuedomodern opengl.

Legacy opengl is a bit easier but is reeeeaaaaly slow:

int vertindex;
glBegin(GL_LINES);

for(int x = 0; x < image.w; x++)
{
	 for(int y = 0; y < image.h; y++)
	 {
		  glVertex3f(x, y, image.pixels[x][y]);  
	 }
}
glEnd();

attached is a sample heightmap

Attached Thumbnails

  • perlin.png



#5004412 The best way to texture a 3d model?

Posted by ic0de on 26 November 2012 - 10:02 PM

http://cgcookie.com/...ntro_uvmapping/


that helped allot. thanks.


#5003788 Whats a reasonable timestep

Posted by ic0de on 24 November 2012 - 12:25 PM

Wow this is embarrassing, turns out that bullet does most of this heavy lifting for me, all I needed to do was pass the time since the last update. My efforts to control the timestep seemed to do nothing but compound the problem.

http://bulletphysics.org/mediawiki-1.5.8/index.php/Stepping_The_World


#5001905 Impotant! Books to start learning video game programming ! I need it...

Posted by ic0de on 17 November 2012 - 07:29 PM

You will need a lot of time and patience, but after a 5+ years, you should be able to program almost everything you wish (but be aware that the time needed to do it will still be in years).


5+ years, That's ridiculous. I started programming not much older than him and I picked up C++ in a year, a year later I was writing full blown 3d games in C++. My advice is skip C# and spend a while getting to know C++ and you should be able to program almost anything in 2+ years if you work hard.


#4996637 How to store the objects in my world

Posted by ic0de on 02 November 2012 - 01:25 PM

Right now in my game engine I store my objects in an array whose size is defined at load time. This is all well and good but what do I do when an object is added during runtime like using some kind of spawner, the array would have to expand and this is slow. Ideally I would have something similar to Bullet Physics where I can do:

dynamicsWorld->addRigidBody(body);

How would something like that work? I never defined a specific size. Does it use a container class from STL?


#4994559 Whats the deal with OpenAL?

Posted by ic0de on 27 October 2012 - 04:19 PM

So OpenAL used to be LGPL but is now proprietary. I don't get how they can just change the licence like that. Is OpenAL still free to use? There appear to be other compatible implementations that are open source, is it just Creative's implementation of OpenAL that's closed source or is it the whole standard? Should I use one of these open source implementations, should I use an earlier version? (I'm not an opensource freak but I don't like it when other companies control parts of my game)


#4994262 Best language to code my game

Posted by ic0de on 26 October 2012 - 03:10 PM

Whenever I see a title like this I know I'm stepping into a minefield. But here it goes.

If you know Java and C then C++ will be pretty trivial to learn. Add a library like SDL and you're good to go. SDL does sound, input, graphics, networking and much more.


#4991955 GLSL Support on Graphics Cards

Posted by ic0de on 19 October 2012 - 03:55 PM

As I wrote, "[u]nfortunately, I don't have the laptop in this state to test", otherwise it would be trivial.


http://feedback.wildfiregames.com/report/opengl/device/GeForce%208400GS

bam! capabilities of opengl 8400gs




PARTNERS