Got Penguin sample running under Windows.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1362 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
b669a48e12
commit
45b5751fb4
@ -46,6 +46,10 @@ Creates an image with the given width and height.
|
||||
|
||||
Loads an image from a file.
|
||||
|
||||
\func{}{wxImage}{\param{wxInputStream\& }{stream}, \param{long}{ type = wxIMAGE\_TYPE\_PNG}}
|
||||
|
||||
Loads an image from an input stream.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{width}{Specifies the width of the image.}
|
||||
@ -54,6 +58,8 @@ Loads an image from a file.
|
||||
|
||||
\docparam{name}{This refers to an image filename. Its meaning is determined by the {\it type} parameter.}
|
||||
|
||||
\docparam{stream}{This refers to an input stream. Its meaning is determined by the {\it type} parameter. It is equal to loading from file except that you provide opened stream (file, HTTP or any other custom class).}
|
||||
|
||||
\docparam{type}{May be one of the following:
|
||||
|
||||
\twocolwidtha{5cm}
|
||||
@ -269,11 +275,18 @@ of a given handler class in an application session.}
|
||||
|
||||
Loads an image from a file.
|
||||
|
||||
\func{bool}{LoadFile}{\param{wxInputStream\&}{ stream}, \param{long}{ type}}
|
||||
|
||||
Loads an image from an input stream.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{name}{A filename.
|
||||
The meaning of {\it name} is determined by the {\it type} parameter.}
|
||||
|
||||
\docparam{stream}{An input stream.
|
||||
The meaning of {\it stream} data is determined by the {\it type} parameter.}
|
||||
|
||||
\docparam{type}{One of the following values:
|
||||
|
||||
\twocolwidtha{5cm}
|
||||
@ -321,10 +334,16 @@ TRUE if the handler was found and removed, FALSE otherwise.
|
||||
|
||||
Saves a image in the named file.
|
||||
|
||||
\func{bool}{SaveFile}{\param{wxOutputStream\& }{stream}, \param{int}{ type}}
|
||||
|
||||
Saves a image in the given stream.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{name}{A filename. The meaning of {\it name} is determined by the {\it type} parameter.}
|
||||
|
||||
\docparam{stream}{An output stream. The meaning of {\it stream} is determined by the {\it type} parameter.}
|
||||
|
||||
\docparam{type}{Currently only one type can be used:
|
||||
|
||||
\twocolwidtha{5cm}
|
||||
@ -484,16 +503,16 @@ Gets the image type associated with this handler.
|
||||
|
||||
\membersection{wxImageHandler::LoadFile}\label{wximagehandlerloadfile}
|
||||
|
||||
\func{bool}{LoadFile}{\param{wxImage* }{image}, \param{const wxString\&}{ name}}
|
||||
\func{bool}{LoadFile}{\param{wxImage* }{image}, \param{wxInputStream\&}{ stream}}
|
||||
|
||||
Loads a image from a file or resource, putting the resulting data into {\it image}.
|
||||
Loads a image from a stream, putting the resulting data into {\it image}.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{image}{The image object which is to be affected by this operation.}
|
||||
|
||||
\docparam{name}{Either a filename or a Windows resource name.
|
||||
The meaning of {\it name} is determined by the {\it type} parameter.}
|
||||
\docparam{stream}{Opened input stream.
|
||||
The meaning of {\it stream} is determined by the {\it type} parameter.}
|
||||
|
||||
\wxheading{Return value}
|
||||
|
||||
@ -507,15 +526,15 @@ TRUE if the operation succeeded, FALSE otherwise.
|
||||
|
||||
\membersection{wxImageHandler::SaveFile}\label{wximagehandlersavefile}
|
||||
|
||||
\func{bool}{SaveFile}{\param{wxImage* }{image}, \param{const wxString\& }{name}}
|
||||
\func{bool}{SaveFile}{\param{wxImage* }{image}, \param{wxOutputStream\& }{stream}}
|
||||
|
||||
Saves a image in the named file.
|
||||
Saves a image in the output stream.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{image}{The image object which is to be affected by this operation.}
|
||||
|
||||
\docparam{name}{A filename. The meaning of {\it name} is determined by the {\it type} parameter.}
|
||||
\docparam{stream}{A stream. The meaning of {\it stream} is determined by the {\it type} parameter.}
|
||||
|
||||
\wxheading{Return value}
|
||||
|
||||
|
@ -42,9 +42,13 @@ High Priority
|
||||
|
||||
- Miscellaneous events.
|
||||
|
||||
- Get wxGLCanvas from 1.68 working.
|
||||
|
||||
Low Priority
|
||||
------------
|
||||
|
||||
- Visuals: how to select an appropriate one?
|
||||
|
||||
- Work out why XFreeFont in font.cpp produces a segv. This is
|
||||
currently commented out, which presumably causes a memory leak.
|
||||
|
||||
|
@ -16,6 +16,13 @@ Please see also:
|
||||
|
||||
- Documentation: mention include files with each class.
|
||||
|
||||
- Get Karsten to remove trashed CVS files:
|
||||
|
||||
utils/glcanvas/isosurf/isosurf.dat.gz
|
||||
src/msw/ctl3d/*
|
||||
|
||||
and re-add them.
|
||||
|
||||
- Complete this ToDo list :-)
|
||||
|
||||
|
||||
|
@ -19,4 +19,15 @@ samples/isosurf/*.xbm
|
||||
samples/isosurf/*.dat
|
||||
samples/isosurf/*.dat.gz
|
||||
samples/isosurf/make*.*
|
||||
samples/penguin/*.cpp
|
||||
samples/penguin/*.c
|
||||
samples/penguin/*.h
|
||||
samples/penguin/*.rc
|
||||
samples/penguin/*.ico
|
||||
samples/penguin/*.xbm
|
||||
samples/penguin/*.xpm
|
||||
samples/penguin/make*.*
|
||||
samples/penguin/penguin.lwo
|
||||
|
||||
|
||||
|
||||
|
@ -10,8 +10,8 @@ Penguin: penguin.o trackball.o lw.o glcanvas.o
|
||||
penguin.o: penguin.cpp
|
||||
$(CPP) `wx-config --cflags` -I../../src -c penguin.cpp
|
||||
|
||||
lw.o: lw.c
|
||||
$(CC) `wx-config --cflags` -I../../src -c lw.c
|
||||
lw.o: lw.cpp
|
||||
$(CPP) `wx-config --cflags` -I../../src -c lw.cpp
|
||||
|
||||
trackball.o: trackball.c
|
||||
$(CC) `wx-config --cflags` -I../../src -c trackball.c
|
||||
|
@ -16,8 +16,9 @@
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifdef __WXMSW__
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "lw.h"
|
||||
#include <stdlib.h>
|
||||
@ -100,7 +101,7 @@ static void read_srfs(FILE *f, int nbytes, lwObject *lwo)
|
||||
/* allocate more memory for materials if needed */
|
||||
if (guess_cnt <= lwo->material_cnt) {
|
||||
guess_cnt += guess_cnt/2 + 4;
|
||||
lwo->material = realloc(lwo->material, sizeof(lwMaterial)*guess_cnt);
|
||||
lwo->material = (lwMaterial*) realloc(lwo->material, sizeof(lwMaterial)*guess_cnt);
|
||||
}
|
||||
material = lwo->material + lwo->material_cnt++;
|
||||
|
||||
@ -112,7 +113,7 @@ static void read_srfs(FILE *f, int nbytes, lwObject *lwo)
|
||||
material->g = 0.7;
|
||||
material->b = 0.7;
|
||||
}
|
||||
lwo->material = realloc(lwo->material, sizeof(lwMaterial)*lwo->material_cnt);
|
||||
lwo->material = (lwMaterial*) realloc(lwo->material, sizeof(lwMaterial)*lwo->material_cnt);
|
||||
}
|
||||
|
||||
|
||||
@ -164,7 +165,7 @@ static void read_pols(FILE *f, int nbytes, lwObject *lwo)
|
||||
/* allocate more memory for polygons if necessary */
|
||||
if (guess_cnt <= lwo->face_cnt) {
|
||||
guess_cnt += guess_cnt + 4;
|
||||
lwo->face = realloc(lwo->face, sizeof(lwFace)*guess_cnt);
|
||||
lwo->face = (lwFace*) realloc((void*) lwo->face, sizeof(lwFace)*guess_cnt);
|
||||
}
|
||||
face = lwo->face + lwo->face_cnt++;
|
||||
|
||||
@ -173,7 +174,7 @@ static void read_pols(FILE *f, int nbytes, lwObject *lwo)
|
||||
nbytes -= 2;
|
||||
|
||||
/* allocate space for points */
|
||||
face->index = calloc(sizeof(int)*face->index_cnt,1);
|
||||
face->index = (int*) calloc(sizeof(int)*face->index_cnt,1);
|
||||
|
||||
/* read points in */
|
||||
for (i=0; i<face->index_cnt; i++) {
|
||||
@ -200,7 +201,7 @@ static void read_pols(FILE *f, int nbytes, lwObject *lwo)
|
||||
face->material -= 1;
|
||||
}
|
||||
/* readjust to true size */
|
||||
lwo->face = realloc(lwo->face, sizeof(lwFace)*lwo->face_cnt);
|
||||
lwo->face = (lwFace*) realloc(lwo->face, sizeof(lwFace)*lwo->face_cnt);
|
||||
}
|
||||
|
||||
|
||||
@ -209,7 +210,7 @@ static void read_pnts(FILE *f, int nbytes, lwObject *lwo)
|
||||
{
|
||||
int i;
|
||||
lwo->vertex_cnt = nbytes / 12;
|
||||
lwo->vertex = calloc(sizeof(GLfloat)*lwo->vertex_cnt*3, 1);
|
||||
lwo->vertex = (float*) calloc(sizeof(GLfloat)*lwo->vertex_cnt*3, 1);
|
||||
for (i=0; i<lwo->vertex_cnt; i++) {
|
||||
lwo->vertex[i*3+0] = read_float(f);
|
||||
lwo->vertex[i*3+1] = read_float(f);
|
||||
@ -265,7 +266,7 @@ lwObject *lw_object_read(const char *lw_file)
|
||||
}
|
||||
|
||||
/* create new lwObject */
|
||||
lw_object = calloc(sizeof(lwObject),1);
|
||||
lw_object = (lwObject*) calloc(sizeof(lwObject),1);
|
||||
|
||||
/* read chunks */
|
||||
while (read_bytes < form_bytes) {
|
@ -49,6 +49,9 @@ typedef struct {
|
||||
|
||||
} lwObject;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int lw_is_lwobject(const char *lw_file);
|
||||
lwObject *lw_object_read(const char *lw_file);
|
||||
@ -58,5 +61,9 @@ void lw_object_show(const lwObject *lw_object);
|
||||
GLfloat lw_object_radius(const lwObject *lw_object);
|
||||
void lw_object_scale (lwObject *lw_object, GLfloat scale);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LW_H */
|
||||
|
||||
|
71
utils/glcanvas/samples/penguin/makefile.nt
Normal file
71
utils/glcanvas/samples/penguin/makefile.nt
Normal file
@ -0,0 +1,71 @@
|
||||
#
|
||||
# File: makefile.nt
|
||||
# Author: Julian Smart
|
||||
# Created: 1997
|
||||
# Updated:
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile : Builds penguin example (MS VC++).
|
||||
# Use FINAL=1 argument to nmake to build final version with no debugging
|
||||
# info
|
||||
|
||||
# Set WXDIR for your system
|
||||
WXDIR = $(WXWIN)
|
||||
|
||||
WXUSINGDLL=0
|
||||
|
||||
EXTRAINC=-I..\..\win
|
||||
EXTRALIBS=$(WXDIR)\lib\glcanvas.lib glu32.lib opengl32.lib
|
||||
|
||||
!include $(WXDIR)\src\ntwxwin.mak
|
||||
|
||||
THISDIR = $(WXDIR)\utils\glcanvas\samples\penguin
|
||||
PROGRAM=penguin
|
||||
|
||||
OBJECTS = $(PROGRAM).obj trackball.obj lw.obj
|
||||
|
||||
$(PROGRAM): $(PROGRAM).exe
|
||||
|
||||
all: wx $(PROGRAM).exe
|
||||
|
||||
wx:
|
||||
cd $(WXDIR)\src\msw
|
||||
nmake -f makefile.nt FINAL=$(FINAL)
|
||||
cd $(THISDIR)
|
||||
|
||||
wxclean:
|
||||
cd $(WXDIR)\src\msw
|
||||
nmake -f makefile.nt clean
|
||||
cd $(THISDIR)
|
||||
|
||||
$(PROGRAM).exe: $(DUMMYOBJ) $(WXLIB) $(OBJECTS) $(PROGRAM).res
|
||||
$(link) @<<
|
||||
-out:$(PROGRAM).exe
|
||||
$(LINKFLAGS)
|
||||
$(DUMMYOBJ) $(OBJECTS) $(PROGRAM).res
|
||||
$(LIBS)
|
||||
<<
|
||||
|
||||
|
||||
$(PROGRAM).obj: $(PROGRAM).$(SRCSUFF) $(PROGRAM).h $(DUMMYOBJ)
|
||||
$(cc) @<<
|
||||
$(CPPFLAGS2) /c /Tp $*.$(SRCSUFF)
|
||||
<<
|
||||
|
||||
lw.obj: lw.c lw.h
|
||||
$(cc) @<<
|
||||
$(CPPFLAGS2) /c $*.$(SRCSUFF)
|
||||
<<
|
||||
|
||||
$(PROGRAM).res : $(PROGRAM).rc $(WXDIR)\include\wx\msw\wx.rc
|
||||
$(rc) -r /i$(WXDIR)\include -fo$@ $(PROGRAM).rc
|
||||
|
||||
|
||||
clean:
|
||||
-erase *.obj
|
||||
-erase *.exe
|
||||
-erase *.res
|
||||
-erase *.map
|
||||
-erase *.sbr
|
||||
-erase *.pdb
|
@ -183,15 +183,16 @@ void TestGLCanvas::LoadLWO(const wxString &filename)
|
||||
|
||||
void TestGLCanvas::OnMouse( wxMouseEvent& event )
|
||||
{
|
||||
wxSize sz(GetClientSize());
|
||||
if (event.Dragging())
|
||||
{
|
||||
/* drag in progress, simulate trackball */
|
||||
float spin_quat[4];
|
||||
trackball(spin_quat,
|
||||
(2.0*info.beginx - m_width) / m_width,
|
||||
( m_height - 2.0*info.beginy) / m_height,
|
||||
( 2.0*event.GetX() - m_width) / m_width,
|
||||
( m_height - 2.0*event.GetY()) / m_height);
|
||||
(2.0*info.beginx - sz.x) / sz.x,
|
||||
( sz.y - 2.0*info.beginy) / sz.y,
|
||||
( 2.0*event.GetX() - sz.x) / sz.x,
|
||||
( sz.y - 2.0*event.GetY()) / sz.y);
|
||||
|
||||
add_quats( spin_quat, info.quat, info.quat );
|
||||
|
||||
|
@ -28,7 +28,8 @@ extern "C" {
|
||||
/* information needed to display lightwave mesh */
|
||||
typedef struct
|
||||
{
|
||||
gint do_init; /* true if initgl not yet called */
|
||||
// gint do_init; /* true if initgl not yet called */
|
||||
int do_init;
|
||||
lwObject *lwobject; /* lightwave object mesh */
|
||||
float beginx,beginy; /* position of mouse */
|
||||
float quat[4]; /* orientation of object */
|
||||
|
3
utils/glcanvas/samples/penguin/penguin.rc
Normal file
3
utils/glcanvas/samples/penguin/penguin.rc
Normal file
@ -0,0 +1,3 @@
|
||||
/* mondrian ICON "mondrian.ico" */
|
||||
#include "wx/msw/wx.rc"
|
||||
|
Loading…
Reference in New Issue
Block a user