Jump to content

  • Log In with Google      Sign In   
  • Create Account

gurps

Member Since 31 Jul 2012
Offline Last Active Aug 03 2012 07:53 PM

Posts I've Made

In Topic: How to draw a full screen quad and still see the objects behind it

31 July 2012 - 02:15 PM

Winding Order

World Space vs. Screen Space
Your quad is showing up small because you've got it drawing in the range of -1 to 1 at the origin of your scene. To make it draw over the entire scene, you either need to move it along with your camera and make it bigger, or you need to draw it in screen space using pre-transformed primitives. Given that you're not familiar with winding order, I'm going to guess that pre-transformed primitives is beyond you. So for now, make sure you specify the points of the quad as being just in front of your camera, and large enough that it covers the display area. It's not the correct approach, but it'll work for now.

Cheers and good luck!


Thanks for the detailed reply.

How do I specify the size and position of the QUAD?

In Topic: How to draw a full screen quad and still see the objects behind it

31 July 2012 - 01:22 PM

In the intro screen section of your code you're drawing your quad with a counter-clockwise winding order. When you draw the red quad in your game-play section you're drawing the quad in a clockwise order. I suspect your quad is being treated as a back-facing primitive and is being culled out. Either switch the winding order or disable back-facing culling to verify.

Cheers and good luck!


Thank you for the reply...can you please explain more about the winding order as i've never heard of that? Anyway i commented out where i enabled back face culling and a small black square was rendered.
Posted Image

Where do i go from here?

In Topic: How to draw a full screen quad and still see the objects behind it

31 July 2012 - 12:56 PM

Thanks for the reply..but no red quad being drawn.

[source lang="cpp"]void RenderScene() { // Give OpenGL our camera position glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer glLoadIdentity(); g_Camera.Look(); CVector3 vPos = g_Camera.Position(); CVector3 vNewPos = vPos; CVector3 vView = g_Camera.View(); if (introScreen == true) { GLTexture tex; tex.Load("Intro.bmp"); tex.Use(); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); glBegin(GL_QUADS); glTexCoord2f(0.0, 0.0); glVertex3f(-1.0f, -1.0f, -1.5f); glTexCoord2f(1.0, 0.0); glVertex3f(1.0f, -1.0f, -1.5f); glTexCoord2f(1.0, 1.0); glVertex3f(1.0f, 1.0f, -1.5f); glTexCoord2f(0.0, 1.0); glVertex3f(-1.0f, 1.0f, -1.5f); glEnd(); glPopMatrix(); //If we are on an introscreen, we can render it here, else... } else { drawText(TimerText, 15, 25); //Draw text for the timer char xPos[100], yPos[100], zPos[100]; sprintf_s(xPos, "Camera X: %f", g_Camera.Position().x); sprintf_s(yPos, "Camera Y: %f", g_Camera.Position().y); sprintf_s(zPos, "Camera Z: %f", g_Camera.Position().z); drawText(xPos, 15, 45); drawText(yPos, 15, 65); drawText(zPos, 15, 85); perimeterCheck(); sprintf_s(LivesHUD, "Coins Collected: %d", CoinsCollected); drawText(LivesHUD, 15, 105); // Render the terrain as a simple quad - currently it is flat but it could be made into a terrain with a heightmap! RenderQuadTerrain(); //Draw the skybox CreateSkyBox(vNewPos.x, vNewPos.y, vNewPos.z,3500,3000,3500); DrawCoins(); CollisionTest(g_Camera.Position().x, g_Camera.Position().y, g_Camera.Position().z); DrawEnemy(); DrawEnemy1(); //Draw SecondaryObjects models DrawSecondaryObjects(); //Apply lighting effects LightingEffects(); escapeAttempt(); glEnable(GL_BLEND);glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // additive blendingfloat blendFactor = 1.0;glColor4f(1, 0, 0, blendFactor); //blendFactor = 1glBegin(GL_QUADS); // Draw A QuadglVertex3f(-1.0f, 1.0f, 0.0f); // Top LeftglVertex3f( 1.0f, 1.0f, 0.0f); // Top RightglVertex3f( 1.0f,-1.0f, 0.0f); // Bottom RightglVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left // Bottom LeftglEnd();glEnable(GL_DEPTH_TEST); glGetError(); } SwapBuffers(g_hDC); // Swap the backbuffers to the foreground}[/source]

PARTNERS