Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


telaryus

Member Since 27 Feb 2009
Offline Last Active Apr 20 2013 05:42 PM

Topics I've Started

Odd issue when rendering

20 April 2013 - 02:10 AM

Alright... short story is that stuff like this always happens when I try and do graphics. One thinks I would learn, but apparently I'm a masochist. So...

 

Nothing really fancy, small project that sets up a window to draw to.

 

What I am trying to achieve, for personal reasons, is to write my own rasterizer.

 

So first things first here are some links to the issue that I am encountering:

https://www.dropbox.com/s/fmuk9rycvnnyqqg/HATE.png

https://www.dropbox.com/s/dyqibeo31qc448y/HATE%202.png

https://www.dropbox.com/s/979twrhf1g8dkcx/HATE%203.png

 

And here is the code:

Creating the view:

wglMakeCurrent(hdc, hglrc);

glClearColor(0.5f, 0.1f, 0.15f, 1.0f);
glClearDepth(1.0f);
glShadeModel(GL_FLAT);

int width = 0;
int height = 0;
_renderTarget->GetSize(&width, &height);

glViewport(0, 0, width, height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-width/2, width/2, -height/2, height/2, -1.0, 1.0);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

 

 

 

Render the fixed function test background

  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

  glPushMatrix();
  glRotatef(_spin, 0.0f, 0.0, 1.0f);
  glColor3f(0.3f, 0.1f, 0.15f);
  glRectf(-150.0f, -150.0f, 150.0f, 150.0f);
  glPopMatrix();

  _rasterizer->Render();

  HDC hdc = GetDC(_renderTarget->GetHandle());
  SwapBuffers(hdc);
  ReleaseDC(_renderTarget->GetHandle(), hdc);

 

 

 

Render my rasterizer

  glBegin(GL_POINTS);
  glPushMatrix();
  int const RenderBufferSize = m_bufferWidth * m_bufferHeight;
  for (int i = 0; i < RenderBufferSize; ++i)
  {
    int x = i % m_bufferWidth;
    int y = i / m_bufferWidth;
    int halfWidth = m_bufferWidth / 2;
    int halfHeight = m_bufferHeight / 2;

    glColor4ubv(m_renderBuffer[i]);
    glVertex2i(x - halfWidth, halfHeight - y);
  }
  glPopMatrix();
  glEnd();

 

Hopefully that is enough info, if not just ask.

 

Any help is greatly appreciated.


Embedded Python: Distribution Error

27 February 2009 - 12:50 PM

Hello, I've made a simple program to test embedding Python before putting it into a C/C++ application that I am currently working on. The program is pretty straight forward and is as follows:
#include <Python.h>

int main(int, char *argv[])
{
  Py_SetProgramName(argv[0]);
  Py_Initialize();
  PyRun_SimpleString("import time\n"
                     "print time.ctime(time.time())");
  Py_Finalize();

  return 0;
}
All it does is print out the date and time something like: Fri Feb 27 16:47:45 2009 I am using Python 2.6 and VS2005 to compile and link. I have the additional includes set to c:\python26\include the additional library directories set to c:\python26\libs the additional dependencies set to python26.lib Running Warning Lv4 (/W4) with warnings as errors (/WX) That's the setup. The issue that I'm running into at the moment is that on my machine this executable runs cleanly without reporting any sort of error. However, when I move it to another machine. Taking the python26.dll along with it to run Side-by-Side. When the application is run I get the message on the command line that " 'import site' failed ". I'm not really sure what is happening and since the computer that I'm testing on doesn't have Python installed I can't run the script in verbose mode to get a trace back on the what is going on (and doing so on my computer doesn't report any errors.) Now although the error message is produced the application still runs correctly. But the fact that the error happens annoys me and I was wondering if anybody else has this issue or has had it and knows how to fix it or if no one has had this issue what are you doing that might be different from what I'm doing? Thanks for your help. Regards. ~Neb

PARTNERS