• Advertisement
  • Popular Tags

  • Popular Now

  • Advertisement
  • Similar Content

    • By Kai Keeper
      I finished this game a while ago, now I'm trying to make an introduction video before I put it on Steam, looking for feedback.
      I have already got some feedback from other people, and this is what they felt or some of the things I think the video doesn't do a good job: 1. I don't understand the core concept of the game. I think another video that explains the core concept of this game would be better.
      2. I feel that the video was too long, it showed way too many features.
      If you feel the same way, please let me know. If you have any other suggestions/feedback please don't hold back.
    • By fgp069
      Hi there, this is my first time posting, but have been a long-time lurker in this community. I am currently developing a 3D game engine using a deferred renderer and OpenGL.
      I have successfully implemented recursive portals (and mirrors) in my engine utilizing the stencil buffer to mask out regions of the screen. This solution is very favorable as I am able to have dozens of separate views drawn at once without needing to worry about requiring multiple G-buffers for each individual (sub)view. I also benefit with being able to perform post processing effects over all views, only needing to apply them over what is visible (one pass per-section with stencil masking for no risk of overdraw).
      Now presently I am pondering ways of dealing with in-game camera displays (for an example think of the monitors from Half-Life 2). In the past I've handled these by rendering from the camera's perspective onto separate render target, and then in the final shading pass applying it as a texture. However I was greatly disappointed with the performance and the inability to combine with post-processing effects (or at least the way I do presently with portals). Another concern being that I wish to have scenes containing several unique camera screens at once (such as a security CCTV room), without needing to worry about the associated vram usage of having several G-Buffers.
      I wanted to ask more experienced members of this community if it would be possible to handle them in a similar fashion as I do with portals, but with the difference being for them to be transformed so they take on the appearance of a flat 2D surface. Would anybody with a more comprehensive understanding of matrix maths be able to tell me if this idea is feasible or not, and if so could come up with a possible solution?
      I hope all this makes enough sense. Any possible insight would be greatly appreciated!
    • By GytisDev
      me and few friends are developing simple city building game with unity for a school project, think something like Banished but much simpler. I was tasked to create the path-finding for the game so I mostly followed this tutorial series up to episode 5. Then we created simple working system for cutting trees. The problem is that the path-finding is working like 90% of the time, then it get stuck randomly then there's clearly a way to the objective (tree). I tried looking for some pattern when it happens but can't find anything. So basically I need any tips for how I should approach this problem.
      Use this image to visualize the problem.
    • By FFA702
      I've been working on a small 3D game maker app for a while, but it's now shaping up to be a full fledged (albeit simple) all integrated 3d engine. I think it's promising in the sense that I've built the App I would want to use, and I can see people (mainly beginners) using it for a lot of applications. It has no name yet. I don't plan on making it open source or selling it. I'm just considering setting up a small website with some documentation and a download link. 
      What kind of license would I join with the tool given that:
      I want people to be able to use it freely
      I want to be completely free of responsibility
      I want to prevent people from removing, let's say (hypothetically, not sure how I'd go about this yet), a small banner advertising my software at startup from the application the software would produce
      The tool was developed in visual studio community 2017, using C# and a single external library, openTK
      Is there anything else I should think about ? Perhaps when naming it ?
      EDIT: Also, what about, let's say, a logo, or a design pattern (Artistically speaking) I would use throughout the program and the documentation to make it easily recognizable. How would I go about protecting that ?
      Thanks guys
    • By Orella
      I'm having problems rotating GameObjects in my engine. I'm trying to rotate in 2 ways.
      I'm using MathGeoLib to calculate maths in the engine.
      First way: Rotates correctly around axis but if I want to rotate back, if I don't do it following the inverse order then rotation doesn't work properly. 
      Rotate X axis 50 degrees, Rotate Y axis 30 degrees -> Rotate Y axis -50 degrees, Rotate X axis -30 degrees. Works.
      Rotate X axis 50 degrees, Rotate Y axis 30 degrees -> Rotate X axis -50 degrees, Rotate Y axis -30 degrees. Doesn't.

      void ComponentTransform::SetRotation(float3 euler_rotation) { float3 diff = euler_rotation - editor_rotation; editor_rotation = euler_rotation; math::Quat mod = math::Quat::FromEulerXYZ(diff.x * DEGTORAD, diff.y * DEGTORAD, diff.z * DEGTORAD); quat_rotation = quat_rotation * mod; UpdateMatrix();  } Second way: Starts rotating good around axis but after rotating some times, then it stops to rotate correctly around axis, but if I rotate it back regardless of the rotation order it works, not like the first way.

      void ComponentTransform::SetRotation(float3 euler_rotation) { editor_rotation = euler_rotation; quat_rotation = math::Quat::FromEulerXYZ(euler_rotation.x * DEGTORAD, euler_rotation.y * DEGTORAD, euler_rotation.z * DEGTORAD); UpdateMatrix();  }
      Rest of code:   
      #define DEGTORAD 0.0174532925199432957f void ComponentTransform::UpdateMatrix() { if (!this->GetGameObject()->IsParent()) { //Get parent transform component ComponentTransform* parent_transform = (ComponentTransform*)this->GetGameObject()->GetParent()->GetComponent(Component::CompTransform); //Create matrix from position, rotation(quaternion) and scale transform_matrix = math::float4x4::FromTRS(position, quat_rotation, scale); //Multiply the object transform by parent transform transform_matrix = parent_transform->transform_matrix * transform_matrix; //If object have childs, call this function in childs objects for (std::list<GameObject*>::iterator it = this->GetGameObject()->childs.begin(); it != this->GetGameObject()->childs.end(); it++) { ComponentTransform* child_transform = (ComponentTransform*)(*it)->GetComponent(Component::CompTransform); child_transform->UpdateMatrix(); } } else { //Create matrix from position, rotation(quaternion) and scale transform_matrix = math::float4x4::FromTRS(position, quat_rotation, scale); //If object have childs, call this function in childs objects for (std::list<GameObject*>::iterator it = this->GetGameObject()->childs.begin(); it != this->GetGameObject()->childs.end(); it++) { ComponentTransform* child_transform = (ComponentTransform*)(*it)->GetComponent(Component::CompTransform); child_transform->UpdateMatrix(); } } } MathGeoLib: Quat MUST_USE_RESULT Quat::FromEulerXYZ(float x, float y, float z) { return (Quat::RotateX(x) * Quat::RotateY(y) * Quat::RotateZ(z)).Normalized(); } Quat MUST_USE_RESULT Quat::RotateX(float angle) { return Quat(float3(1,0,0), angle); } Quat MUST_USE_RESULT Quat::RotateY(float angle) { return Quat(float3(0,1,0), angle); } Quat MUST_USE_RESULT Quat::RotateZ(float angle) { return Quat(float3(0,0,1), angle); } Quat(const float3 &rotationAxis, float rotationAngleRadians) { SetFromAxisAngle(rotationAxis, rotationAngleRadians); } void Quat::SetFromAxisAngle(const float3 &axis, float angle) { assume1(axis.IsNormalized(), axis); assume1(MATH_NS::IsFinite(angle), angle); float sinz, cosz; SinCos(angle*0.5f, sinz, cosz); x = axis.x * sinz; y = axis.y * sinz; z = axis.z * sinz; w = cosz; } Any help?
  • Advertisement
  • Advertisement

