• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Archived

This topic is now archived and is closed to further replies.

PaulP

Semi Transparent front edges

4 posts in this topic

***WARNING OpenGL NEWBIE WARNING*** I have a small problem with my simple pyramid, after tyding up my code, i have now find that the nearest face of my test pyramid as become semi transpaent. I have switched on culling, but it is set to GL_BACK so the rearmost faces should be invisible so iam sure this is not the problem Any ideas as to why??? Thanks
0

Share this post


Link to post
Share on other sites
There is quite a bit as it is class based!!

This is a striped down version

But all of my Projection matrice and modelview matrices are within these 3 functions.

void CCamera::UpdateLocation(void)
{
CVector look;
look = m_vPos - m_vLook;
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(m_vPos.m_fX, m_vPos.m_fY, m_vPos.m_fZ,
look.m_fX, look.m_fY, look.m_fZ,
m_vUp.m_fX, m_vUp.m_fY, m_vUp.m_fZ);
}

void CCamera::UpdateLens(void)
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(m_fFov, m_fAspect, m_fNear, m_fFar);
glMatrixMode(GL_MODELVIEW);
}

void CCamera::SetViewPort(UINT width, UINT height)
{
if(height == 0)
height = 1;
m_fAspect = float(width)/float(height);
glViewport(0, 0, width, height);
}

and the initialisation code is in the following 2 functions

void CWinMain::OneTimeInit()
{
//Set the shading system to smooth
glShadeModel(GL_SMOOTH);

//set the backgraound colour to black
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

//prepare the depth buffer
glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);

//set the perspective correction to best
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);

//enable back face culling
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
}

bool CWinMain::InitOpenGLWindow(void)
{
//get the windows device context
m_hDC = GetDC(m_hWnd);
if(!m_hDC)
return false;

//setup the desired pixelformat structure
PIXELFORMATDESCRIPTOR pfd;
memset(&pfd, 0, sizeof(PIXELFORMATDESCRIPTOR));
pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
pfd.nVersion = 1;
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = 16;
pfd.cDepthBits = 16;
pfd.iLayerType = PFD_MAIN_PLANE;

//test the Desired pixel format
GLuint pixelformat = ChoosePixelFormat(m_hDC, &pfd);
if(!pixelformat)
return false;

//set the desired pixel format
if(!SetPixelFormat(m_hDC, pixelformat, &pfd))
return false;

//create the render context
m_hRC = wglCreateContext(m_hDC);
if(!m_hRC)
return false;

//set it to the window
if(!wglMakeCurrent(m_hDC, m_hRC))
return false;

return true;
}

The code initialisation is in the following order

CreateCamera() //pseudocode
CreateWindow() //pseudocode
OneTimeInit();
InitOpenGLWindow();
m_pCamera->SetViewPort(m_uWidth, m_uHeight);
m_pCamera->UpdateLens();


in the message loop i call the following code

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
m_pCamera->UpdateLocation();
glTranslatef(0.0f, 0.0f, -6.0f);
glBegin(GL_TRIANGLES);
glColor3f(1.0f, 0.0f, 0.0f);
glVertex3f( 0.0f, 1.0f, 0.0f);
glColor3f(0.0f, 1.0f, 0.0f);
glVertex3f(-1.0f,-1.0f, 1.0f);
glColor3f(0.0f, 0.0f, 1.0f);
glVertex3f( 1.0f,-1.0f, 1.0f);
glColor3f(1.0f, 0.0f, 0.0f);
glVertex3f( 0.0f, 1.0f, 0.0f);
glColor3f(0.0f, 0.0f, 1.0f);
glVertex3f( 1.0f,-1.0f, 1.0f);
glColor3f(0.0f, 1.0f, 0.0f);
glVertex3f( 1.0f,-1.0f, -1.0f);
glColor3f(1.0f, 0.0f, 0.0f);
glVertex3f( 0.0f, 1.0f, 0.0f);
glColor3f(0.0f, 1.0f, 0.0f);
glVertex3f( 1.0f,-1.0f, -1.0f);
glColor3f(0.0f, 0.0f, 1.0f);
glVertex3f(-1.0f,-1.0f, -1.0f);
glColor3f(1.0f, 0.0f, 0.0f);
glVertex3f( 0.0f, 1.0f, 0.0f);
glColor3f(0.0f, 0.0f, 1.0f);
glVertex3f(-1.0f,-1.0f,-1.0f);
glColor3f(0.0f, 1.0f, 0.0f);
glVertex3f(-1.0f,-1.0f, 1.0f);
glEnd();
SwapBuffers(m_hDC);

If anyone is willing to look at the whole lot (ony 2 classes) then email mne i will send them over

Thanks
0

Share this post


Link to post
Share on other sites
by semitransparent do u mean a piece of the front triangle has been ''cut away'' if so try making your near clipplane smaller or move the camera further away from the pyramid

http://members.xoom.com/myBollux
0

Share this post


Link to post
Share on other sites
No, i was getting a really weird effect, the certain triangles in the scene where being draw semi transaprent, lietraly!!

But i fixed it so thanks anyway, and no matter!!

for reference i was calling my one time scene init function before preparing the window for OpenGL, and it appears that it did not like being done this way. When i switched the function calls around so the render cotntext ect was initialised before the OpenGL preferences (such as GL_SMOOTH, and depth test stuff was set up it worked just fine!

But thanks anyway guys!!
0

Share this post


Link to post
Share on other sites