Click here to Skip to main content
12,076,216 members (41,181 online)
Click here to Skip to main content
Articles » Multimedia » DirectX » General » Downloads

Tagged as

Stats

95.3K views
4.7K downloads
40 bookmarked
Posted

Interactive 3D Spectrum Analyzer Visualization for Windows Media Player

, 17 May 2009 CPOL
Interactive 3D Spectrum Analyzer for Windows Media Player using DirectX 9 and some light GPGPU.
#pragma once
#include "glrendercontext.h"
#include "FreqDataBuff.h"
#include "windef.h"
#include <GL/gl.h>
#include <GL/glu.h>

#define HYTEQ_API_PTR APIENTRY *
#define GL_ARRAY_BUFFER                   0x8892
#define GL_READ_ONLY                      0x88B8
#define GL_WRITE_ONLY                     0x88B9
#define GL_READ_WRITE                     0x88BA
#define GL_BUFFER_ACCESS                  0x88BB
#define GL_BUFFER_MAPPED                  0x88BC
#define GL_BUFFER_MAP_POINTER             0x88BD
#define GL_STREAM_DRAW                    0x88E0
#define GL_STREAM_READ                    0x88E1
#define GL_STREAM_COPY                    0x88E2
#define GL_STATIC_DRAW                    0x88E4
#define GL_STATIC_READ                    0x88E5
#define GL_STATIC_COPY                    0x88E6
#define GL_DYNAMIC_DRAW                   0x88E8
#define GL_DYNAMIC_READ                   0x88E9
#define GL_DYNAMIC_COPY                   0x88EA
#define GL_SAMPLES_PASSED                 0x8914

typedef void (HYTEQ_API_PTR PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer);
typedef void (HYTEQ_API_PTR PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers);
typedef void (HYTEQ_API_PTR PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers);
typedef GLboolean (HYTEQ_API_PTR PFNGLISBUFFERARBPROC) (GLuint buffer);
typedef void (HYTEQ_API_PTR PFNGLBUFFERDATAARBPROC) (GLenum target, ptrdiff_t size, const GLvoid *data, GLenum usage);
typedef void (HYTEQ_API_PTR PFNGLBUFFERSUBDATAARBPROC) (GLenum target, ptrdiff_t offset, ptrdiff_t size, const GLvoid *data);
typedef void (HYTEQ_API_PTR PFNGLGETBUFFERSUBDATAARBPROC) (GLenum target, ptrdiff_t offset, ptrdiff_t size, GLvoid *data);
typedef GLvoid* (HYTEQ_API_PTR PFNGLMAPBUFFERARBPROC) (GLenum target, GLenum access);
typedef GLboolean (HYTEQ_API_PTR PFNGLUNMAPBUFFERARBPROC) (GLenum target);
typedef void (HYTEQ_API_PTR PFNGLGETBUFFERPARAMETERIVARBPROC) (GLenum target, GLenum pname, GLint *params);
typedef void (HYTEQ_API_PTR PFNGLGETBUFFERPOINTERVARBPROC) (GLenum target, GLenum pname, GLvoid* *params);

class GLSpectrumRender :
	public GLRenderContext
{
public:
	GLSpectrumRender();
	~GLSpectrumRender();

	void Initialize();
	void Destroy();
	void SubmitData(unsigned char* pucLeft, unsigned char* pucRight, HDC dc);

protected:
	void Render(HDC hDC);
	static void Run(void* context);

protected:
	bool	m_bAllowedToRender;
	bool	m_bIsRunning;
	bool	m_bIsInitialized;
	GLuint	m_rgbColors;
	GLuint	m_xyzVertices;

	HANDLE	m_hRenderThread;
	FreqDataBuff m_buffer;

	PFNGLBINDBUFFERARBPROC           glBindBuffer;
	PFNGLDELETEBUFFERSARBPROC        glDeleteBuffers;
	PFNGLGENBUFFERSARBPROC           glGenBuffers;
	PFNGLISBUFFERARBPROC             glIsBuffer;
	PFNGLBUFFERDATAARBPROC           glBufferData;
	PFNGLBUFFERSUBDATAARBPROC        glBufferSubData;
	PFNGLGETBUFFERSUBDATAARBPROC     glGetBufferSubData;
	PFNGLMAPBUFFERARBPROC            glMapBuffer;
	PFNGLUNMAPBUFFERARBPROC          glUnmapBuffer;
	PFNGLGETBUFFERPARAMETERIVARBPROC glGetBufferParameteriv;
	PFNGLGETBUFFERPOINTERVARBPROC    glGetBufferPointerv;
};

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Carlo McWhirter
Software Developer (Senior) Hyteq Systems
United States United States
I'm a Microsoft Certified Professional (MCP) in C++. I'm fluent in C/C++, C# and many other languages.

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.160208.1 | Last Updated 17 May 2009
Article Copyright 2009 by Carlo McWhirter
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid