Jump to content

  • Log In with Google      Sign In   
  • Create Account

Silverlan

Member Since 02 May 2013
Offline Last Active Yesterday, 02:32 PM

Topics I've Started

[PhysX] Allow players to slide down slopes / Controller contact callbacks

18 October 2014 - 10:21 AM

I know that PhysX already has a built-in function to allow character controllers slide down slopes, but I need a bit more control.

The problem is, with PxControllerNonWalkableMode::ePREVENT_CLIMBING_AND_FORCE_SLIDING it just seems to accelerate the controller more and more until it has reached the end of the slope. PxControllerNonWalkableMode::ePREVENT_CLIMBING on the other hand cancels out any up- or downwards velocity on the controller altogether, until the controller has left the slope.

 

I want the controller to be able to slide down, but affected by gravity.

To do that I need some sort of callback which allows me to retrieve whatever actor the player is standing on, as well as the normal of the triangle / surface.

Is there such a callback in PhysX, and if not, how can I achieve what I want to do?


Creating multiple OpenGL contexts with GLFW on different threads

17 September 2014 - 10:24 AM

I'm using GLFW 3.0.4.
I'm trying to improve my loading times by having all resources, including textures, loaded on a separate thread. Problem is, to actually use any opengl functions in a different thread, without blocking the main one, I need a separate opengl context as well.
GLFW doesn't seem to provide any functions to create an independent context, you can only create it in combination with a window. That's not much of a problem however, considering you can just hide it. The problem is this:

 

Note: This function may only be called from the main thread.

(http://www.glfw.org/docs/latest/group__window.html#ga5c336fddf2cbb5b92f65f10fb6043344)

 

So that path is basically down the drain.

 

Are there any alternatives for what I'm trying to do, or would I have to end up using a different library for creating the window/rendering context? If so, which one?


Vertices with multiple UV coordinates and glDrawElements()?

01 September 2014 - 01:00 AM

This is essentially the same problem as the one described in this thread, however, seeing as the thread was started in 2003, things may have changed by now.

 

Basically, the problem is that my model can have multiple UV coordinates for vertices which are used by more than one face.

I'm using glDrawElements, but I'd like to avoid having to duplicate my vertices, just to fill it up to correlate with my UV coordinates.

 

Is there a way to use a separate index buffer for the UV coordinates and use that in conjunction with the main index buffer for the vertices?

Or is there an alternative altogether?


[OpenAL Soft] Sounds cut off randomly

30 August 2014 - 05:35 AM

I'm using OpenAL Soft 1.16.0.

Everything's running fine, but for some reason my sounds keep getting cut off at either the beginning or the end (hard to tell). It's not really noticable for music and longer sounds, but it's a big problem for anything shorter than a second, e.g. footsteps:

 

The sounds themselves are definitely not the issue, I've grabbed the footstep sounds from another game for testing purposes to be sure and I've tried various different sounds from different sources.

It's not the format either, the same problem occurs regardless of whether I use .mp3, .wav or .ogg files.

 

What could be causing this problem?


OpenGL - glReadPixels returns incorrect values

26 August 2014 - 02:08 PM

I'm probably missing something obvious, but I can't find anything wrong with the code. It's for testing purposes, and all it's supposed to do is set the color of all pixels to white and read the pixel information. The result is an array full of 0s:

unsigned int frameBuffer;
glGenFramebuffers(1,&frameBuffer);
unsigned int texture;
unsigned int depthTexture;
glGenTextures(1,&texture);
glGenTextures(1,&depthTexture);

glBindFramebuffer(GL_FRAMEBUFFER,frameBuffer);
glBindTexture(GL_TEXTURE_2D,texture);

int w = 256;
int h = 256;

glTexImage2D(
	GL_TEXTURE_2D,
	0,
	GL_RGB,
	w,h,
	0,GL_RGB,
	GL_UNSIGNED_BYTE,
	0
);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE);
glFramebufferTexture2D(GL_FRAMEBUFFER,GL_COLOR_ATTACHMENT0,GL_TEXTURE_2D,texture,0);

glBindTexture(GL_TEXTURE_2D,depthTexture);
glTexImage2D(
	GL_TEXTURE_2D,
	0,
	GL_DEPTH_COMPONENT16,
	w,h,
	0,GL_DEPTH_COMPONENT,
	GL_FLOAT,
	0
);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE);
glFramebufferTexture2D(GL_FRAMEBUFFER,GL_DEPTH_ATTACHMENT,GL_TEXTURE_2D,depthTexture,0);

int status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
if(status == GL_FRAMEBUFFER_COMPLETE)
{
	unsigned char *pixels = new unsigned char[w *h *3];
	for(unsigned int i=0;i<(w *h *3);i++)
	pixels[i] = 255;
	glDrawPixels(w,h,GL_RGB,GL_UNSIGNED_BYTE,&pixels[0]);
	glReadPixels(0,0,w,h,GL_RGB,GL_UNSIGNED_BYTE,&pixels[0]);
	for(unsigned int i=0; i<(w *h *3); i+=3)
	{
		unsigned int r = pixels[i];
		unsigned int g = pixels[i + 1];
		unsigned int b = pixels[i + 2];
		std::cout<<i<<": "<<r<<","<<g<<","<<b<<std::endl;
	}
	delete[] pixels;
	int err = glGetError(); // No error reported
}
glBindTexture(0,GL_TEXTURE_2D);
glBindFramebuffer(0,GL_FRAMEBUFFER);

Disabling the depth test and removing the depth attachment doesn't help.

No errors reported and the frame buffer is fine. What's going on here?

PARTNERS