Witam nigdzie nie mogę otrzymać pomocy z moim problemem. Visual cały czas pokazuje mi ten sam błąd a jestem przekonany, że kod powinien być dobry. Proszę o pomoc
Na poczatku plik nagłowkowy App.h
[code]
#pragma once
#include <SDL/SDL.h>
#include <windows.h>
#include <gl\gl.h>
#include <gl\glu.h>
#include <gl\glaux.h>
#include <GL\glext.h>
#include <GL\glui.h>
#include <GL\glut.h>
class App
{
public:
App(void);
~App(void);
explicit App(size_t win_width, size_t win_height, bool fullscreen_mode)
: m_window_width(win_width), m_window_height(win_height), m_fullscreen(fullscreen_mode)
{
}
void Run();
void siema();
private:
void Draw();
void Update(double dt);
void Resize(size_t szerokosc, size_t wysokosc);
void ProcessEvents();
private:
size_t m_window_width;
size_t m_window_height;
bool m_fullscreen;
bool is_done;
SDL_Surface* m_screen;
};
[/code]
Teraz App.cpp
[code]
#include "App.h"
#include <assert.h>
#include "StdAfx.h"
#include <cassert>
#define App_h
#include <iostream>
App::App(void)
{
} //<--- visual wlasnie w tym miejscu pokazuje błąd
App::~App(void)
{
}
void App::Run()
{ // INICJALIZACJA OKNA
SDL_Init(SDL_INIT_VIDEO);
Resize (m_window_width, m_window_height);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); //PODWOJNE BUFOROWANIE
//INICJALIZACJA OpenGL
glClearDepth(1);
glClearColor(0, 0, 0, 0);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
// pętla główna
is_done = false;
size_t last_ticks = SDL_GetTicks();
while (!is_done)
{
ProcessEvents();
// time update
size_t ticks = SDL_GetTicks();
double czas_delty = (ticks - last_ticks) / 1000.0;
last_ticks = ticks;
// update i render
if (czas_delty > 0)
{
Update(czas_delty);
}
Draw();
}
SDL_Quit();
}
void App::Draw() {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glBegin(GL_TRIANGLES);
{
glColor3f(1, 1, 0); // żółty
glVertex2f(1, 1);
glVertex2f(0, 1);
glVertex2f(0, 0);
// tu można podać kolejne trójkąty
// czyli kolejne wywołania glColor3f, glVertex2f
}
glEnd();
SDL_GL_SwapBuffers();
}
void App::ProcessEvents()
{
if (is_done)
{ // jeżeli mamy zakończyć, to pomijamy obsługę zdarzeń
return;
}
// przejrzymy kolejne zdarzenia z kolejki
SDL_Event event;
while (SDL_PollEvent(&event))
{
if (event.type == SDL_VIDEORESIZE)
{ // zmiana rozmiaru okna
Resize(event.resize.w, event.resize.h);
}
else if (event.type == SDL_QUIT)
{ // zamknięcie okna
is_done = true;
break;
}
}
}
void App::Resize(size_t width, size_t height)
{
m_screen = SDL_SetVideoMode(width, height, 32,
SDL_OPENGL | SDL_RESIZABLE | SDL_HWSURFACE);
assert(m_screen);
m_window_width = width;
m_window_height = height;
glViewport(0, 0, static_cast<int>(width), static_cast<int>(height));
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, 1, 0, 1, -1, 10);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
[/code]
oraz main.cpp
[code]
#include "stdafx.h"
#include <iostream>
#include <conio.h>
#include "App.h"
//int _tmain(int argc, _TCHAR* argv[])
int main(int argc, char *argv[])
{
App app(600, 400, false);
app.Run();
return 0;
}
[/code]
Proszę o pomoc.