OpenGL update phase 2. Added GL_POLYGON support to renderer for the sake of complete customizability of render modes.

This commit is contained in:
mudlord 2007-11-14 06:47:15 +00:00
parent 4d3a628089
commit f60d88a54c
7 changed files with 47 additions and 7 deletions

View File

@ -180,6 +180,8 @@ BEGIN_MESSAGE_MAP(MainWnd, CWnd)
ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_RENDEROPTIONS_GLTRIANGLE, OnUpdateOptionsVideoRenderoptionsGltriangle)
ON_COMMAND(ID_OPTIONS_VIDEO_RENDEROPTIONS_GLQUADS, OnOptionsVideoRenderoptionsGlquads)
ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_RENDEROPTIONS_GLQUADS, OnUpdateOptionsVideoRenderoptionsGlquads)
ON_COMMAND(ID_OPTIONS_VIDEO_RENDEROPTIONS_GLPOLYGONS, OnOptionsVideoRenderoptionsGlpolygons)
ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_RENDEROPTIONS_GLPOLYGONS, OnUpdateOptionsVideoRenderoptionsGlpolygons)
ON_COMMAND(ID_OPTIONS_VIDEO_RENDEROPTIONS_SELECTSKIN, OnOptionsVideoRenderoptionsSelectskin)
ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_RENDEROPTIONS_SELECTSKIN, OnUpdateOptionsVideoRenderoptionsSelectskin)
ON_COMMAND(ID_OPTIONS_VIDEO_RENDEROPTIONS_SKIN, OnOptionsVideoRenderoptionsSkin)

View File

@ -209,6 +209,8 @@ class MainWnd : public CWnd
afx_msg void OnUpdateOptionsVideoRenderoptionsGltriangle(CCmdUI* pCmdUI);
afx_msg void OnOptionsVideoRenderoptionsGlquads();
afx_msg void OnUpdateOptionsVideoRenderoptionsGlquads(CCmdUI* pCmdUI);
afx_msg void OnOptionsVideoRenderoptionsGlpolygons();
afx_msg void OnUpdateOptionsVideoRenderoptionsGlpolygons(CCmdUI* pCmdUI);
afx_msg void OnOptionsVideoRenderoptionsSelectskin();
afx_msg void OnUpdateOptionsVideoRenderoptionsSelectskin(CCmdUI* pCmdUI);
afx_msg void OnOptionsVideoRenderoptionsSkin();

View File

@ -614,6 +614,20 @@ void MainWnd::OnUpdateOptionsVideoRenderoptionsGlquads(CCmdUI* pCmdUI)
pCmdUI->SetCheck(theApp.glType == 1);
}
void MainWnd::OnOptionsVideoRenderoptionsGlpolygons()
{
theApp.glType = 2;
if( theApp.display ) {
theApp.display->setOption( _T("glType"), theApp.glType );
}
}
void MainWnd::OnUpdateOptionsVideoRenderoptionsGlpolygons(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck(theApp.glType == 2);
}
void MainWnd::OnOptionsVideoRenderoptionsSelectskin()
{
#ifndef NOSKINS

View File

@ -418,8 +418,6 @@ void OpenGLDisplay::render()
GL_UNSIGNED_BYTE,
data );
if( theApp.glType == 0 ) {
glBegin( GL_TRIANGLE_STRIP );
@ -436,7 +434,9 @@ void OpenGLDisplay::render()
glVertex3i( theApp.surfaceSizeX, theApp.surfaceSizeY, 0 );
glEnd();
} else {
}
if(theApp.glType == 1)
{
glBegin( GL_QUADS );
glTexCoord2f( 0.0f, 0.0f );
@ -454,6 +454,25 @@ void OpenGLDisplay::render()
glEnd();
}
if(theApp.glType == 2)
{
glBegin( GL_POLYGON );
glTexCoord2f( 0.0f, 0.0f );
glVertex3i( 0, 0, 0 );
glTexCoord2f( (float)(width) / size, 0.0f );
glVertex3i( theApp.surfaceSizeX, 0, 0 );
glTexCoord2f( (float)(width) / size, (float)(height) / size );
glVertex3i( theApp.surfaceSizeX, theApp.surfaceSizeY, 0 );
glTexCoord2f( 0.0f, (float)(height) / size );
glVertex3i( 0, theApp.surfaceSizeY, 0 );
glEnd();
}
if( theApp.showSpeed ) { // && ( theApp.videoOption > VIDEO_4X ) ) {
char buffer[30];

View File

@ -1416,7 +1416,7 @@ void VBA::loadSettings()
glFilter = 1;
glType = regQueryDwordValue("glType", 0);
if(glType < 0 || glType > 1)
if(glType < 0 || glType > 2)
glType = 0;
filterType = regQueryDwordValue("filter", 0);

View File

@ -1555,6 +1555,7 @@ BEGIN
MENUITEM " Filter: Bilinear", ID_OPTIONS_VIDEO_RENDEROPTIONS_GLBILINEAR
MENUITEM " Vertex: Triangle", ID_OPTIONS_VIDEO_RENDEROPTIONS_GLTRIANGLE
MENUITEM " Vertex: Quads", ID_OPTIONS_VIDEO_RENDEROPTIONS_GLQUADS
MENUITEM " Vertex: Polygons", ID_OPTIONS_VIDEO_RENDEROPTIONS_GLPOLYGONS
MENUITEM SEPARATOR
MENUITEM "&VSync", ID_OPTIONS_VIDEO_VSYNC
MENUITEM "Triple Buffering", ID_OPTIONS_VIDEO_TRIPLEBUFFERING
@ -1645,7 +1646,7 @@ BEGIN
BEGIN
MENUITEM "&Simple 4x", ID_OPTIONS_FILTER_SIMPLE4X
MENUITEM SEPARATOR
MENUITEM "&HQ4x", ID_OPTIONS_FILTER_HQ4X, GRAYED
MENUITEM "&HQ4x", ID_OPTIONS_FILTER_HQ4X
END
END
POPUP "&Interframe Blending"

View File

@ -796,14 +796,16 @@
#define ID_OPTIONS_EMULATOR_REMOVEINTROSGBA 40331
#define ID_Menu 40332
#define ID_OPTIONS_VIDEO_RENDEROPTIONS_GLANISOTROPIC 40333
#define ID_OPTIONS_LINK_ENABLE 40335
#define ID_OPTIONS_LINK_ENABLE 40335
#define ID_RENDERAPI_VERTEX 40336
#define ID_OPTIONS_VIDEO_RENDEROPTIONS_GLPOLYGONS 40337
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 159
#define _APS_NEXT_COMMAND_VALUE 40336
#define _APS_NEXT_COMMAND_VALUE 40338
#define _APS_NEXT_CONTROL_VALUE 1269
#define _APS_NEXT_SYMED_VALUE 103
#endif