3D DirectDraw Create Surface access violation

Recommended Posts

Hello to all i have got a DirectX 8 game i am fixing all works well besides one DirectShow function that streams a video into a DirectDraw surface, I get an Access Violation error in ->CreateSurface...Can someone help me?. Thanks Here is the function.

create_stream(const char *file_path)
	IAMMultiMediaStream *local_stream_ptr;
    IAMMultiMediaStream *global_stream_ptr;
    IMediaStream *primary_video_stream_ptr; 
    IDirectDrawMediaStream *ddraw_stream_ptr; 
    IDirectDrawStreamSample *video_sample_ptr;
    LPDIRECTDRAWSURFACE video_surface_ptr;
    DDPIXELFORMAT ddraw_video_pixel_format;
	DDSURFACEDESC ddraw_surface_desc;
	RECT rect;
	int video_width, video_height;

	// Initialise the COM library.


	// Initialise the global variables.

	global_stream_ptr = NULL;
	primary_video_stream_ptr = NULL;
	ddraw_stream_ptr = NULL;
	video_sample_ptr = NULL;
	video_surface_ptr = NULL;

	// Create the local multi-media stream object.

	if (CoCreateInstance(CLSID_AMMultiMediaStream, NULL, CLSCTX_INPROC_SERVER, IID_IAMMultiMediaStream, (void **)&local_stream_ptr) != S_OK)

	// Initialise the local stream object.

	if (local_stream_ptr->Initialize(STREAMTYPE_READ, AMMSF_NOGRAPHTHREAD,NULL) != S_OK) {

	// Add a primary video stream to the local stream object.

	if (local_stream_ptr->AddMediaStream(ddraw_object_ptr, &MSPID_PrimaryVideo, 0, NULL) != S_OK) {

	// Add a primary audio stream to the local stream object, using the 
	// default audio renderer for playback.

	if (local_stream_ptr->AddMediaStream(NULL, &MSPID_PrimaryAudio, AMMSF_ADDDEFAULTRENDERER, NULL) != S_OK) {

	// Open the streaming media file.

	MultiByteToWideChar(CP_ACP, 0, file_path, -1, wPath, MAX_PATH);   
	if (local_stream_ptr->OpenFile(wPath, 0) != S_OK) {
		diagnose("Windows Media Player was unable to open stream URL %s", file_path);
	// Convert the local stream object into a global stream object.
	global_stream_ptr = local_stream_ptr;
	// Initialise the primary video stream, if it exists.
	if (global_stream_ptr->GetMediaStream(MSPID_PrimaryVideo, &primary_video_stream_ptr) != S_OK)  {
	        warning("Could not get the primary video stream");
	} else {
              warning("Get the primary video stream");
        if (primary_video_stream_ptr->QueryInterface(IID_IDirectDrawMediaStream,(void **)&ddraw_stream_ptr) != S_OK) {
	        warning("Could not obtain the DirectDraw stream object");
	  } else {
            warning("Obtain the DirectDraw stream object");
        // Determine the unscaled size of the video frame.

	if (ddraw_stream_ptr->GetFormat(&ddraw_surface_desc, NULL, NULL, NULL) != S_OK)  {
	        warning("Could not determine the unscaled size of the video frame");
	} else {
            warning("Determine the unscaled size of the video frame");
	video_width = ddraw_surface_desc.dwWidth;
	video_height = ddraw_surface_desc.dwHeight;

	// Create a DirectDraw video surface using the texture pixel format, but 
	// without an alpha channel (otherwise CreateSample will spit the dummy).

	memset(&ddraw_surface_desc, 0, sizeof(DDSURFACEDESC));
    ddraw_surface_desc.dwSize = sizeof(DDSURFACEDESC);
     ddraw_surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
    ddraw_surface_desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_SYSTEMMEMORY;
    ddraw_surface_desc.dwWidth = video_width;
    ddraw_surface_desc.dwHeight = video_height;
    ddraw_surface_desc.ddpfPixelFormat = ddraw_video_pixel_format;
	// Here i got acccess violation 
	if (ddraw_object_ptr->CreateSurface(&ddraw_surface_desc, &video_surface_ptr, NULL) != DD_OK)  {
	        warning("Could not create a DirectDraw video surface");
		} else {
            warning("Create a DirectDraw video surface");
	// Set the rectangle that is to be rendered to on the video surface.

	rect.left = 0;
 	rect.right = video_width;
 	rect.top = 0;
 	rect.bottom = video_height;

	// Create the video sample for the video surface.
	if (ddraw_stream_ptr->CreateSample(video_surface_ptr, &rect, 0, &video_sample_ptr) != S_OK) {
	        warning("Could not create the video sample for the video surface");
	} else {
          warning("Created the video sample for the video surface");
	// Create the event that will be used to signal that a video frame is
	// available.


	// Initialise the video textures now, since we already know the
	// dimensions of the video frame.

	init_video_textures(video_width, video_height, RGB16);
	warning("Surface started");

	streaming_video_available = true;

	// Get the end of stream event handle.


	// Return a success status.
    warning("Stream started");


Edited by Vic666

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement